public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "law at redhat dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/63892] [5 Regression] gcc.dg/sibcall-3.c fails on darwin with -m32
Date: Wed, 18 Feb 2015 19:49:00 -0000	[thread overview]
Message-ID: <bug-63892-4-IJs0lsbKH4@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-63892-4@http.gcc.gnu.org/bugzilla/>

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

Jeffrey A. Law <law at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P2
                 CC|                            |law at redhat dot com
           Assignee|unassigned at gcc dot gnu.org      |mliska at suse dot cz

--- Comment #3 from Jeffrey A. Law <law at redhat dot com> ---
Darwin does not support weak aliases.  As a result the ICF code has to be more
conservative in how it transforms the resulting code when an ICF opportunity
exists.

Normally (if we have weak aliases), recurser_void1 will be made a weak alias to
recurser_void2.  That in turn exposes recurser_void2 as self recursion which
gets optimized into an appropriate loop by the 2nd tail call optimizer.  And
(of course) the test passes with ICF enabled.  For darwin, we don't have weak
aliases, so none of this applies.

For darwin, in the non-ICF case we ultimately determine that both recurser
functions are local and we can change their signature.  And they're both
changed to use register passing for some arguments.  As a result when it comes
time to try a tail call sequence, neither function has a need for parameters on
the stack, so that test passes and ultimately we emit the optimized tail call
sequence.

In the ICF case, recurser_void2 has the right bits (local/signature changeable)
and it's changed to use register passing conventions (ie, no stack space). 
However recurser_void1 doesn't have the "local" bit set and thus it's not
considered eligible for register passing conventions (arguments on the stack).

This mismatch in stack handling for parameters ultimately means that we can't
use a tail call for the call from recurser_void2 to recurser_void1 and the test
fails.

It's unclear to me if the ICF bits should be setting flags in the cgraph nodes
when it merges functions or if those bits should be set elsewhere.  It may also
be possible to fix this in the x86 backend perhaps if there's a way to
recognize the alias/thunk nature of recurser_void1 and follow that to
recurser_void2 and use the flags from the latter for determining the calling
conventions for the former.

Assigning to mliksa for further analysis.


  parent reply	other threads:[~2015-02-18 19:49 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-15 16:21 [Bug target/63892] New: [5.0 regression] " fxcoudert at gcc dot gnu.org
2014-11-15 16:22 ` [Bug target/63892] " fxcoudert at gcc dot gnu.org
2014-11-15 16:27 ` dominiq at lps dot ens.fr
2014-11-17  9:32 ` rguenth at gcc dot gnu.org
2014-12-10 15:28 ` rguenth at gcc dot gnu.org
2015-02-18 19:49 ` law at redhat dot com [this message]
2015-02-20  9:32 ` [Bug target/63892] [5 Regression] " jakub at gcc dot gnu.org
2015-02-20 10:41 ` jakub at gcc dot gnu.org
2015-02-20 12:00 ` marxin at gcc dot gnu.org
2015-02-20 13:04 ` jakub at gcc dot gnu.org
2015-02-20 16:50 ` jakub at gcc dot gnu.org
2015-02-20 16:51 ` jakub at gcc dot gnu.org
2015-02-21 12:51 ` dominiq at lps dot ens.fr
2015-02-21 13:29 ` iains at gcc dot gnu.org
2015-02-21 13:29 ` iains at gcc dot gnu.org
2015-02-21 14:47 ` iains at gcc dot gnu.org
2015-02-21 18:03 ` iains at gcc dot gnu.org
2015-02-22  4:59 ` iains at gcc dot gnu.org
2015-02-22 13:10 ` iains at gcc dot gnu.org
2015-02-22 16:55 ` iains at gcc dot gnu.org
2015-02-22 22:27 ` howarth at bromo dot med.uc.edu
2015-02-22 23:57 ` iains at gcc dot gnu.org
2015-02-23  8:45 ` iains at gcc dot gnu.org
2015-02-23 11:15 ` jakub at gcc dot gnu.org
2015-02-23 11:15 ` jakub at gcc dot gnu.org
2015-02-27  7:44 ` mrs at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-63892-4-IJs0lsbKH4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).