Fix bug: 2004-11-08-FreeUseCrash.ll

llvm-svn: 17642
diff --git a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
index d91d23fd..4d5650f 100644
--- a/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
+++ b/llvm/lib/Transforms/IPO/RaiseAllocations.cpp
@@ -201,7 +201,9 @@
             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;
         }