From: Chris Lattner Date: Sun, 9 Jan 2011 19:26:10 +0000 (+0000) Subject: fix a few old bugs (found by inspection) where we would zap instructions X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=f42685004c997a4a4728cbcd9e6be1ee1d6b418f;p=oota-llvm.git fix a few old bugs (found by inspection) where we would zap instructions without informing memdep. This could cause nondeterminstic weirdness based on where instructions happen to get allocated, and will hopefully breath some life into some broken testers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@123124 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 102eab65f2f..0d3c5c7bdc9 100644 --- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -385,7 +385,8 @@ Instruction *MemCpyOpt::tryMergingIntoMemset(Instruction *StartInst, // Check to see if this store is to a constant offset from the start ptr. int64_t Offset; - if (!IsPointerOffset(StartPtr, NextStore->getPointerOperand(), Offset, *TD)) + if (!IsPointerOffset(StartPtr, NextStore->getPointerOperand(), + Offset, *TD)) break; Ranges.addStore(Offset, NextStore); @@ -490,6 +491,7 @@ bool MemCpyOpt::processStore(StoreInst *SI, BasicBlock::iterator &BBI) { if (changed) { MD->removeInstruction(SI); SI->eraseFromParent(); + MD->removeInstruction(LI); LI->eraseFromParent(); ++NumMemCpyInstr; return true; @@ -786,6 +788,7 @@ bool MemCpyOpt::processMemCpy(MemCpyInst *M) { if (CallInst *C = dyn_cast(DepInfo.getInst())) { if (performCallSlotOptzn(M, M->getDest(), M->getSource(), CopySize->getZExtValue(), C)) { + MD->removeInstruction(M); M->eraseFromParent(); return true; }