This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Avoid crtl->stack_realign_needed just because of DImode/long long pseudos or arguments (PR rtl-optimization/40667)
On Fri, Jul 10, 2009 at 3:01 PM, Jakub Jelinek<jakub@redhat.com> wrote:
> On Fri, Jul 10, 2009 at 02:53:19PM +0200, Richard Guenther wrote:
>> > + ?/* Don't do dynamic stack realignment for long long objects with
>> > + ? ? -mpreferred-stack-boundary=2. ?*/
>> > + ?if ((mode == DImode || (type && TYPE_MODE (type) == DImode))
>>
>> What about DFmode?
>
> This is the same thing as in ix86_local_alignment. ?I think we had endless
> debates on that, the resolution was if I believe right that only 4 byte
> aligned long long isn't really a performance penalty for 32-bit code, but 4
> byte aligned double is. ?-mpreferred-stack-boundary=2 is mostly used by
> the kernel which doesn't use doubles anyway.
Fair enough. Though I wonder if with -Os and -mpreferred-stack-boundary=2
it still wouldn't be the correct thing to do.
>> > --- gcc/cfgexpand.c.jj ?2009-06-30 13:10:30.000000000 +0200
>> > +++ gcc/cfgexpand.c ? ? 2009-07-10 12:11:40.000000000 +0200
>> > @@ -1164,9 +1164,11 @@ expand_one_var (tree var, bool toplevel,
>> > ? ? ? ? variables, which won't be on stack, we collect alignment of
>> > ? ? ? ? type and ignore user specified alignment. ?*/
>> > ? ? ? if (TREE_STATIC (var) || DECL_EXTERNAL (var))
>> > - ? ? ? align = TYPE_ALIGN (TREE_TYPE (var));
>> > + ? ? ? align = MINIMUM_ALIGNMENT (TREE_TYPE (var),
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?TYPE_MODE (TREE_TYPE (var)),
>> > + ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?TYPE_ALIGN (TREE_TYPE (var)));
>>
>> static or external vars shouldn't use MINIMUM_ALIGNMENT which
>> is documented as for stack re-alignment purposes.
>
> I believe the reason why the code does anything at all for static or
> external variables is if they need to be forced into a register which is
> then spilled to stack. ?So, IMHO it either should use MINIMUM_ALIGNMENT,
> or we shouldn't consider TREE_STATIC (var) || DECL_EXTERNAL (var)
> vars at all.
Ah, indeed. Your change then looks ok.
Thanks,
Richard.
> ? ? ? ?Jakub
>