summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2012-06-24 01:44:08 +0000
committerNick Lewycky <nicholas@mxc.ca>2012-06-24 01:44:08 +0000
commitbfb07fb562a80637dc3ba3bb4ca2f44ab21e6612 (patch)
tree20c3504dceafc09b5b051c393e4b35c95e3e1c45
parent21e22dbeb7d185907a99e0d3a8ea6429e52b8b9d (diff)
downloadbcm5719-llvm-bfb07fb562a80637dc3ba3bb4ca2f44ab21e6612.tar.gz
bcm5719-llvm-bfb07fb562a80637dc3ba3bb4ca2f44ab21e6612.zip
Remove a dangling reference to a deleted instruction. Fixes PR13185!
llvm-svn: 159096
-rw-r--r--llvm/lib/Transforms/Scalar/Reassociate.cpp1
-rw-r--r--llvm/test/Transforms/Reassociate/crash.ll11
2 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Scalar/Reassociate.cpp b/llvm/lib/Transforms/Scalar/Reassociate.cpp
index 2b0d406c15d..b572f4eb077 100644
--- a/llvm/lib/Transforms/Scalar/Reassociate.cpp
+++ b/llvm/lib/Transforms/Scalar/Reassociate.cpp
@@ -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.
diff --git a/llvm/test/Transforms/Reassociate/crash.ll b/llvm/test/Transforms/Reassociate/crash.ll
index bbe4f233e82..e2ebcddf6b1 100644
--- a/llvm/test/Transforms/Reassociate/crash.ll
+++ b/llvm/test/Transforms/Reassociate/crash.ll
@@ -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
+}
OpenPOWER on IntegriCloud