1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -simplifycfg -S | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; Use a select to make this a single BB. 4*9880d681SAndroid Build Coastguard Worker; Also, make sure the profile metadata is propagated to the select (PR26636). 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workerdefine i32 @FoldTwoEntryPHINode(i1 %C, i32 %V1, i32 %V2, i16 %V3) { 7*9880d681SAndroid Build Coastguard Workerentry: 8*9880d681SAndroid Build Coastguard Worker br i1 %C, label %then, label %else, !prof !0, !unpredictable !1 9*9880d681SAndroid Build Coastguard Workerthen: 10*9880d681SAndroid Build Coastguard Worker %V4 = or i32 %V2, %V1 11*9880d681SAndroid Build Coastguard Worker br label %Cont 12*9880d681SAndroid Build Coastguard Workerelse: 13*9880d681SAndroid Build Coastguard Worker %V5 = sext i16 %V3 to i32 14*9880d681SAndroid Build Coastguard Worker br label %Cont 15*9880d681SAndroid Build Coastguard WorkerCont: 16*9880d681SAndroid Build Coastguard Worker %V6 = phi i32 [ %V5, %else ], [ %V4, %then ] 17*9880d681SAndroid Build Coastguard Worker call i32 @FoldTwoEntryPHINode( i1 false, i32 0, i32 0, i16 0 ) 18*9880d681SAndroid Build Coastguard Worker ret i32 %V1 19*9880d681SAndroid Build Coastguard Worker 20*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: @FoldTwoEntryPHINode( 21*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: entry: 22*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %V5 = sext i16 %V3 to i32 23*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %V4 = or i32 %V2, %V1 24*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %V6 = select i1 %C, i32 %V4, i32 %V5, !prof !0, !unpredictable !1 25*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: %0 = call i32 @FoldTwoEntryPHINode(i1 false, i32 0, i32 0, i16 0) 26*9880d681SAndroid Build Coastguard Worker; CHECK-NEXT: ret i32 %V1 27*9880d681SAndroid Build Coastguard Worker} 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker!0 = !{!"branch_weights", i32 3, i32 5} 30*9880d681SAndroid Build Coastguard Worker!1 = !{} 31*9880d681SAndroid Build Coastguard Worker 32*9880d681SAndroid Build Coastguard Worker; CHECK: !0 = !{!"branch_weights", i32 3, i32 5} 33*9880d681SAndroid Build Coastguard Worker; CHECK: !1 = !{} 34*9880d681SAndroid Build Coastguard Worker 35