1 ; RUN: llc -march=amdgcn -verify-machineinstrs < %s | FileCheck %s
3 ; The branch instruction in LOOP49 has a uniform condition, but PHI instructions
4 ; introduced by the structurizecfg pass previously caused a false divergence
5 ; which ended up in an assertion (or incorrect code) because
6 ; SIAnnotateControlFlow and structurizecfg had different ideas about which
7 ; branches are uniform.
9 ; CHECK-LABEL: {{^}}main:
11 ; CHECK: s_cmp_lg_u32 s{{[0-9]+}}, 0
12 ; CHECK: s_cbranch_scc1
14 define amdgpu_vs float @main(i32 %in) {
19 LOOP: ; preds = %ENDLOOP48, %main_body
20 %counter = phi i32 [ 0, %main_body ], [ %counter.next, %ENDLOOP48 ]
21 %v.LOOP = phi i32 [ 0, %main_body ], [ %v.ENDLOOP48, %ENDLOOP48 ]
22 %tmp7 = icmp slt i32 %cmp, %counter
23 br i1 %tmp7, label %IF, label %LOOP49
26 %r = bitcast i32 %v.LOOP to float
29 LOOP49: ; preds = %LOOP
30 %tmp8 = icmp ne i32 %counter, 0
31 br i1 %tmp8, label %ENDLOOP48, label %ENDIF53
33 ENDLOOP48: ; preds = %ENDIF53, %LOOP49
34 %v.ENDLOOP48 = phi i32 [ %v.LOOP, %LOOP49 ], [ %v.ENDIF53, %ENDIF53 ]
35 %counter.next = add i32 %counter, 1
38 ENDIF53: ; preds = %LOOP49
39 %v.ENDIF53 = add i32 %v.LOOP, %counter