xref: /aosp_15_r20/external/compiler-rt/test/profile/instrprof-set-filename-then-reset-default.c (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1*7c3d14c8STreehugger Robot // RUN: rm -rf %t.d
2*7c3d14c8STreehugger Robot // RUN: mkdir -p %t.d
3*7c3d14c8STreehugger Robot // RUN: cd %t.d
4*7c3d14c8STreehugger Robot // RUN: %clang_profgen -O3 %s -o %t.out
5*7c3d14c8STreehugger Robot // RUN: %run %t.out %t.d/bad.profraw
6*7c3d14c8STreehugger Robot // RUN: llvm-profdata merge -o %t.d/default.profdata %t.d/default.profraw
7*7c3d14c8STreehugger Robot // RUN: %clang_profuse=%t.d/default.profdata -o - -S -emit-llvm %s | FileCheck %s
8*7c3d14c8STreehugger Robot 
9*7c3d14c8STreehugger Robot void __llvm_profile_set_filename(const char *);
main(int argc,const char * argv[])10*7c3d14c8STreehugger Robot int main(int argc, const char *argv[]) {
11*7c3d14c8STreehugger Robot   // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
12*7c3d14c8STreehugger Robot   if (argc < 2)
13*7c3d14c8STreehugger Robot     return 1;
14*7c3d14c8STreehugger Robot   __llvm_profile_set_filename(argv[1]);
15*7c3d14c8STreehugger Robot   __llvm_profile_set_filename(0);
16*7c3d14c8STreehugger Robot   return 0;
17*7c3d14c8STreehugger Robot }
18*7c3d14c8STreehugger Robot // CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
19