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 | ebacd2b023e1071511bc6a24d4db718478ac5bcb (patch) | |
| tree | e28d03922b7028a3edf2d6e35645121daf4d83d6 /llvm/lib/Transforms/Scalar | |
| parent | 62d626ce86c2a2855c23034c2c83a40ad20bdc22 (diff) | |
| download | bcm5719-llvm-ebacd2b023e1071511bc6a24d4db718478ac5bcb.tar.gz bcm5719-llvm-ebacd2b023e1071511bc6a24d4db718478ac5bcb.zip | |
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
llvm-svn: 114781
Diffstat (limited to 'llvm/lib/Transforms/Scalar')
| -rw-r--r-- | llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp b/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp index 24fae423d2f..f94c9e22576 100644 --- a/llvm/lib/Transforms/Scalar/MemCpyOptimizer.cpp +++ b/llvm/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) { |

