Home | History | Annotate | Line # | Download | only in Linux
      1  1.1  joerg // RUN: %clang_profgen -fdata-sections -ffunction-sections -fuse-ld=gold -Wl,--gc-sections -o %t -O3 %s
      2  1.1  joerg // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t
      3  1.1  joerg // RUN: llvm-profdata merge -o %t.profdata %t.profraw
      4  1.1  joerg // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s
      5  1.1  joerg 
      6  1.1  joerg int begin(int i) {
      7  1.1  joerg   // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
      8  1.1  joerg   if (i)
      9  1.1  joerg     return 0;
     10  1.1  joerg   return 1;
     11  1.1  joerg }
     12  1.1  joerg 
     13  1.1  joerg int end(int i) {
     14  1.1  joerg   // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
     15  1.1  joerg   if (i)
     16  1.1  joerg     return 0;
     17  1.1  joerg   return 1;
     18  1.1  joerg }
     19  1.1  joerg 
     20  1.1  joerg int main(int argc, const char *argv[]) {
     21  1.1  joerg   begin(0);
     22  1.1  joerg   end(1);
     23  1.1  joerg 
     24  1.1  joerg   // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
     25  1.1  joerg   if (argc)
     26  1.1  joerg     return 0;
     27  1.1  joerg   return 1;
     28  1.1  joerg }
     29  1.1  joerg 
     30  1.1  joerg // CHECK: ![[PD1]] = !{!"branch_weights", i32 1, i32 2}
     31  1.1  joerg // CHECK: ![[PD2]] = !{!"branch_weights", i32 2, i32 1}
     32