1*0a6a1f1dSLionel Sambuc // RUN: %clang_profgen -o %t -O3 %s 2*0a6a1f1dSLionel Sambuc // RUN: env LLVM_PROFILE_FILE=%t.profraw %run %t 3*0a6a1f1dSLionel Sambuc // RUN: llvm-profdata merge -o %t.profdata %t.profraw 4*0a6a1f1dSLionel Sambuc // RUN: %clang_profuse=%t.profdata -o - -S -emit-llvm %s | FileCheck %s 5*0a6a1f1dSLionel Sambuc 6*0a6a1f1dSLionel Sambuc void __llvm_profile_reset_counters(void); 7*0a6a1f1dSLionel Sambuc void foo(int); main(void)8*0a6a1f1dSLionel Sambucint main(void) { 9*0a6a1f1dSLionel Sambuc foo(0); 10*0a6a1f1dSLionel Sambuc __llvm_profile_reset_counters(); 11*0a6a1f1dSLionel Sambuc foo(1); 12*0a6a1f1dSLionel Sambuc return 0; 13*0a6a1f1dSLionel Sambuc } foo(int N)14*0a6a1f1dSLionel Sambucvoid foo(int N) { 15*0a6a1f1dSLionel Sambuc // CHECK-LABEL: define void @foo( 16*0a6a1f1dSLionel Sambuc // CHECK: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[FOO:[0-9]+]] 17*0a6a1f1dSLionel Sambuc if (N) {} 18*0a6a1f1dSLionel Sambuc } 19*0a6a1f1dSLionel Sambuc // CHECK: ![[FOO]] = metadata !{metadata !"branch_weights", i32 2, i32 1} 20