[llvm-branch-commits] [llvm-branch] r114900 - /llvm/branches/Apple/whitney/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Daniel Dunbar
daniel at zuster.org
Mon Sep 27 15:11:56 PDT 2010
Author: ddunbar
Date: Mon Sep 27 17:11:56 2010
New Revision: 114900
URL: http://llvm.org/viewvc/llvm-project?rev=114900&view=rev
Log:
Merge r114781:
--
Author: Eric Christopher <echristo at apple.com>
Date: Sat Sep 25 00:57:26 2010 +0000
If we're changing the source of a memcpy we need to use the alignment
of the source, not the original alignment since it may no longer
be valid.
Fixes rdar://8400094
Modified:
llvm/branches/Apple/whitney/lib/Transforms/Scalar/MemCpyOptimizer.cpp
Modified: llvm/branches/Apple/whitney/lib/Transforms/Scalar/MemCpyOptimizer.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/Apple/whitney/lib/Transforms/Scalar/MemCpyOptimizer.cpp?rev=114900&r1=114899&r2=114900&view=diff
==============================================================================
--- llvm/branches/Apple/whitney/lib/Transforms/Scalar/MemCpyOptimizer.cpp (original)
+++ llvm/branches/Apple/whitney/lib/Transforms/Scalar/MemCpyOptimizer.cpp Mon Sep 27 17:11:56 2010
@@ -697,14 +697,16 @@
M->getParent()->getParent()->getParent(),
M->getIntrinsicID(), ArgTys, 3);
+ // Make sure to use the alignment of the source since we're changing the
+ // location we're reading from.
+ // TODO: Is this worth it if we're creating a less aligned memcpy? For
+ // example we could be moving from movaps -> movq on x86.
Value *Args[5] = {
M->getRawDest(), MDep->getRawSource(), M->getLength(),
- M->getAlignmentCst(), M->getVolatileCst()
+ MDep->getAlignmentCst(), M->getVolatileCst()
};
-
CallInst *C = CallInst::Create(MemCpyFun, Args, Args+5, "", 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) == dep) {
More information about the llvm-branch-commits
mailing list