1cee313d2SEric Christopher; RUN: llvm-profdata merge %S/Inputs/select2.proftext -o %t.profdata 2cee313d2SEric Christopher; RUN: opt < %s -passes=pgo-instr-use -pgo-test-profile-file=%t.profdata -pgo-instr-select=true -S | FileCheck %s --check-prefix=USE 3cee313d2SEric Christopher 47b1d7937SAmy Huangtarget datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 5cee313d2SEric Christophertarget triple = "x86_64-unknown-linux-gnu" 6cee313d2SEric Christopher 7cee313d2SEric Christopherdefine i32 @foo(i32 %n) { 8cee313d2SEric Christopher;USE: define i32 @foo(i32 %n) !prof ![[ENTRY_COUNT:[0-9]+]] { 9cee313d2SEric Christopherentry: 10cee313d2SEric Christopher br label %for.cond 11cee313d2SEric Christopher 12cee313d2SEric Christopherfor.cond: 13cee313d2SEric Christopher %i.0 = phi i32 [ 0, %entry ], [ %inc, %for.inc ] 14cee313d2SEric Christopher %sum.0 = phi i32 [ 0, %entry ], [ %add, %for.inc ] 15cee313d2SEric Christopher %cmp = icmp slt i32 %i.0, %n 16cee313d2SEric Christopher br i1 %cmp, label %for.body, label %for.end 17cee313d2SEric Christopher;USE: br i1 %cmp, label %for.body, label %for.end, !prof ![[BW_FOR_BR:[0-9]+]] 18cee313d2SEric Christopher 19cee313d2SEric Christopherfor.body: 20cee313d2SEric Christopher %cmp1 = icmp sgt i32 %sum.0, 10 21cee313d2SEric Christopher %cond = select i1 %cmp1, i32 20, i32 -10 22cee313d2SEric Christopher;USE: %cond = select i1 %cmp1, i32 20, i32 -10, !prof ![[BW_FOR_SELECT:[0-9]+]] 23cee313d2SEric Christopher %add = add nsw i32 %sum.0, %cond 24cee313d2SEric Christopher br label %for.inc 25cee313d2SEric Christopher 26cee313d2SEric Christopherfor.inc: 27cee313d2SEric Christopher %inc = add nsw i32 %i.0, 1 28cee313d2SEric Christopher br label %for.cond 29cee313d2SEric Christopher 30cee313d2SEric Christopherfor.end: 31cee313d2SEric Christopher ret i32 %sum.0 32cee313d2SEric Christopher} 33cee313d2SEric Christopher 34cee313d2SEric Christopher;USE: ![[ENTRY_COUNT]] = !{!"function_entry_count", i64 3} 35*5c31b8b9SArthur Eubanks;USE: ![[BW_FOR_BR]] = !{!"branch_weights", i32 800, i32 3} 36*5c31b8b9SArthur Eubanks;USE: ![[BW_FOR_SELECT]] = !{!"branch_weights", i32 300, i32 500} 37