]> granicus.if.org Git - llvm/commitdiff
Fix bug where use still existed in dead code
authorChris Lattner <sabre@nondot.org>
Mon, 21 Apr 2003 19:15:26 +0000 (19:15 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 21 Apr 2003 19:15:26 +0000 (19:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5824 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/PromoteMemoryToRegister.cpp

index d828f042d9e0c8ccf539d5f79b0d4c75a88cc728..8406910e6b943e50f4141f5789ea8caf63ad1dc6 100644 (file)
@@ -168,6 +168,8 @@ void PromoteMem2Reg::run() {
     //
     while (!I->use_empty()) {
       Instruction *U = cast<Instruction>(I->use_back());
+      if (!U->use_empty())  // If uses remain in dead code segment...
+        U->replaceAllUsesWith(Constant::getNullValue(U->getType()));
       U->getParent()->getInstList().erase(U);
     }