diff options
author | Owen Anderson <resistor@mac.com> | 2008-04-29 21:51:00 +0000 |
---|---|---|
committer | Owen Anderson <resistor@mac.com> | 2008-04-29 21:51:00 +0000 |
commit | ad5367f8ed3b0ec3eedf240fc6c8f7523a4fb046 (patch) | |
tree | bdea82cc80528a17800c64efa61bf5fd67e50ef5 /llvm/lib/Transforms | |
parent | ff7d7b18e5fc65014a3bbd864e84b9117b97a9f7 (diff) | |
download | bcm5719-llvm-ad5367f8ed3b0ec3eedf240fc6c8f7523a4fb046.tar.gz bcm5719-llvm-ad5367f8ed3b0ec3eedf240fc6c8f7523a4fb046.zip |
Revert r50441. The original code was correct. Add some more comments so that I don't make the same mistake in the future.
llvm-svn: 50446
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 9a39c8fd29e..d6e5f3964bb 100644 --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -668,18 +668,24 @@ bool MemCpyOpt::processMemCpy(MemCpyInst* M) { CallInst* C = CallInst::Create(MemCpyFun, args.begin(), args.end(), "", M); + + // If C and M don't interfere, then this is a valid transformation. If they + // did, this would mean that the two sources overlap, which would be bad. if (MD.getDependency(C) == MDep) { MD.dropInstruction(M); M->eraseFromParent(); + + NumMemCpyInstr++; + return true; } + // Otherwise, there was no point in doing this, so we remove the call we + // inserted and act like nothing happened. MD.removeInstruction(C); C->eraseFromParent(); - NumMemCpyInstr++; - - return true; + return false; } // MemCpyOpt::runOnFunction - This is the main transformation entry point for a |