1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-COMDAT 2*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-apple-darwin -pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-DARWIN-LINKONCE 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; New PM 5*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-COMDAT 6*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -mtriple=x86_64-apple-darwin -passes=pgo-instr-gen -S | FileCheck %s --check-prefix=GEN --check-prefix=GEN-DARWIN-LINKONCE 7*9880d681SAndroid Build Coastguard Worker 8*9880d681SAndroid Build Coastguard Worker; RUN: llvm-profdata merge %S/Inputs/branch1.proftext -o %t.profdata 9*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE 10*9880d681SAndroid Build Coastguard Worker 11*9880d681SAndroid Build Coastguard Worker; New PM 12*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -S | FileCheck %s --check-prefix=USE 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Workertarget datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 15*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-unknown-linux-gnu" 16*9880d681SAndroid Build Coastguard Worker; GEN-DARWIN-LINKONCE: target triple = "x86_64-apple-darwin" 17*9880d681SAndroid Build Coastguard Worker 18*9880d681SAndroid Build Coastguard Worker; GEN-COMDAT: $__llvm_profile_raw_version = comdat any 19*9880d681SAndroid Build Coastguard Worker; GEN-COMDAT: @__llvm_profile_raw_version = constant i64 {{[0-9]+}}, comdat 20*9880d681SAndroid Build Coastguard Worker; GEN-LINKONCE: @__llvm_profile_raw_version = linkonce constant i64 {{[0-9]+}} 21*9880d681SAndroid Build Coastguard Worker; GEN: @__profn_test_br_1 = private constant [9 x i8] c"test_br_1" 22*9880d681SAndroid Build Coastguard Worker 23*9880d681SAndroid Build Coastguard Workerdefine i32 @test_br_1(i32 %i) { 24*9880d681SAndroid Build Coastguard Worker; USE-LABEL: @test_br_1 25*9880d681SAndroid Build Coastguard Worker; USE-SAME: !prof ![[FUNC_ENTRY_COUNT:[0-9]+]] 26*9880d681SAndroid Build Coastguard Workerentry: 27*9880d681SAndroid Build Coastguard Worker; GEN: entry: 28*9880d681SAndroid Build Coastguard Worker; GEN-NOT: llvm.instrprof.increment 29*9880d681SAndroid Build Coastguard Worker %cmp = icmp sgt i32 %i, 0 30*9880d681SAndroid Build Coastguard Worker br i1 %cmp, label %if.then, label %if.end 31*9880d681SAndroid Build Coastguard Worker; USE: br i1 %cmp, label %if.then, label %if.end 32*9880d681SAndroid Build Coastguard Worker; USE-SAME: !prof ![[BW_ENTRY:[0-9]+]] 33*9880d681SAndroid Build Coastguard Worker; USE-DAG: ![[BW_ENTRY]] = !{!"branch_weights", i32 2, i32 1} 34*9880d681SAndroid Build Coastguard Worker 35*9880d681SAndroid Build Coastguard Workerif.then: 36*9880d681SAndroid Build Coastguard Worker; GEN: if.then: 37*9880d681SAndroid Build Coastguard Worker; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_1, i32 0, i32 0), i64 25571299074, i32 2, i32 1) 38*9880d681SAndroid Build Coastguard Worker %add = add nsw i32 %i, 2 39*9880d681SAndroid Build Coastguard Worker br label %if.end 40*9880d681SAndroid Build Coastguard Worker 41*9880d681SAndroid Build Coastguard Workerif.end: 42*9880d681SAndroid Build Coastguard Worker; GEN: if.end: 43*9880d681SAndroid Build Coastguard Worker; GEN: call void @llvm.instrprof.increment(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @__profn_test_br_1, i32 0, i32 0), i64 25571299074, i32 2, i32 0) 44*9880d681SAndroid Build Coastguard Worker %retv = phi i32 [ %add, %if.then ], [ %i, %entry ] 45*9880d681SAndroid Build Coastguard Worker ret i32 %retv 46*9880d681SAndroid Build Coastguard Worker} 47*9880d681SAndroid Build Coastguard Worker; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}} 48*9880d681SAndroid Build Coastguard Worker; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}} 49*9880d681SAndroid Build Coastguard Worker; USE-DAG: ![[FUNC_ENTRY_COUNT]] = !{!"function_entry_count", i64 3} 50