Remove a dangling reference to a deleted instruction. Fixes PR13185!
authorNick Lewycky <nicholas@mxc.ca>
Sun, 24 Jun 2012 01:44:08 +0000 (01:44 +0000)
committerNick Lewycky <nicholas@mxc.ca>
Sun, 24 Jun 2012 01:44:08 +0000 (01:44 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159096 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Scalar/Reassociate.cpp
test/Transforms/Reassociate/crash.ll

index 2b0d406c15dbd5560bfb42d28b72216f8e81ccec..b572f4eb0771c52c4cd30cb0915d7359180fa87b 100644 (file)
@@ -1478,6 +1478,7 @@ void Reassociate::EraseInst(Instruction *I) {
   SmallVector<Value*, 8> Ops(I->op_begin(), I->op_end());
   // Erase the dead instruction.
   ValueRankMap.erase(I);
+  RedoInsts.remove(I);
   I->eraseFromParent();
   // Optimize its operands.
   SmallPtrSet<Instruction *, 8> Visited; // Detect self-referential nodes.
index bbe4f233e82d56a215b1f7c147e43a8af7a52c1f..e2ebcddf6b18d0015df4d433b26a33dce29e4ec7 100644 (file)
@@ -108,3 +108,14 @@ unreachable4:
   %z4 = add i32 %y4, %y4
   ret void
 }
+
+; PR13185
+define void @pr13185(i16 %p) {
+entry:
+  br label %for.cond
+
+for.cond:                                         ; preds = %for.cond, %entry
+  %x.0 = phi i32 [ undef, %entry ], [ %conv, %for.cond ]
+  %conv = zext i16 %p to i32
+  br label %for.cond
+}