Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / CodeGen / sanitize-metadata-ignorelist.c
blob4dc8c0c35fefee36c41a64ec770b9c14f41cc643
1 // RUN: %clang_cc1 -O -fexperimental-sanitize-metadata=atomics -triple x86_64-gnu-linux -x c -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 -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 -emit-llvm %s -o - | FileCheck %s --check-prefixes=SRC
7 int y;
9 // ALLOW-LABEL: define {{[^@]+}}@foo
10 // ALLOW-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] !pcsections !2 {
11 // ALLOW-NEXT: entry:
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]+]] {
17 // FUN-NEXT: entry:
18 // FUN-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 1 monotonic, align 4
19 // FUN-NEXT: ret void
21 // SRC-LABEL: define {{[^@]+}}@foo
22 // SRC-SAME: () local_unnamed_addr #[[ATTR0:[0-9]+]] {
23 // SRC-NEXT: entry:
24 // SRC-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 1 monotonic, align 4
25 // SRC-NEXT: ret void
27 void foo() {
28 __atomic_fetch_add(&y, 1, __ATOMIC_RELAXED);
31 // ALLOW-LABEL: define {{[^@]+}}@bar
32 // ALLOW-SAME: () local_unnamed_addr #[[ATTR0]] !pcsections !2 {
33 // ALLOW-NEXT: entry:
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 {
39 // FUN-NEXT: entry:
40 // FUN-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 2 monotonic, align 4, !pcsections !4
41 // FUN-NEXT: ret void
43 // SRC-LABEL: define {{[^@]+}}@bar
44 // SRC-SAME: () local_unnamed_addr #[[ATTR0]] {
45 // SRC-NEXT: entry:
46 // SRC-NEXT: [[TMP0:%.*]] = atomicrmw add ptr @y, i32 2 monotonic, align 4
47 // SRC-NEXT: ret void
49 void bar() {
50 __atomic_fetch_add(&y, 2, __ATOMIC_RELAXED);
53 // ALLOW: __sanitizer_metadata_covered2.module_ctor
54 // FUN: __sanitizer_metadata_covered2.module_ctor
55 // SRC-NOT: __sanitizer_metadata_covered{{.*}}.module_ctor