From: Chris Lattner Date: Mon, 21 Apr 2003 19:15:26 +0000 (+0000) Subject: Fix bug where use still existed in dead code X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=085c801dee6869e657981750e723fe5cd1482c55;p=llvm Fix bug where use still existed in dead code git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@5824 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp index d828f042d9e..8406910e6b9 100644 --- a/lib/Transforms/Utils/PromoteMemoryToRegister.cpp +++ b/lib/Transforms/Utils/PromoteMemoryToRegister.cpp @@ -168,6 +168,8 @@ void PromoteMem2Reg::run() { // while (!I->use_empty()) { Instruction *U = cast(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); }