[llvm-commits] [llvm] r51848 - /llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Owen Anderson
resistor at mac.com
Sun Jun 1 14:52:17 PDT 2008
Author: resistor
Date: Sun Jun 1 16:52:16 2008
New Revision: 51848
URL: http://llvm.org/viewvc/llvm-project?rev=51848&view=rev
Log:
Don't remove the memcpy when call slot substitution fails.
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=51848&r1=51847&r2=51848&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/trunk/lib/Transforms/Scalar/MemCpyOptimizer.cpp Sun Jun 1 16:52:16 2008
@@ -580,14 +580,19 @@
return false;
// All the checks have passed, so do the transformation.
+ bool changedArgument = false;
for (unsigned i = 0; i < CS.arg_size(); ++i)
if (CS.getArgument(i) == cpySrc) {
if (cpySrc->getType() != cpyDest->getType())
cpyDest = CastInst::CreatePointerCast(cpyDest, cpySrc->getType(),
cpyDest->getName(), C);
+ changedArgument = true;
CS.setArgument(i, cpyDest);
}
+ if (!changedArgument)
+ return false;
+
// Drop any cached information about the call, because we may have changed
// its dependence information by changing its parameter.
MemoryDependenceAnalysis& MD = getAnalysis<MemoryDependenceAnalysis>();
More information about the llvm-commits
mailing list