[llvm] [X86] Don't allocate unused padding in front of realigned locals (PR #227495)
Phoebe Wang via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 21:07:54 PDT 2026
================
@@ -1901,9 +1927,14 @@ void X86FrameLowering::emitPrologue(MachineFunction &MF,
NumBytes =
FrameSize - (X86FI->getCalleeSavedFrameSize() + TailCallArgReserveSize);
- // Callee-saved registers are pushed on stack before the stack is realigned.
- if (TRI->hasStackRealignment(MF) && !IsWin64Prologue)
- NumBytes = alignTo(NumBytes, MaxAlign);
+ // Callee-saved registers are pushed on stack before the stack is realigned,
+ // and the realignment itself already provides the local objects' alignment,
+ // so leave out the padding PEI put in front of them for it.
+ if (TRI->hasStackRealignment(MF) && !IsWin64Prologue) {
+ uint64_t Padding = getUnusedLocalAreaPadding(MFI);
----------------
phoebewang wrote:
Does the padding also apply non realignment case? Can we subtract it in line 1927?
https://github.com/llvm/llvm-project/pull/227495
More information about the llvm-commits
mailing list