[llvm] r247450 - Use function attribute "stackrealign" to decide whether stack
Hal Finkel via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 11 16:12:38 PDT 2015
----- Original Message -----
> From: "Reid Kleckner" <rnk at google.com>
> To: "Hal Finkel" <hfinkel at anl.gov>
> Cc: "llvm-commits" <llvm-commits at lists.llvm.org>, "Akira Hatanaka" <ahatanak at gmail.com>
> Sent: Friday, September 11, 2015 5:51:11 PM
> Subject: Re: [llvm] r247450 - Use function attribute "stackrealign" to decide whether stack
>
> On Fri, Sep 11, 2015 at 3:30 PM, Hal Finkel < hfinkel at anl.gov >
> wrote:
>
>
> ----- Original Message -----
> > From: "Reid Kleckner via llvm-commits" <
> > llvm-commits at lists.llvm.org >
> > To: "Akira Hatanaka" < ahatanak at gmail.com >
> > Cc: "llvm-commits" < llvm-commits at lists.llvm.org >
> > Sent: Friday, September 11, 2015 5:08:38 PM
> > Subject: Re: [llvm] r247450 - Use function attribute "stackrealign"
> > to decide whether stack
> >
> >
> >
> > I recall some users from nvidia or Intel did something like
> > arranging
> > to call a function using AVX with 32-byte stack alignment, and
> > using
> > -mno-stackrealign to suppress the funky prologue. They would
> > probably be better served with an ABI stack alignment override, so
> > maybe that use case is not worth considering.
> >
>
> It seems like, for this use case, we really want an attribute to
> specify what the enhanced caller-provided stack alignment actually
> is, so that the backend can then make the appropriate choice about
> generating a stack realignment based on the needs of its local
> variables and spill slots.
>
> Precisely. Actually, don't we already have an attribute for this?
> Isn't "stackrealign" equivalent to alignstack(1)?
No; the relevant code in MachineFunction::MachineFunction does this:
if (Fn->hasFnAttribute(Attribute::StackAlignment))
FrameInfo->ensureMaxAlignment(Fn->getFnStackAlignment());
And so, if I'm reading this correctly, alignstack can only be used to request a larger alignment than what the function would normally get (and, thus, might trigger realignment), but does not specify the incoming alignment the backend can assume for that function.
-Hal
--
Hal Finkel
Assistant Computational Scientist
Leadership Computing Facility
Argonne National Laboratory
More information about the llvm-commits
mailing list