[llvm-commits] [llvm] r50446 - /llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Owen Anderson
resistor at mac.com
Tue Apr 29 14:51:00 PDT 2008
Author: resistor
Date: Tue Apr 29 16:51:00 2008
New Revision: 50446
URL: http://llvm.org/viewvc/llvm-project?rev=50446&view=rev
Log:
Revert r50441. The original code was correct. Add some more comments so that I don't make the same mistake in the future.
Modified:
llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Modified: llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=50446&r1=50445&r2=50446&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Tue Apr 29 16:51:00 2008
@@ -668,18 +668,24 @@
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
More information about the llvm-commits
mailing list