1*9880d681SAndroid Build Coastguard Worker; RUN: opt < %s -instcombine -simplifycfg -S | grep " = phi " | count 1 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; instcombine should sort the PHI operands so that simplifycfg can see the 4*9880d681SAndroid Build Coastguard Worker; duplicate and remove it. 5*9880d681SAndroid Build Coastguard Worker 6*9880d681SAndroid Build Coastguard Workerdefine i32 @foo(i1 %t) { 7*9880d681SAndroid Build Coastguard Workerentry: 8*9880d681SAndroid Build Coastguard Worker call void @bar() 9*9880d681SAndroid Build Coastguard Worker br i1 %t, label %true, label %false 10*9880d681SAndroid Build Coastguard Workertrue: 11*9880d681SAndroid Build Coastguard Worker call void @bar() 12*9880d681SAndroid Build Coastguard Worker br label %false 13*9880d681SAndroid Build Coastguard Workerfalse: 14*9880d681SAndroid Build Coastguard Worker %a = phi i32 [ 2, %true ], [ 5, %entry ] 15*9880d681SAndroid Build Coastguard Worker %b = phi i32 [ 5, %entry ], [ 2, %true ] 16*9880d681SAndroid Build Coastguard Worker call void @bar() 17*9880d681SAndroid Build Coastguard Worker %c = add i32 %a, %b 18*9880d681SAndroid Build Coastguard Worker ret i32 %c 19*9880d681SAndroid Build Coastguard Worker} 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Workerdeclare void @bar() 22