1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=amdgcn-- < %s | FileCheck %s 2*9880d681SAndroid Build Coastguard Worker 3*9880d681SAndroid Build Coastguard Worker; The branch instruction in LOOP49 has a uniform condition, but PHI instructions 4*9880d681SAndroid Build Coastguard Worker; introduced by the structurizecfg pass previously caused a false divergence 5*9880d681SAndroid Build Coastguard Worker; which ended up in an assertion (or incorrect code) because 6*9880d681SAndroid Build Coastguard Worker; SIAnnotateControlFlow and structurizecfg had different ideas about which 7*9880d681SAndroid Build Coastguard Worker; branches are uniform. 8*9880d681SAndroid Build Coastguard Worker; 9*9880d681SAndroid Build Coastguard Worker; CHECK-LABEL: {{^}}main: 10*9880d681SAndroid Build Coastguard Worker; CHECK: ; %LOOP49 11*9880d681SAndroid Build Coastguard Worker; CHECK: v_cmp_ne_i32_e32 vcc, 12*9880d681SAndroid Build Coastguard Worker; CHECK: s_cbranch_vccnz 13*9880d681SAndroid Build Coastguard Worker; CHECK: ; %ENDIF53 14*9880d681SAndroid Build Coastguard Workerdefine amdgpu_vs float @main(i32 %in) { 15*9880d681SAndroid Build Coastguard Workermain_body: 16*9880d681SAndroid Build Coastguard Worker %cmp = mul i32 %in, 2 17*9880d681SAndroid Build Coastguard Worker br label %LOOP 18*9880d681SAndroid Build Coastguard Worker 19*9880d681SAndroid Build Coastguard WorkerLOOP: ; preds = %ENDLOOP48, %main_body 20*9880d681SAndroid Build Coastguard Worker %counter = phi i32 [ 0, %main_body ], [ %counter.next, %ENDLOOP48 ] 21*9880d681SAndroid Build Coastguard Worker %v.LOOP = phi i32 [ 0, %main_body ], [ %v.ENDLOOP48, %ENDLOOP48 ] 22*9880d681SAndroid Build Coastguard Worker %tmp7 = icmp slt i32 %cmp, %counter 23*9880d681SAndroid Build Coastguard Worker br i1 %tmp7, label %IF, label %LOOP49 24*9880d681SAndroid Build Coastguard Worker 25*9880d681SAndroid Build Coastguard WorkerIF: ; preds = %LOOP 26*9880d681SAndroid Build Coastguard Worker %r = bitcast i32 %v.LOOP to float 27*9880d681SAndroid Build Coastguard Worker ret float %r 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard WorkerLOOP49: ; preds = %LOOP 30*9880d681SAndroid Build Coastguard Worker %tmp8 = icmp ne i32 %counter, 0 31*9880d681SAndroid Build Coastguard Worker br i1 %tmp8, label %ENDLOOP48, label %ENDIF53 32*9880d681SAndroid Build Coastguard Worker 33*9880d681SAndroid Build Coastguard WorkerENDLOOP48: ; preds = %ENDIF53, %LOOP49 34*9880d681SAndroid Build Coastguard Worker %v.ENDLOOP48 = phi i32 [ %v.LOOP, %LOOP49 ], [ %v.ENDIF53, %ENDIF53 ] 35*9880d681SAndroid Build Coastguard Worker %counter.next = add i32 %counter, 1 36*9880d681SAndroid Build Coastguard Worker br label %LOOP 37*9880d681SAndroid Build Coastguard Worker 38*9880d681SAndroid Build Coastguard WorkerENDIF53: ; preds = %LOOP49 39*9880d681SAndroid Build Coastguard Worker %v.ENDIF53 = add i32 %v.LOOP, %counter 40*9880d681SAndroid Build Coastguard Worker br label %ENDLOOP48 41*9880d681SAndroid Build Coastguard Worker} 42