mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-07-26 20:26:07 +00:00
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
This commit is contained in:
@@ -697,14 +697,16 @@ bool MemCpyOpt::processMemCpy(MemCpyInst *M) {
|
|||||||
M->getParent()->getParent()->getParent(),
|
M->getParent()->getParent()->getParent(),
|
||||||
M->getIntrinsicID(), ArgTys, 3);
|
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] = {
|
Value *Args[5] = {
|
||||||
M->getRawDest(), MDep->getRawSource(), M->getLength(),
|
M->getRawDest(), MDep->getRawSource(), M->getLength(),
|
||||||
M->getAlignmentCst(), M->getVolatileCst()
|
MDep->getAlignmentCst(), M->getVolatileCst()
|
||||||
};
|
};
|
||||||
|
|
||||||
CallInst *C = CallInst::Create(MemCpyFun, Args, Args+5, "", M);
|
CallInst *C = CallInst::Create(MemCpyFun, Args, Args+5, "", M);
|
||||||
|
|
||||||
|
|
||||||
// If C and M don't interfere, then this is a valid transformation. If they
|
// 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.
|
// did, this would mean that the two sources overlap, which would be bad.
|
||||||
if (MD.getDependency(C) == dep) {
|
if (MD.getDependency(C) == dep) {
|
||||||
|
Reference in New Issue
Block a user