xref: /llvm-project/compiler-rt/test/profile/instrprof-override-filename.c (revision 5c31b8b94fddc7c109672964c72670430fe30887)
1ff3227e7SVedant Kumar // RUN: rm -rf %t.dir && mkdir -p %t.dir
2ff3227e7SVedant Kumar // RUN: cd %t.dir
3ff3227e7SVedant Kumar //
4ff3227e7SVedant Kumar // RUN: %clang_profgen=P_RAW -o %t -O3 %s
5ff3227e7SVedant Kumar // RUN: %run %t P_RAW
6ff3227e7SVedant Kumar // RUN: llvm-profdata merge -o %t.profdata P_RAW
7ff3227e7SVedant Kumar // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=FE
8ff3227e7SVedant Kumar //
9ff3227e7SVedant Kumar // RUN: %clang_pgogen=I_RAW -o %t.2 %s
10ff3227e7SVedant Kumar // RUN: %run %t.2 I_RAW
11ff3227e7SVedant Kumar // RUN: llvm-profdata merge -o %t2.profdata I_RAW
12ff3227e7SVedant Kumar // RUN: %clang_profuse=%t2.profdata -o - -S -emit-llvm %s | FileCheck %s --check-prefix=IR
134b3dd38cSEric Christopher 
bar()14e953933aSXinliang David Li void bar() {}
main(int argc,const char * argv[])154b3dd38cSEric Christopher int main(int argc, const char *argv[]) {
16ff3227e7SVedant Kumar   // FE: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
17ff3227e7SVedant Kumar   // IR: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
184b3dd38cSEric Christopher   if (argc < 2)
194b3dd38cSEric Christopher     return 1;
20e953933aSXinliang David Li   bar();
214b3dd38cSEric Christopher   return 0;
224b3dd38cSEric Christopher }
23*5c31b8b9SArthur Eubanks // FE: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
24*5c31b8b9SArthur Eubanks // IR: ![[PD1]] = !{!"branch_weights", i32 0, i32 1}
25