summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-01-09 19:26:10 +0000
committerChris Lattner <sabre@nondot.org>2011-01-09 19:26:10 +0000
commitcaf5c0d037268bf6029ffc45248a2a7a55408844 (patch)
treedc65fa48fb04187234fc6f446acfdbb045b17c89 /llvm/lib
parentd65524da0f9e120f9f4f2daea1298685ed90a64f (diff)
downloadbcm5719-llvm-caf5c0d037268bf6029ffc45248a2a7a55408844.tar.gz
bcm5719-llvm-caf5c0d037268bf6029ffc45248a2a7a55408844.zip
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. llvm-svn: 123124
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
index 102eab65f2f..0d3c5c7bdc9 100644
--- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp
+++ b/llvm/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<CallInst>(DepInfo.getInst())) {
if (performCallSlotOptzn(M, M->getDest(), M->getSource(),
CopySize->getZExtValue(), C)) {
+ MD->removeInstruction(M);
M->eraseFromParent();
return true;
}
OpenPOWER on IntegriCloud