public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug target/104414] New: [AArch64] About the condition of calls_alloca in aarch64_layout_frame
@ 2022-02-07  8:57 ashimida at linux dot alibaba.com
  2022-02-07  9:04 ` [Bug target/104414] " rguenth at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: ashimida at linux dot alibaba.com @ 2022-02-07  8:57 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104414

            Bug ID: 104414
           Summary: [AArch64] About the condition of calls_alloca in
                    aarch64_layout_frame
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: ashimida at linux dot alibaba.com
  Target Milestone: ---

There is the following code in aarch64_layout_frame:

else if (crtl->outgoing_args_size.is_constant (&const_outgoing_args_size)
         && frame.saved_regs_size.is_constant (&const_saved_regs_size)
         && const_outgoing_args_size + const_saved_regs_size < 512
         && (!saves_below_hard_fp_p || const_outgoing_args_size == 0)
                                                                    // 1) 
         && !(cfun->calls_alloca                                    
              && frame.hard_fp_offset.is_constant (&const_fp_offset)
              && const_fp_offset < max_push_offset))
  {
    /* Frame with small outgoing arguments:

       sub sp, sp, frame_size
       stp reg1, reg2, [sp, outgoing_args_size]
       stp reg3, reg4, [sp, outgoing_args_size + 16]  */
    frame.initial_adjust = frame.frame_size;
    frame.callee_offset = const_outgoing_args_size;
  }
......
else if (frame.hard_fp_offset.is_constant (&const_fp_offset)
         && const_fp_offset < max_push_offset)
  {
                                                                    // 2) 
    /* Frame with large outgoing arguments or SVE saves, but with  
       a small local area:

       stp reg1, reg2, [sp, -hard_fp_offset]!
       stp reg3, reg4, [sp, 16]
       [sub sp, sp, below_hard_fp_saved_regs_size]
       [save SVE registers relative to SP]
       sub sp, sp, outgoing_args_size  */


As described in 2), "Frame with large outgoing arguments or SVE saves,
but with a small local area".

But due to the condition at 1), the following code (small outgoing with
a small local area) also uses the insns in 2), which is slightly different
from the description:

#include <stdio.h>
#include <alloca.h>
#define REP9(X) X,X,X,X,X,X,X,X,X

int alloc_size;

void outgoing_1 (int x, ...)
{
        return 0;
}

int main(void)
{
        outgoing1 (REP9(1));
        char * y = alloca(alloc_size);
        return 0;
}

Could the condition in 1) be removed, or am I missing something?

Thanks,
Dan.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/104414] [AArch64] About the condition of calls_alloca in aarch64_layout_frame
  2022-02-07  8:57 [Bug target/104414] New: [AArch64] About the condition of calls_alloca in aarch64_layout_frame ashimida at linux dot alibaba.com
@ 2022-02-07  9:04 ` rguenth at gcc dot gnu.org
  2022-02-07  9:07 ` ashimida at linux dot alibaba.com
  2022-03-30 15:18 ` rearnsha at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-02-07  9:04 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104414

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Please ask such questions on the mailing list instead, there you will more
likely get an answer.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/104414] [AArch64] About the condition of calls_alloca in aarch64_layout_frame
  2022-02-07  8:57 [Bug target/104414] New: [AArch64] About the condition of calls_alloca in aarch64_layout_frame ashimida at linux dot alibaba.com
  2022-02-07  9:04 ` [Bug target/104414] " rguenth at gcc dot gnu.org
@ 2022-02-07  9:07 ` ashimida at linux dot alibaba.com
  2022-03-30 15:18 ` rearnsha at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: ashimida at linux dot alibaba.com @ 2022-02-07  9:07 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104414

--- Comment #2 from ashimida <ashimida at linux dot alibaba.com> ---
(In reply to Richard Biener from comment #1)
> Please ask such questions on the mailing list instead, there you will more
> likely get an answer.

Oh, thanks, sorry to bother.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Bug target/104414] [AArch64] About the condition of calls_alloca in aarch64_layout_frame
  2022-02-07  8:57 [Bug target/104414] New: [AArch64] About the condition of calls_alloca in aarch64_layout_frame ashimida at linux dot alibaba.com
  2022-02-07  9:04 ` [Bug target/104414] " rguenth at gcc dot gnu.org
  2022-02-07  9:07 ` ashimida at linux dot alibaba.com
@ 2022-03-30 15:18 ` rearnsha at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: rearnsha at gcc dot gnu.org @ 2022-03-30 15:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104414

Richard Earnshaw <rearnsha at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #3 from Richard Earnshaw <rearnsha at gcc dot gnu.org> ---
Not a bug report

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-03-30 15:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-07  8:57 [Bug target/104414] New: [AArch64] About the condition of calls_alloca in aarch64_layout_frame ashimida at linux dot alibaba.com
2022-02-07  9:04 ` [Bug target/104414] " rguenth at gcc dot gnu.org
2022-02-07  9:07 ` ashimida at linux dot alibaba.com
2022-03-30 15:18 ` rearnsha at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).