From 917f99354fa558e50d17191f593f81155b4ab2c3 Mon Sep 17 00:00:00 2001 From: Nick Lewycky Date: Sun, 24 Jun 2012 01:44:08 +0000 Subject: Remove a dangling reference to a deleted instruction. Fixes PR13185! git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@159096 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Scalar/Reassociate.cpp | 1 + test/Transforms/Reassociate/crash.ll | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/lib/Transforms/Scalar/Reassociate.cpp b/lib/Transforms/Scalar/Reassociate.cpp index 2b0d406..b572f4e 100644 --- a/lib/Transforms/Scalar/Reassociate.cpp +++ b/lib/Transforms/Scalar/Reassociate.cpp @@ -1478,6 +1478,7 @@ void Reassociate::EraseInst(Instruction *I) { SmallVector Ops(I->op_begin(), I->op_end()); // Erase the dead instruction. ValueRankMap.erase(I); + RedoInsts.remove(I); I->eraseFromParent(); // Optimize its operands. SmallPtrSet Visited; // Detect self-referential nodes. diff --git a/test/Transforms/Reassociate/crash.ll b/test/Transforms/Reassociate/crash.ll index bbe4f23..e2ebcdd 100644 --- a/test/Transforms/Reassociate/crash.ll +++ b/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 +} -- cgit v1.1