llvm.org GIT mirror llvm / 011dcf3
AMDGPU: Fix trying to skip from a block with no successors Found while reducing bug 28550 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@275509 91177308-0d34-0410-b5e6-96231b3b80d8 Matt Arsenault 4 years ago
2 changed file(s) with 41 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
157157
158158 bool SILowerControlFlow::shouldSkip(MachineBasicBlock *From,
159159 MachineBasicBlock *To) {
160 if (From->succ_empty())
161 return false;
160162
161163 unsigned NumInstr = 0;
162164 MachineFunction *MF = From->getParent();
216218 return false;
217219
218220 MachineBasicBlock *SkipBB = insertSkipBlock(MBB, MI.getIterator());
219 SkipBB->addSuccessor(&NextBB);
221 MBB.addSuccessor(SkipBB);
220222
221223 const DebugLoc &DL = MI.getDebugLoc();
222224
492494 ++MBBI;
493495
494496 MF->insert(MBBI, SkipBB);
495 MBB.addSuccessor(SkipBB);
496497
497498 return SkipBB;
498499 }
297297 ret void
298298 }
299299
300 ; CHECK-LABEL: {{^}}no_skip_no_successors:
301 ; CHECK: v_cmp_nle_f32
302 ; CHECK: s_and_b64 vcc, exec,
303 ; CHECK: s_cbranch_vccz [[SKIPKILL:BB[0-9]+_[0-9]+]]
304
305 ; CHECK: ; BB#3: ; %bb6
306 ; CHECK: s_mov_b64 exec, 0
307
308 ; CHECK: [[SKIPKILL]]:
309 ; CHECK: v_cmp_nge_f32
310 ; CHECK: s_and_b64 vcc, exec, vcc
311 ; CHECK: s_cbranch_vccz [[UNREACHABLE:BB[0-9]+_[0-9]+]]
312
313 ; CHECK: [[UNREACHABLE]]:
314 ; CHECK-NEXT: .Lfunc_end{{[0-9]+}}
315 define amdgpu_ps void @no_skip_no_successors(float inreg %arg, float inreg %arg1) #0 {
316 bb:
317 %tmp = fcmp ult float %arg1, 0.000000e+00
318 %tmp2 = fcmp ult float %arg, 0x3FCF5C2900000000
319 br i1 %tmp, label %bb6, label %bb3
320
321 bb3: ; preds = %bb
322 br i1 %tmp2, label %bb5, label %bb4
323
324 bb4: ; preds = %bb3
325 br i1 true, label %bb5, label %bb7
326
327 bb5: ; preds = %bb4, %bb3
328 unreachable
329
330 bb6: ; preds = %bb
331 call void @llvm.AMDGPU.kill(float -1.000000e+00)
332 unreachable
333
334 bb7: ; preds = %bb4
335 ret void
336 }
337
300338 declare void @llvm.AMDGPU.kill(float) #0
301339
302340 attributes #0 = { nounwind }