diff options
author | Eric Christopher <echristo@apple.com> | 2010-09-25 00:57:26 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2010-09-25 00:57:26 +0000 |
commit | c69a00047013a0e2e07ae44c38e013a7d905b10e (patch) | |
tree | a15af50be7f0ae54896bc493da7bc5f39c1e0e67 /lib/Transforms | |
parent | 576a3968a2c1607d0ca0d87b28f8509b633e4bf0 (diff) | |
download | external_llvm-c69a00047013a0e2e07ae44c38e013a7d905b10e.zip external_llvm-c69a00047013a0e2e07ae44c38e013a7d905b10e.tar.gz external_llvm-c69a00047013a0e2e07ae44c38e013a7d905b10e.tar.bz2 |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@114781 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Transforms')
-rw-r--r-- | lib/Transforms/Scalar/MemCpyOptimizer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 24fae42..f94c9e2 100644 --- a/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/lib/Transforms/Scalar/MemCpyOptimizer.cpp @@ -697,14 +697,16 @@ bool MemCpyOpt::processMemCpy(MemCpyInst *M) { 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) { |