[NFC] Switch a few uses of undef to poison as placeholders for unreachble code
This commit is contained in:
parent
972fe43133
commit
0586d1cac2
|
@ -382,7 +382,7 @@ bool IndVarSimplify::handleFloatingPointIV(Loop *L, PHINode *PN) {
|
|||
RecursivelyDeleteTriviallyDeadInstructions(Compare, TLI, MSSAU.get());
|
||||
|
||||
// Delete the old floating point increment.
|
||||
Incr->replaceAllUsesWith(UndefValue::get(Incr->getType()));
|
||||
Incr->replaceAllUsesWith(PoisonValue::get(Incr->getType()));
|
||||
RecursivelyDeleteTriviallyDeadInstructions(Incr, TLI, MSSAU.get());
|
||||
|
||||
// If the FP induction variable still has uses, this is because something else
|
||||
|
|
|
@ -458,13 +458,13 @@ static LoopDeletionResult deleteLoopIfDead(Loop *L, DominatorTree &DT,
|
|||
if (ExitBlock && isLoopNeverExecuted(L)) {
|
||||
LLVM_DEBUG(dbgs() << "Loop is proven to never execute, delete it!");
|
||||
// We need to forget the loop before setting the incoming values of the exit
|
||||
// phis to undef, so we properly invalidate the SCEV expressions for those
|
||||
// phis to poison, so we properly invalidate the SCEV expressions for those
|
||||
// phis.
|
||||
SE.forgetLoop(L);
|
||||
// Set incoming value to undef for phi nodes in the exit block.
|
||||
// Set incoming value to poison for phi nodes in the exit block.
|
||||
for (PHINode &P : ExitBlock->phis()) {
|
||||
std::fill(P.incoming_values().begin(), P.incoming_values().end(),
|
||||
UndefValue::get(P.getType()));
|
||||
PoisonValue::get(P.getType()));
|
||||
}
|
||||
ORE.emit([&]() {
|
||||
return OptimizationRemark(DEBUG_TYPE, "NeverExecutes", L->getStartLoc(),
|
||||
|
|
|
@ -400,7 +400,7 @@ Scatterer ScalarizerVisitor::scatter(Instruction *Point, Value *V,
|
|||
// need to analyse them further.
|
||||
if (!DT->isReachableFromEntry(VOp->getParent()))
|
||||
return Scatterer(Point->getParent(), Point->getIterator(),
|
||||
UndefValue::get(V->getType()), PtrElemTy);
|
||||
PoisonValue::get(V->getType()), PtrElemTy);
|
||||
// Put the scattered form of an instruction directly after the
|
||||
// instruction, skipping over PHI nodes and debug intrinsics.
|
||||
BasicBlock *BB = VOp->getParent();
|
||||
|
|
|
@ -1684,7 +1684,7 @@ deleteDeadBlocksFromLoop(Loop &L,
|
|||
// uses in other blocks.
|
||||
for (auto &I : *BB)
|
||||
if (!I.use_empty())
|
||||
I.replaceAllUsesWith(UndefValue::get(I.getType()));
|
||||
I.replaceAllUsesWith(PoisonValue::get(I.getType()));
|
||||
BB->dropAllReferences();
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ define i64 @test3(i64 %n, i64 %m, i64 %maybe_zero) nounwind {
|
|||
; CHECK: bb.preheader:
|
||||
; CHECK-NEXT: br label [[RETURN_LOOPEXIT:%.*]]
|
||||
; CHECK: return.loopexit:
|
||||
; CHECK-NEXT: [[X_LCSSA_PH:%.*]] = phi i64 [ undef, [[BB_PREHEADER]] ]
|
||||
; CHECK-NEXT: [[X_LCSSA_PH:%.*]] = phi i64 [ poison, [[BB_PREHEADER]] ]
|
||||
; CHECK-NEXT: br label [[RETURN]]
|
||||
; CHECK: return:
|
||||
; CHECK-NEXT: [[X_LCSSA:%.*]] = phi i64 [ 20, [[ENTRY:%.*]] ], [ [[X_LCSSA_PH]], [[RETURN_LOOPEXIT]] ]
|
||||
|
@ -244,7 +244,7 @@ define i64 @test7(i64 %n) {
|
|||
; CHECK: L2.preheader:
|
||||
; CHECK-NEXT: br label [[L1LATCH_LOOPEXIT:%.*]]
|
||||
; CHECK: L1Latch.loopexit:
|
||||
; CHECK-NEXT: [[Y_L2_LCSSA:%.*]] = phi i64 [ undef, [[L2_PREHEADER]] ]
|
||||
; CHECK-NEXT: [[Y_L2_LCSSA:%.*]] = phi i64 [ poison, [[L2_PREHEADER]] ]
|
||||
; CHECK-NEXT: br label [[L1LATCH]]
|
||||
; CHECK: L1Latch:
|
||||
; CHECK-NEXT: [[Y:%.*]] = phi i64 [ [[Y_NEXT]], [[L1]] ], [ [[Y_L2_LCSSA]], [[L1LATCH_LOOPEXIT]] ]
|
||||
|
@ -430,7 +430,7 @@ define i64 @test12(i64 %n){
|
|||
; CHECK: exit1:
|
||||
; CHECK-NEXT: ret i64 42
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: [[Y_PHI:%.*]] = phi i64 [ undef, [[L1_PREHEADER]] ]
|
||||
; CHECK-NEXT: [[Y_PHI:%.*]] = phi i64 [ poison, [[L1_PREHEADER]] ]
|
||||
; CHECK-NEXT: ret i64 [[Y_PHI]]
|
||||
;
|
||||
; REMARKS-LABEL: Function: test12
|
||||
|
@ -470,7 +470,7 @@ define i64 @test13(i64 %n) {
|
|||
; CHECK: exit1:
|
||||
; CHECK-NEXT: ret i64 42
|
||||
; CHECK: exit:
|
||||
; CHECK-NEXT: [[Y_PHI:%.*]] = phi i64 [ undef, [[L1_PREHEADER]] ]
|
||||
; CHECK-NEXT: [[Y_PHI:%.*]] = phi i64 [ poison, [[L1_PREHEADER]] ]
|
||||
; CHECK-NEXT: ret i64 [[Y_PHI]]
|
||||
;
|
||||
; REMARKS-LABEL: Function: test13
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
|
||||
target triple = "x86_64-apple-macosx10.11.0"
|
||||
|
||||
define void @pr27570() {
|
||||
define void @pr27570(i1 %c1) {
|
||||
; IR-AFTER-TRANSFORM-LABEL: @pr27570(
|
||||
entry:
|
||||
br label %for.cond
|
||||
|
@ -52,7 +52,7 @@ for.inc11: ; preds = %for.body6
|
|||
br i1 %tobool, label %for.cond14, label %for.body
|
||||
|
||||
for.cond14: ; preds = %for.cond14, %for.inc11
|
||||
br i1 undef, label %for.cond, label %for.cond14
|
||||
br i1 %c1, label %for.cond, label %for.cond14
|
||||
}
|
||||
|
||||
declare void @sideeffect(i32)
|
||||
|
@ -65,7 +65,7 @@ define void @test2(double* %bx, i64 %by) local_unnamed_addr align 2 {
|
|||
; IR-AFTER-TRANSFORM-NOT: for.body7.1:
|
||||
|
||||
; SCEV-EXPRS-LABEL: test2
|
||||
; SCEV-EXPRS: %inc.lcssa.1 = phi i64 [ undef, %for.body7.preheader.1 ]
|
||||
; SCEV-EXPRS: %inc.lcssa.1 = phi i64 [ poison, %for.body7.preheader.1 ]
|
||||
; SCEV-EXPRS-NEXT: --> undef
|
||||
entry:
|
||||
%cmp = icmp sgt i64 %by, 0
|
||||
|
|
|
@ -11,8 +11,8 @@ define i16 @f1() {
|
|||
; CHECK: for.cond:
|
||||
; CHECK-NEXT: br i1 undef, label [[FOR_BODY:%.*]], label [[FOR_END]]
|
||||
; CHECK: for.end:
|
||||
; CHECK-NEXT: [[EXTRACT:%.*]] = phi i16 [ 1, [[ENTRY:%.*]] ], [ undef, [[FOR_COND]] ]
|
||||
; CHECK-NEXT: ret i16 [[EXTRACT]]
|
||||
; CHECK-NEXT: [[PHI_I0:%.*]] = phi i16 [ 1, [[ENTRY:%.*]] ], [ poison, [[FOR_COND]] ]
|
||||
; CHECK-NEXT: ret i16 [[PHI_I0]]
|
||||
;
|
||||
entry:
|
||||
br label %for.end
|
||||
|
@ -53,8 +53,8 @@ define void @f2() {
|
|||
; CHECK: for.cond1.for.end7_crit_edge:
|
||||
; CHECK-NEXT: br label [[IF_END8]]
|
||||
; CHECK: if.end8:
|
||||
; CHECK-NEXT: [[E_SROA_3_4_I0:%.*]] = phi i64 [ undef, [[FOR_BODY]] ], [ undef, [[FOR_COND1_FOR_END7_CRIT_EDGE]] ], [ undef, [[IF_THEN]] ]
|
||||
; CHECK-NEXT: [[E_SROA_3_4_I1:%.*]] = phi i64 [ undef, [[FOR_BODY]] ], [ undef, [[FOR_COND1_FOR_END7_CRIT_EDGE]] ], [ undef, [[IF_THEN]] ]
|
||||
; CHECK-NEXT: [[E_SROA_3_4_I0:%.*]] = phi i64 [ undef, [[FOR_BODY]] ], [ poison, [[FOR_COND1_FOR_END7_CRIT_EDGE]] ], [ undef, [[IF_THEN]] ]
|
||||
; CHECK-NEXT: [[E_SROA_3_4_I1:%.*]] = phi i64 [ undef, [[FOR_BODY]] ], [ poison, [[FOR_COND1_FOR_END7_CRIT_EDGE]] ], [ undef, [[IF_THEN]] ]
|
||||
; CHECK-NEXT: br label [[FOR_BODY]]
|
||||
;
|
||||
entry:
|
||||
|
|
Loading…
Reference in New Issue