1 // RUN: %clang_cc1 -O -fexperimental-sanitize-metadata=atomics -triple x86_64-gnu-linux -x c -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,ATOMICS
2 // RUN: %clang_cc1 -O -fexperimental-sanitize-metadata=atomics -triple aarch64-gnu-linux -x c -emit-llvm %s -o - | FileCheck %s --check-prefixes=CHECK,ATOMICS
4 // CHECK: @__start_sanmd_atomics2 = extern_weak hidden global ptr
5 // CHECK: @__stop_sanmd_atomics2 = extern_weak hidden global ptr
6 // CHECK: @__start_sanmd_covered2 = extern_weak hidden global ptr
7 // CHECK: @__stop_sanmd_covered2 = extern_weak hidden global ptr
12 // CHECK-NOT: define dso_local void @empty() {{.*}} !pcsections
16 // ATOMICS-LABEL: define dso_local i32 @atomics()
17 // ATOMICS-SAME: !pcsections ![[ATOMICS_COVERED:[0-9]+]]
18 // ATOMICS-NEXT: entry:
19 // ATOMICS-NEXT: atomicrmw add {{.*}} !pcsections ![[ATOMIC_OP:[0-9]+]]
20 // ATOMICS-NOT: load {{.*}} !pcsections
21 __atomic_fetch_add(&x
, 1, __ATOMIC_RELAXED
);
24 // ATOMICS-LABEL: __sanitizer_metadata_atomics2.module_ctor
25 // ATOMICS: call void @__sanitizer_metadata_atomics_add(i32 2, ptr @__start_sanmd_atomics2, ptr @__stop_sanmd_atomics2)
26 // ATOMICS-LABEL: __sanitizer_metadata_atomics2.module_dtor
27 // ATOMICS: call void @__sanitizer_metadata_atomics_del(i32 2, ptr @__start_sanmd_atomics2, ptr @__stop_sanmd_atomics2)
29 // CHECK-LABEL: __sanitizer_metadata_covered2.module_ctor
30 // CHECK: call void @__sanitizer_metadata_covered_add(i32 2, ptr @__start_sanmd_covered2, ptr @__stop_sanmd_covered2)
31 // CHECK-LABEL: __sanitizer_metadata_covered2.module_dtor
32 // CHECK: call void @__sanitizer_metadata_covered_del(i32 2, ptr @__start_sanmd_covered2, ptr @__stop_sanmd_covered2)
34 // ATOMICS: ![[ATOMICS_COVERED]] = !{!"sanmd_covered2!C", ![[ATOMICS_COVERED_AUX:[0-9]+]]}
35 // ATOMICS: ![[ATOMICS_COVERED_AUX]] = !{i64 1}
36 // ATOMICS: ![[ATOMIC_OP]] = !{!"sanmd_atomics2!C"}