xref: /llvm-project/clang/test/CodeGen/profile-filter-new.c (revision 6f4c3c0f6463880b685bfbca1932c06fd0c1f015)
1 // RUN: %clang_cc1 -fprofile-instrument=llvm -emit-llvm %s -o - | FileCheck %s --implicit-check-not="; {{.* (noprofile|skipprofile)}}"
2 
3 // RUN: echo -e "[llvm]\nfunction:foo=skip" > %t0.list
4 // RUN: %clang_cc1 -fprofile-instrument=llvm -fprofile-list=%t0.list -emit-llvm %s -o - | FileCheck %s --implicit-check-not="; {{.* (noprofile|skipprofile)}}" --check-prefixes=CHECK,SKIP-FOO
5 
6 // RUN: echo -e "[csllvm]\nfunction:bar=forbid" > %t1.list
7 // RUN: %clang_cc1 -fprofile-instrument=csllvm -fprofile-list=%t1.list -emit-llvm %s -o - | FileCheck %s --implicit-check-not="; {{.* (noprofile|skipprofile)}}" --check-prefixes=CHECK,FORBID-BAR
8 // RUN: %clang_cc1 -fprofile-instrument=llvm -fprofile-list=%t1.list -emit-llvm %s -o - | FileCheck %s --implicit-check-not="; {{.* (noprofile|skipprofile)}}"
9 
10 // RUN: echo -e "[llvm]\ndefault:forbid\nfunction:foo=allow" > %t2.list
11 // RUN: %clang_cc1 -fprofile-instrument=llvm -fprofile-list=%t2.list -emit-llvm %s -o - | FileCheck %s --implicit-check-not="; {{.* (noprofile|skipprofile)}}" --check-prefixes=CHECK,FORBID
12 
13 // RUN: echo "[llvm]" > %t2.list
14 // RUN: echo "source:%s=forbid" | sed -e 's/\\/\\\\/g' >> %t2.list
15 // RUN: echo "function:foo=allow" >> %t2.list
16 // RUN: %clang_cc1 -fprofile-instrument=llvm -fprofile-list=%t2.list -emit-llvm %s -o - | FileCheck %s --implicit-check-not="; {{.* (noprofile|skipprofile)}}" --check-prefixes=CHECK,FORBID
17 
18 // SKIP-FOO: skipprofile
19 // CHECK-LABEL: define {{.*}} @foo
foo(int a)20 int foo(int a) { return 4 * a + 1; }
21 
22 // FORBID-BAR: noprofile
23 // FORBID: noprofile
24 // CHECK-LABEL: define {{.*}} @bar
bar(int a)25 int bar(int a) { return 4 * a + 2; }
26 
27 // FORBID: noprofile
28 // CHECK-LABEL: define {{.*}} @goo
goo(int a)29 int goo(int a) { return 4 * a + 3; }
30