1cee313d2SEric Christopher; RUN: opt < %s -passes=pgo-instr-gen -pgo-instr-select=true -S | FileCheck %s --check-prefix=GEN 2cee313d2SEric Christopher; RUN: opt < %s -passes=pgo-instr-gen -pgo-instr-select=false -S | FileCheck %s --check-prefix=NOSELECT 3cee313d2SEric Christopher; RUN: llvm-profdata merge %S/Inputs/select1.proftext -o %t.profdata 4cee313d2SEric Christopher; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-select=true -S | FileCheck %s --check-prefix=USE 57b1d7937SAmy Huangtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 6cee313d2SEric Christophertarget triple = "x86_64-unknown-linux-gnu" 7cee313d2SEric Christopher 8cee313d2SEric Christopherdefine i32 @test_br_2(i32 %i) { 9cee313d2SEric Christopherentry: 10cee313d2SEric Christopher %cmp = icmp sgt i32 %i, 0 11cee313d2SEric Christopher br i1 %cmp, label %if.then, label %if.else 12cee313d2SEric Christopher 13cee313d2SEric Christopherif.then: 14cee313d2SEric Christopher %add = add nsw i32 %i, 2 15cee313d2SEric Christopher;GEN: %[[STEP:[0-9]+]] = zext i1 %cmp to i64 16cee313d2SEric Christopher;GEN: call void @llvm.instrprof.increment.step({{.*}} i32 3, i32 2, i64 %[[STEP]]) 17cee313d2SEric Christopher;NOSELECT-NOT: call void @llvm.instrprof.increment.step 18cee313d2SEric Christopher %s = select i1 %cmp, i32 %add, i32 0 19cee313d2SEric Christopher;USE: select i1 %cmp{{.*}}, !prof ![[BW_ENTRY:[0-9]+]] 20*5c31b8b9SArthur Eubanks;USE: ![[BW_ENTRY]] = !{!"branch_weights", i32 1, i32 3} 21cee313d2SEric Christopher 22cee313d2SEric Christopher br label %if.end 23cee313d2SEric Christopher 24cee313d2SEric Christopherif.else: 25cee313d2SEric Christopher %sub = sub nsw i32 %i, 2 26cee313d2SEric Christopher br label %if.end 27cee313d2SEric Christopher 28cee313d2SEric Christopherif.end: 29cee313d2SEric Christopher %retv = phi i32 [ %add, %if.then ], [ %sub, %if.else ] 30cee313d2SEric Christopher ret i32 %retv 31cee313d2SEric Christopher} 32