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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Uroš Bizjak from comment #3)
> (In reply to Iain Sandoe from comment #2)
> > I had previously posted the fragment below for review - and will update that
> > thread shortly.
> But still - why doesn't expand_call update crtl->preferred_stack_update to
> 128, as is the case with linux targets?

Digging deeper through expand_call, the alignment is reduced here:

  if (fndecl)
    {
      struct cgraph_rtl_info *i = cgraph_node::rtl_info (fndecl);
      /* Without automatic stack alignment, we can't increase preferred
         stack boundary.  With automatic stack alignment, it is
         unnecessary since unless we can guarantee that all callers will
         align the outgoing stack properly, callee has to align its
         stack anyway.  */
      if (i
          && i->preferred_incoming_stack_boundary
          && i->preferred_incoming_stack_boundary < preferred_stack_boundary)
        preferred_stack_boundary = i->preferred_incoming_stack_boundary;
    }

and i->preferred_incoming_stack_boundary is set to 64 in final.c,
rest_of_clean_state:

  /* We can reduce stack alignment on call site only when we are sure that
     the function body just produced will be actually used in the final
     executable.  */
  if (flag_ipa_stack_alignment
      && decl_binds_to_current_def_p (current_function_decl))
    {
      unsigned int pref = crtl->preferred_stack_boundary;
      if (crtl->stack_alignment_needed > crtl->preferred_stack_boundary)
        pref = crtl->stack_alignment_needed;
      cgraph_node::rtl_info (current_function_decl)
        ->preferred_incoming_stack_boundary = pref;
    }

So, what we want to achieve here?

Reply via email to