1 // XFAIL: target={{.*}}-aix{{.*}}
2 // RUN: %clang_profgen -o %t -O3 %s
3 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
4 // RUN: llvm-profdata merge -o %t.profdata %t.profraw
5 // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
7 int __llvm_profile_runtime
= 0;
8 void __llvm_profile_initialize_file(void);
9 int __llvm_profile_write_file(void);
10 void __llvm_profile_set_filename(const char *);
12 int main(int argc
, const char *argv
[]) {
13 // CHECK-LABEL: define {{.*}} @main(
14 // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
18 // Since the runtime has been suppressed, initialize the file name, as the
19 // writing will fail below as the file name has not been specified.
20 __llvm_profile_initialize_file();
22 // Write out the profile.
23 __llvm_profile_write_file();
25 // Change the profile.
29 // There should be no profiling information for @foo, since it was called
30 // after the profile was written (and the atexit was suppressed by defining
32 // CHECK-LABEL: define {{.*}} @foo(
33 // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
34 return X
<= 0 ? -X
: X
;
36 // CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}