[llvm-commits] [llvm][PATCH][Review Requested] Fix failure to realign stack on x86

Jakob Stoklund Olesen stoklund at 2pi.dk
Wed Jan 18 10:30:10 PST 2012


On Jan 18, 2012, at 9:55 AM, Gurd, Preston wrote:

> The attached one line patch corrects a problem whereby llvm was failing to generate an ANDL instruction to align the stack pointer on function entry when the required alignment was mod 16 and when stack realignment was requested.

> --- lib/Target/X86/X86RegisterInfo.cpp	(revision 148345)
> +++ lib/Target/X86/X86RegisterInfo.cpp	(working copy)
> @@ -352,7 +352,7 @@
>    const MachineFrameInfo *MFI = MF.getFrameInfo();
>    const Function *F = MF.getFunction();
>    unsigned StackAlign = TM.getFrameLowering()->getStackAlignment();
> -  bool requiresRealignment = ((MFI->getMaxAlignment() > StackAlign) ||
> +  bool requiresRealignment = ((MFI->getMaxAlignment() >= StackAlign) ||
>                                 F->hasFnAttr(Attribute::StackAlignment));
> 

I don't understand this change. Why realign the stack when it is already sufficiently aligned?

/jakob

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20120118/f87af339/attachment.html>


More information about the llvm-commits mailing list