Remove building with NOCRYPTO option
[minix.git] / sys / external / bsd / compiler_rt / dist / test / profile / instrprof-write-file-only.c
blob65a222672b56c1046d2584352931b235798e32d0
1 // RUN: %clang_profgen -o %t -O3 %s
2 // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
3 // RUN: llvm-profdata merge -o %t.profdata %t.profraw
4 // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
6 int __llvm_profile_runtime = 0;
7 void __llvm_profile_initialize_file(void);
8 int __llvm_profile_write_file(void);
9 void __llvm_profile_set_filename(const char *);
10 int foo(int);
11 int main(int argc, const char *argv[]) {
12 // CHECK-LABEL: define i32 @main
13 // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof !1
14 if (argc > 1)
15 return 1;
17 // Since the runtime has been suppressed, initialize the file name, as the
18 // writing will fail below as the file name has not been specified.
19 __llvm_profile_initialize_file();
21 // Write out the profile.
22 __llvm_profile_write_file();
24 // Change the profile.
25 return foo(0);
27 int foo(int X) {
28 // There should be no profiling information for @foo, since it was called
29 // after the profile was written (and the atexit was suppressed by defining
30 // profile_runtime).
31 // CHECK-LABEL: define i32 @foo
32 // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{[^,]+$}}
33 return X <= 0 ? -X : X;
35 // CHECK: !1 = metadata !{metadata !"branch_weights", i32 1, i32 2}