mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2026-04-26 12:20:42 +00:00
When lowering memcpys to loads and stores, make sure we don't promote alignments
past the natural stack alignment. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174085 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -3561,6 +3561,15 @@ static SDValue getMemcpyLoadsAndStores(SelectionDAG &DAG, DebugLoc dl,
|
||||
if (DstAlignCanChange) {
|
||||
Type *Ty = MemOps[0].getTypeForEVT(*DAG.getContext());
|
||||
unsigned NewAlign = (unsigned) TLI.getDataLayout()->getABITypeAlignment(Ty);
|
||||
|
||||
// Don't promote to an alignment that would require dynamic stack
|
||||
// realignment.
|
||||
const TargetRegisterInfo *TRI = MF.getTarget().getRegisterInfo();
|
||||
if (!TRI->needsStackRealignment(MF))
|
||||
while (NewAlign > Align &&
|
||||
TLI.getDataLayout()->exceedsNaturalStackAlignment(NewAlign))
|
||||
NewAlign /= 2;
|
||||
|
||||
if (NewAlign > Align) {
|
||||
// Give the stack frame object a larger alignment if needed.
|
||||
if (MFI->getObjectAlignment(FI->getIndex()) < NewAlign)
|
||||
|
||||
Reference in New Issue
Block a user