Skip to content

Commit 455b4fd

Browse files
[AMDGPU] Emit amdgcn.if.break in the same BB as amdgcn.loop (#118081)
Before this change if.break was placed in wrong loop level which resulted in accumulating values only from last iteration of the inner loop.
1 parent b1a48af commit 455b4fd

File tree

3 files changed

+97
-86
lines changed

3 files changed

+97
-86
lines changed

llvm/lib/Target/AMDGPU/SIAnnotateControlFlow.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,13 @@ Value *SIAnnotateControlFlow::handleLoopCondition(
224224
if (Instruction *Inst = dyn_cast<Instruction>(Cond)) {
225225
BasicBlock *Parent = Inst->getParent();
226226
Instruction *Insert;
227-
if (L->contains(Inst)) {
227+
if (LI->getLoopFor(Parent) == L) {
228+
// Insert IfBreak in the same BB as Cond, which can help
229+
// SILowerControlFlow to know that it does not have to insert an
230+
// AND with EXEC.
228231
Insert = Parent->getTerminator();
232+
} else if (L->contains(Inst)) {
233+
Insert = Term;
229234
} else {
230235
Insert = L->getHeader()->getFirstNonPHIOrDbgOrLifetime();
231236
}

llvm/test/CodeGen/AMDGPU/multilevel-break.ll

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ define amdgpu_vs void @multi_else_break(<4 x float> %vec, i32 %ub, i32 %cont) {
2727
; OPT-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP2]])
2828
; OPT-NEXT: [[TMP6]] = call i64 @llvm.amdgcn.if.break.i64(i1 [[TMP5]], i64 [[PHI_BROKEN]])
2929
; OPT-NEXT: [[TMP7:%.*]] = call i1 @llvm.amdgcn.loop.i64(i64 [[TMP6]])
30-
; OPT-NEXT: [[TMP8]] = call i64 @llvm.amdgcn.if.break.i64(i1 [[TMP4]], i64 [[PHI_BROKEN2]])
3130
; OPT-NEXT: br i1 [[TMP7]], label [[FLOW1]], label [[LOOP]]
3231
; OPT: Flow1:
3332
; OPT-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP6]])
33+
; OPT-NEXT: [[TMP8]] = call i64 @llvm.amdgcn.if.break.i64(i1 [[TMP4]], i64 [[PHI_BROKEN2]])
3434
; OPT-NEXT: [[TMP9:%.*]] = call i1 @llvm.amdgcn.loop.i64(i64 [[TMP8]])
3535
; OPT-NEXT: br i1 [[TMP9]], label [[IF:%.*]], label [[LOOP_OUTER]]
3636
; OPT: IF:
@@ -57,33 +57,37 @@ define amdgpu_vs void @multi_else_break(<4 x float> %vec, i32 %ub, i32 %cont) {
5757
; GCN-NEXT: .LBB0_2: ; %LOOP.outer
5858
; GCN-NEXT: ; =>This Loop Header: Depth=1
5959
; GCN-NEXT: ; Child Loop BB0_4 Depth 2
60-
; GCN-NEXT: ; implicit-def: $sgpr6_sgpr7
6160
; GCN-NEXT: ; implicit-def: $sgpr2_sgpr3
61+
; GCN-NEXT: ; implicit-def: $sgpr8_sgpr9
62+
; GCN-NEXT: ; implicit-def: $sgpr6_sgpr7
6263
; GCN-NEXT: s_mov_b64 s[4:5], 0
6364
; GCN-NEXT: s_branch .LBB0_4
6465
; GCN-NEXT: .LBB0_3: ; %Flow
6566
; GCN-NEXT: ; in Loop: Header=BB0_4 Depth=2
66-
; GCN-NEXT: s_or_b64 exec, exec, s[8:9]
67-
; GCN-NEXT: s_and_b64 s[8:9], exec, s[6:7]
68-
; GCN-NEXT: s_or_b64 s[4:5], s[8:9], s[4:5]
67+
; GCN-NEXT: s_or_b64 exec, exec, s[10:11]
68+
; GCN-NEXT: s_and_b64 s[10:11], exec, s[8:9]
69+
; GCN-NEXT: s_or_b64 s[4:5], s[10:11], s[4:5]
70+
; GCN-NEXT: s_andn2_b64 s[2:3], s[2:3], exec
71+
; GCN-NEXT: s_and_b64 s[10:11], s[6:7], exec
72+
; GCN-NEXT: s_or_b64 s[2:3], s[2:3], s[10:11]
6973
; GCN-NEXT: s_andn2_b64 exec, exec, s[4:5]
7074
; GCN-NEXT: s_cbranch_execz .LBB0_1
7175
; GCN-NEXT: .LBB0_4: ; %LOOP
7276
; GCN-NEXT: ; Parent Loop BB0_2 Depth=1
7377
; GCN-NEXT: ; => This Inner Loop Header: Depth=2
7478
; GCN-NEXT: v_cmp_lt_i32_e32 vcc, v0, v4
75-
; GCN-NEXT: s_or_b64 s[2:3], s[2:3], exec
7679
; GCN-NEXT: s_or_b64 s[6:7], s[6:7], exec
77-
; GCN-NEXT: s_and_saveexec_b64 s[8:9], vcc
80+
; GCN-NEXT: s_or_b64 s[8:9], s[8:9], exec
81+
; GCN-NEXT: s_and_saveexec_b64 s[10:11], vcc
7882
; GCN-NEXT: s_cbranch_execz .LBB0_3
7983
; GCN-NEXT: ; %bb.5: ; %ENDIF
8084
; GCN-NEXT: ; in Loop: Header=BB0_4 Depth=2
8185
; GCN-NEXT: v_add_i32_e32 v0, vcc, 1, v0
82-
; GCN-NEXT: s_andn2_b64 s[2:3], s[2:3], exec
83-
; GCN-NEXT: v_cmp_ne_u32_e32 vcc, v5, v0
8486
; GCN-NEXT: s_andn2_b64 s[6:7], s[6:7], exec
85-
; GCN-NEXT: s_and_b64 s[10:11], vcc, exec
86-
; GCN-NEXT: s_or_b64 s[6:7], s[6:7], s[10:11]
87+
; GCN-NEXT: v_cmp_ne_u32_e32 vcc, v5, v0
88+
; GCN-NEXT: s_andn2_b64 s[8:9], s[8:9], exec
89+
; GCN-NEXT: s_and_b64 s[12:13], vcc, exec
90+
; GCN-NEXT: s_or_b64 s[8:9], s[8:9], s[12:13]
8791
; GCN-NEXT: s_branch .LBB0_3
8892
; GCN-NEXT: .LBB0_6: ; %IF
8993
; GCN-NEXT: s_endpgm

llvm/test/CodeGen/AMDGPU/nested-loop-conditions.ll

Lines changed: 76 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
1+
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py UTC_ARGS: --version 5
22
; RUN: opt -mtriple=amdgcn-- -S -structurizecfg -si-annotate-control-flow %s | FileCheck -check-prefix=IR %s
33
; RUN: llc -mtriple=amdgcn -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
44

@@ -46,51 +46,52 @@ define amdgpu_kernel void @reduced_nested_loop_conditions(ptr addrspace(3) nocap
4646
; GCN-NEXT: s_cbranch_vccz .LBB0_6
4747
; GCN-NEXT: .LBB0_7: ; %DummyReturnBlock
4848
; GCN-NEXT: s_endpgm
49-
; IR-LABEL: @reduced_nested_loop_conditions(
50-
; IR-NEXT: bb:
49+
; IR-LABEL: define amdgpu_kernel void @reduced_nested_loop_conditions(
50+
; IR-SAME: ptr addrspace(3) nocapture [[ARG:%.*]]) #[[ATTR0:[0-9]+]] {
51+
; IR-NEXT: [[BB:.*]]:
5152
; IR-NEXT: [[MY_TMP:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x() #[[ATTR4:[0-9]+]]
52-
; IR-NEXT: [[MY_TMP1:%.*]] = getelementptr inbounds i64, ptr addrspace(3) [[ARG:%.*]], i32 [[MY_TMP]]
53+
; IR-NEXT: [[MY_TMP1:%.*]] = getelementptr inbounds i64, ptr addrspace(3) [[ARG]], i32 [[MY_TMP]]
5354
; IR-NEXT: [[MY_TMP2:%.*]] = load volatile i64, ptr addrspace(3) [[MY_TMP1]], align 8
54-
; IR-NEXT: br label [[BB5:%.*]]
55-
; IR: bb3:
56-
; IR-NEXT: br i1 true, label [[BB4:%.*]], label [[BB13:%.*]]
57-
; IR: bb4:
58-
; IR-NEXT: br label [[FLOW:%.*]]
59-
; IR: bb5:
60-
; IR-NEXT: [[PHI_BROKEN:%.*]] = phi i64 [ [[TMP6:%.*]], [[BB10:%.*]] ], [ 0, [[BB:%.*]] ]
61-
; IR-NEXT: [[MY_TMP6:%.*]] = phi i32 [ 0, [[BB]] ], [ [[TMP5:%.*]], [[BB10]] ]
55+
; IR-NEXT: br label %[[BB5:.*]]
56+
; IR: [[BB3:.*]]:
57+
; IR-NEXT: br i1 true, label %[[BB4:.*]], label %[[BB13:.*]]
58+
; IR: [[BB4]]:
59+
; IR-NEXT: br label %[[FLOW:.*]]
60+
; IR: [[BB5]]:
61+
; IR-NEXT: [[PHI_BROKEN:%.*]] = phi i64 [ [[TMP6:%.*]], %[[BB10:.*]] ], [ 0, %[[BB]] ]
62+
; IR-NEXT: [[MY_TMP6:%.*]] = phi i32 [ 0, %[[BB]] ], [ [[TMP5:%.*]], %[[BB10]] ]
6263
; IR-NEXT: [[MY_TMP7:%.*]] = icmp eq i32 [[MY_TMP6]], 1
6364
; IR-NEXT: [[TMP0:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[MY_TMP7]])
6465
; IR-NEXT: [[TMP1:%.*]] = extractvalue { i1, i64 } [[TMP0]], 0
6566
; IR-NEXT: [[TMP2:%.*]] = extractvalue { i1, i64 } [[TMP0]], 1
66-
; IR-NEXT: br i1 [[TMP1]], label [[BB8:%.*]], label [[FLOW]]
67-
; IR: bb8:
68-
; IR-NEXT: br label [[BB13]]
69-
; IR: bb9:
70-
; IR-NEXT: br i1 false, label [[BB3:%.*]], label [[BB9:%.*]]
71-
; IR: bb10:
67+
; IR-NEXT: br i1 [[TMP1]], label %[[BB8:.*]], label %[[FLOW]]
68+
; IR: [[BB8]]:
69+
; IR-NEXT: br label %[[BB13]]
70+
; IR: [[BB9:.*]]:
71+
; IR-NEXT: br i1 false, label %[[BB3]], label %[[BB9]]
72+
; IR: [[BB10]]:
7273
; IR-NEXT: [[TMP3:%.*]] = call i1 @llvm.amdgcn.loop.i64(i64 [[TMP6]])
73-
; IR-NEXT: br i1 [[TMP3]], label [[BB23:%.*]], label [[BB5]]
74-
; IR: Flow:
75-
; IR-NEXT: [[TMP4:%.*]] = phi i1 [ [[MY_TMP22:%.*]], [[BB4]] ], [ true, [[BB5]] ]
76-
; IR-NEXT: [[TMP5]] = phi i32 [ [[MY_TMP21:%.*]], [[BB4]] ], [ undef, [[BB5]] ]
74+
; IR-NEXT: br i1 [[TMP3]], label %[[BB23:.*]], label %[[BB5]]
75+
; IR: [[FLOW]]:
76+
; IR-NEXT: [[TMP4:%.*]] = phi i1 [ [[MY_TMP22:%.*]], %[[BB4]] ], [ true, %[[BB5]] ]
77+
; IR-NEXT: [[TMP5]] = phi i32 [ [[MY_TMP21:%.*]], %[[BB4]] ], [ undef, %[[BB5]] ]
7778
; IR-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP2]])
7879
; IR-NEXT: [[TMP6]] = call i64 @llvm.amdgcn.if.break.i64(i1 [[TMP4]], i64 [[PHI_BROKEN]])
79-
; IR-NEXT: br label [[BB10]]
80-
; IR: bb13:
81-
; IR-NEXT: [[MY_TMP14:%.*]] = phi i1 [ [[MY_TMP22]], [[BB3]] ], [ true, [[BB8]] ]
80+
; IR-NEXT: br label %[[BB10]]
81+
; IR: [[BB13]]:
82+
; IR-NEXT: [[MY_TMP14:%.*]] = phi i1 [ [[MY_TMP22]], %[[BB3]] ], [ true, %[[BB8]] ]
8283
; IR-NEXT: [[MY_TMP15:%.*]] = bitcast i64 [[MY_TMP2]] to <2 x i32>
83-
; IR-NEXT: br i1 [[MY_TMP14]], label [[BB16:%.*]], label [[BB20:%.*]]
84-
; IR: bb16:
84+
; IR-NEXT: br i1 [[MY_TMP14]], label %[[BB16:.*]], label %[[BB20:.*]]
85+
; IR: [[BB16]]:
8586
; IR-NEXT: [[MY_TMP17:%.*]] = extractelement <2 x i32> [[MY_TMP15]], i64 1
8687
; IR-NEXT: [[MY_TMP18:%.*]] = getelementptr inbounds i32, ptr addrspace(3) undef, i32 [[MY_TMP17]]
8788
; IR-NEXT: [[MY_TMP19:%.*]] = load volatile i32, ptr addrspace(3) [[MY_TMP18]], align 4
88-
; IR-NEXT: br label [[BB20]]
89-
; IR: bb20:
90-
; IR-NEXT: [[MY_TMP21]] = phi i32 [ [[MY_TMP19]], [[BB16]] ], [ 0, [[BB13]] ]
91-
; IR-NEXT: [[MY_TMP22]] = phi i1 [ false, [[BB16]] ], [ [[MY_TMP14]], [[BB13]] ]
92-
; IR-NEXT: br label [[BB9]]
93-
; IR: bb23:
89+
; IR-NEXT: br label %[[BB20]]
90+
; IR: [[BB20]]:
91+
; IR-NEXT: [[MY_TMP21]] = phi i32 [ [[MY_TMP19]], %[[BB16]] ], [ 0, %[[BB13]] ]
92+
; IR-NEXT: [[MY_TMP22]] = phi i1 [ false, %[[BB16]] ], [ [[MY_TMP14]], %[[BB13]] ]
93+
; IR-NEXT: br label %[[BB9]]
94+
; IR: [[BB23]]:
9495
; IR-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP6]])
9596
; IR-NEXT: ret void
9697
bb:
@@ -188,66 +189,67 @@ define amdgpu_kernel void @nested_loop_conditions(ptr addrspace(1) nocapture %ar
188189
; GCN-NEXT: buffer_store_dword v0, off, s[0:3], 0
189190
; GCN-NEXT: s_waitcnt vmcnt(0)
190191
; GCN-NEXT: s_endpgm
191-
; IR-LABEL: @nested_loop_conditions(
192-
; IR-NEXT: bb:
192+
; IR-LABEL: define amdgpu_kernel void @nested_loop_conditions(
193+
; IR-SAME: ptr addrspace(1) nocapture [[ARG:%.*]]) #[[ATTR0]] {
194+
; IR-NEXT: [[BB:.*]]:
193195
; IR-NEXT: [[MY_TMP1134:%.*]] = load volatile i32, ptr addrspace(1) undef, align 4
194196
; IR-NEXT: [[MY_TMP1235:%.*]] = icmp slt i32 [[MY_TMP1134]], 9
195-
; IR-NEXT: br i1 [[MY_TMP1235]], label [[BB14_LR_PH:%.*]], label [[FLOW:%.*]]
196-
; IR: bb14.lr.ph:
197+
; IR-NEXT: br i1 [[MY_TMP1235]], label %[[BB14_LR_PH:.*]], label %[[FLOW:.*]]
198+
; IR: [[BB14_LR_PH]]:
197199
; IR-NEXT: [[MY_TMP:%.*]] = tail call i32 @llvm.amdgcn.workitem.id.x() #[[ATTR4]]
198200
; IR-NEXT: [[MY_TMP1:%.*]] = zext i32 [[MY_TMP]] to i64
199-
; IR-NEXT: [[MY_TMP2:%.*]] = getelementptr inbounds i64, ptr addrspace(1) [[ARG:%.*]], i64 [[MY_TMP1]]
201+
; IR-NEXT: [[MY_TMP2:%.*]] = getelementptr inbounds i64, ptr addrspace(1) [[ARG]], i64 [[MY_TMP1]]
200202
; IR-NEXT: [[MY_TMP3:%.*]] = load i64, ptr addrspace(1) [[MY_TMP2]], align 16
201203
; IR-NEXT: [[MY_TMP932:%.*]] = load <4 x i32>, ptr addrspace(1) undef, align 16
202204
; IR-NEXT: [[MY_TMP1033:%.*]] = extractelement <4 x i32> [[MY_TMP932]], i64 0
203-
; IR-NEXT: br label [[BB14:%.*]]
204-
; IR: Flow3:
205+
; IR-NEXT: br label %[[BB14:.*]]
206+
; IR: [[FLOW3:.*]]:
205207
; IR-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP20:%.*]])
206208
; IR-NEXT: [[TMP0:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[TMP14:%.*]])
207209
; IR-NEXT: [[TMP1:%.*]] = extractvalue { i1, i64 } [[TMP0]], 0
208210
; IR-NEXT: [[TMP2:%.*]] = extractvalue { i1, i64 } [[TMP0]], 1
209-
; IR-NEXT: br i1 [[TMP1]], label [[BB4_BB13_CRIT_EDGE:%.*]], label [[FLOW4:%.*]]
210-
; IR: bb4.bb13_crit_edge:
211-
; IR-NEXT: br label [[FLOW4]]
212-
; IR: Flow4:
213-
; IR-NEXT: [[TMP3:%.*]] = phi i1 [ true, [[BB4_BB13_CRIT_EDGE]] ], [ false, [[FLOW3:%.*]] ]
211+
; IR-NEXT: br i1 [[TMP1]], label %[[BB4_BB13_CRIT_EDGE:.*]], label %[[FLOW4:.*]]
212+
; IR: [[BB4_BB13_CRIT_EDGE]]:
213+
; IR-NEXT: br label %[[FLOW4]]
214+
; IR: [[FLOW4]]:
215+
; IR-NEXT: [[TMP3:%.*]] = phi i1 [ true, %[[BB4_BB13_CRIT_EDGE]] ], [ false, %[[FLOW3]] ]
214216
; IR-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP2]])
215-
; IR-NEXT: br label [[FLOW]]
216-
; IR: bb13:
217-
; IR-NEXT: br label [[BB31:%.*]]
218-
; IR: Flow:
219-
; IR-NEXT: [[TMP4:%.*]] = phi i1 [ [[TMP3]], [[FLOW4]] ], [ true, [[BB:%.*]] ]
217+
; IR-NEXT: br label %[[FLOW]]
218+
; IR: [[BB13:.*]]:
219+
; IR-NEXT: br label %[[BB31:.*]]
220+
; IR: [[FLOW]]:
221+
; IR-NEXT: [[TMP4:%.*]] = phi i1 [ [[TMP3]], %[[FLOW4]] ], [ true, %[[BB]] ]
220222
; IR-NEXT: [[TMP5:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[TMP4]])
221223
; IR-NEXT: [[TMP6:%.*]] = extractvalue { i1, i64 } [[TMP5]], 0
222224
; IR-NEXT: [[TMP7:%.*]] = extractvalue { i1, i64 } [[TMP5]], 1
223-
; IR-NEXT: br i1 [[TMP6]], label [[BB13:%.*]], label [[BB31]]
224-
; IR: bb14:
225-
; IR-NEXT: [[PHI_BROKEN:%.*]] = phi i64 [ [[TMP16:%.*]], [[FLOW1:%.*]] ], [ 0, [[BB14_LR_PH]] ]
226-
; IR-NEXT: [[MY_TMP1037:%.*]] = phi i32 [ [[MY_TMP1033]], [[BB14_LR_PH]] ], [ [[TMP12:%.*]], [[FLOW1]] ]
227-
; IR-NEXT: [[MY_TMP936:%.*]] = phi <4 x i32> [ [[MY_TMP932]], [[BB14_LR_PH]] ], [ [[TMP11:%.*]], [[FLOW1]] ]
225+
; IR-NEXT: br i1 [[TMP6]], label %[[BB13]], label %[[BB31]]
226+
; IR: [[BB14]]:
227+
; IR-NEXT: [[PHI_BROKEN:%.*]] = phi i64 [ [[TMP16:%.*]], %[[FLOW1:.*]] ], [ 0, %[[BB14_LR_PH]] ]
228+
; IR-NEXT: [[MY_TMP1037:%.*]] = phi i32 [ [[MY_TMP1033]], %[[BB14_LR_PH]] ], [ [[TMP12:%.*]], %[[FLOW1]] ]
229+
; IR-NEXT: [[MY_TMP936:%.*]] = phi <4 x i32> [ [[MY_TMP932]], %[[BB14_LR_PH]] ], [ [[TMP11:%.*]], %[[FLOW1]] ]
228230
; IR-NEXT: [[MY_TMP15:%.*]] = icmp eq i32 [[MY_TMP1037]], 1
229231
; IR-NEXT: [[TMP8:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[MY_TMP15]])
230232
; IR-NEXT: [[TMP9:%.*]] = extractvalue { i1, i64 } [[TMP8]], 0
231233
; IR-NEXT: [[TMP10:%.*]] = extractvalue { i1, i64 } [[TMP8]], 1
232-
; IR-NEXT: br i1 [[TMP9]], label [[BB16:%.*]], label [[FLOW1]]
233-
; IR: bb16:
234+
; IR-NEXT: br i1 [[TMP9]], label %[[BB16:.*]], label %[[FLOW1]]
235+
; IR: [[BB16]]:
234236
; IR-NEXT: [[MY_TMP17:%.*]] = bitcast i64 [[MY_TMP3]] to <2 x i32>
235-
; IR-NEXT: br label [[BB18:%.*]]
236-
; IR: Flow1:
237-
; IR-NEXT: [[TMP11]] = phi <4 x i32> [ [[MY_TMP9:%.*]], [[BB21:%.*]] ], [ undef, [[BB14]] ]
238-
; IR-NEXT: [[TMP12]] = phi i32 [ [[MY_TMP10:%.*]], [[BB21]] ], [ undef, [[BB14]] ]
239-
; IR-NEXT: [[TMP13:%.*]] = phi i1 [ [[MY_TMP12:%.*]], [[BB21]] ], [ true, [[BB14]] ]
240-
; IR-NEXT: [[TMP14]] = phi i1 [ [[MY_TMP12]], [[BB21]] ], [ false, [[BB14]] ]
241-
; IR-NEXT: [[TMP15:%.*]] = phi i1 [ false, [[BB21]] ], [ true, [[BB14]] ]
237+
; IR-NEXT: br label %[[BB18:.*]]
238+
; IR: [[FLOW1]]:
239+
; IR-NEXT: [[TMP11]] = phi <4 x i32> [ [[MY_TMP9:%.*]], %[[BB21:.*]] ], [ undef, %[[BB14]] ]
240+
; IR-NEXT: [[TMP12]] = phi i32 [ [[MY_TMP10:%.*]], %[[BB21]] ], [ undef, %[[BB14]] ]
241+
; IR-NEXT: [[TMP13:%.*]] = phi i1 [ [[MY_TMP12:%.*]], %[[BB21]] ], [ true, %[[BB14]] ]
242+
; IR-NEXT: [[TMP14]] = phi i1 [ [[MY_TMP12]], %[[BB21]] ], [ false, %[[BB14]] ]
243+
; IR-NEXT: [[TMP15:%.*]] = phi i1 [ false, %[[BB21]] ], [ true, %[[BB14]] ]
242244
; IR-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP10]])
243245
; IR-NEXT: [[TMP16]] = call i64 @llvm.amdgcn.if.break.i64(i1 [[TMP13]], i64 [[PHI_BROKEN]])
244246
; IR-NEXT: [[TMP17:%.*]] = call i1 @llvm.amdgcn.loop.i64(i64 [[TMP16]])
245-
; IR-NEXT: br i1 [[TMP17]], label [[FLOW2:%.*]], label [[BB14]]
246-
; IR: bb18:
247+
; IR-NEXT: br i1 [[TMP17]], label %[[FLOW2:.*]], label %[[BB14]]
248+
; IR: [[BB18]]:
247249
; IR-NEXT: [[MY_TMP19:%.*]] = load volatile i32, ptr addrspace(1) undef, align 4
248250
; IR-NEXT: [[MY_TMP20:%.*]] = icmp slt i32 [[MY_TMP19]], 9
249-
; IR-NEXT: br i1 [[MY_TMP20]], label [[BB21]], label [[BB18]]
250-
; IR: bb21:
251+
; IR-NEXT: br i1 [[MY_TMP20]], label %[[BB21]], label %[[BB18]]
252+
; IR: [[BB21]]:
251253
; IR-NEXT: [[MY_TMP22:%.*]] = extractelement <2 x i32> [[MY_TMP17]], i64 1
252254
; IR-NEXT: [[MY_TMP23:%.*]] = lshr i32 [[MY_TMP22]], 16
253255
; IR-NEXT: [[MY_TMP24:%.*]] = select i1 undef, i32 undef, i32 [[MY_TMP23]]
@@ -263,16 +265,16 @@ define amdgpu_kernel void @nested_loop_conditions(ptr addrspace(1) nocapture %ar
263265
; IR-NEXT: [[MY_TMP10]] = extractelement <4 x i32> [[MY_TMP9]], i64 0
264266
; IR-NEXT: [[MY_TMP11:%.*]] = load volatile i32, ptr addrspace(1) undef, align 4
265267
; IR-NEXT: [[MY_TMP12]] = icmp sge i32 [[MY_TMP11]], 9
266-
; IR-NEXT: br label [[FLOW1]]
267-
; IR: Flow2:
268+
; IR-NEXT: br label %[[FLOW1]]
269+
; IR: [[FLOW2]]:
268270
; IR-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP16]])
269271
; IR-NEXT: [[TMP18:%.*]] = call { i1, i64 } @llvm.amdgcn.if.i64(i1 [[TMP15]])
270272
; IR-NEXT: [[TMP19:%.*]] = extractvalue { i1, i64 } [[TMP18]], 0
271273
; IR-NEXT: [[TMP20]] = extractvalue { i1, i64 } [[TMP18]], 1
272-
; IR-NEXT: br i1 [[TMP19]], label [[BB31_LOOPEXIT:%.*]], label [[FLOW3]]
273-
; IR: bb31.loopexit:
274-
; IR-NEXT: br label [[FLOW3]]
275-
; IR: bb31:
274+
; IR-NEXT: br i1 [[TMP19]], label %[[BB31_LOOPEXIT:.*]], label %[[FLOW3]]
275+
; IR: [[BB31_LOOPEXIT]]:
276+
; IR-NEXT: br label %[[FLOW3]]
277+
; IR: [[BB31]]:
276278
; IR-NEXT: call void @llvm.amdgcn.end.cf.i64(i64 [[TMP7]])
277279
; IR-NEXT: store volatile i32 0, ptr addrspace(1) undef, align 4
278280
; IR-NEXT: ret void

0 commit comments

Comments
 (0)