1 // RUN: %clang_cc1 -O -fexperimental-sanitize-metadata=atomics -triple x86_64-gnu-linux -x c -S -emit-llvm %s -o - | FileCheck %s --check-prefixes=ALLOW
2 // RUN: echo "fun:foo" > %t.fun
3 // RUN: %clang_cc1 -O -fexperimental-sanitize-metadata=atomics -fexperimental-sanitize-metadata-ignorelist=%t.fun -triple x86_64-gnu-linux -x c -S -emit-llvm %s -o - | FileCheck %s --check-prefixes=FUN
4 // RUN: echo "src:*sanitize-metadata-ignorelist.c" > %t.src
5 // RUN: %clang_cc1 -O -fexperimental-sanitize-metadata=atomics -fexperimental-sanitize-metadata-ignorelist=%t.src -triple x86_64-gnu-linux -x c -S -emit-llvm %s -o - | FileCheck %s --check-prefixes=SRC
9 // ALLOW-LABEL: define {{[^@]+}}@foo
10 // ALLOW-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] !pcsections !2 {
12 // ALLOW-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 1 monotonic, align 4, !pcsections !4
13 // ALLOW-NEXT: ret void
15 // FUN-LABEL: define {{[^@]+}}@foo
16 // FUN-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] {
18 // FUN-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 1 monotonic, align 4
21 // SRC-LABEL: define {{[^@]+}}@foo
22 // SRC-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] {
24 // SRC-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 1 monotonic, align 4
28 __atomic_fetch_add(&y
, 1, __ATOMIC_RELAXED
);
31 // ALLOW-LABEL: define {{[^@]+}}@bar
32 // ALLOW-SAME: () local_unnamed_addr #[[ATTR0]] !pcsections !2 {
34 // ALLOW-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 2 monotonic, align 4, !pcsections !4
35 // ALLOW-NEXT: ret void
37 // FUN-LABEL: define {{[^@]+}}@bar
38 // FUN-SAME: () local_unnamed_addr #[[ATTR0]] !pcsections !2 {
40 // FUN-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 2 monotonic, align 4, !pcsections !4
43 // SRC-LABEL: define {{[^@]+}}@bar
44 // SRC-SAME: () local_unnamed_addr #[[ATTR0]] {
46 // SRC-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 2 monotonic, align 4
50 __atomic_fetch_add(&y
, 2, __ATOMIC_RELAXED
);
53 // ALLOW: __sanitizer_metadata_covered.module_ctor
54 // FUN: __sanitizer_metadata_covered.module_ctor
55 // SRC-NOT: __sanitizer_metadata_covered.module_ctor