From 1f0a97c6cb0835ae08edbfd0958d0c267e72985d Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 9 Nov 2004 05:10:56 +0000 Subject: [PATCH] Fix bug: 2004-11-08-FreeUseCrash.ll llvm-svn: 17642 --- llvm/lib/Transforms/IPO/RaiseAllocations.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp index d91d23fd1887..4d5650f90aae 100644 --- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp +++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp @@ -201,7 +201,9 @@ bool RaiseAllocations::runOnModule(Module &M) { new BranchInst(II->getNormalDest(), I); // Delete the old call site - I->getParent()->getInstList().erase(I); + if (I->getType() != Type::VoidTy) + I->replaceAllUsesWith(UndefValue::get(I->getType())); + I->eraseFromParent(); Changed = true; ++NumRaised; }