public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug rtl-optimization/55747] New: Extra registers are saved in functions that only call noreturn functions
@ 2012-12-20  1:12 josh.m.conner at gmail dot com
  2012-12-20  1:22 ` [Bug rtl-optimization/55747] " pinskia at gcc dot gnu.org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: josh.m.conner at gmail dot com @ 2012-12-20  1:12 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55747

             Bug #: 55747
           Summary: Extra registers are saved in functions that only call
                    noreturn functions
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: rtl-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: josh.m.conner@gmail.com


On architectures such as ARM, where a link register is used to save the return
address, this value does not need to be saved in a function that only calls
noreturn functions.

For example, if I build the following source:

  __attribute__((noreturn))
  extern void bar (void);

  int x;

  void foo (void)
  {
    if (x)
      bar ();
  }

Using the options "-O2", the link register is saved:

  stmfd   sp!, {r3, lr}
  ...
  ldmeqfd sp!, {r3, pc}

However, this is unnecessary since the only way the link register cannot be
corrupted since any calls to "bar" will not return.

Note that I am not filing this as an ARM target bug since the issue appears to
be a general problem related to dataflow analysis not tracking the difference
between calls to normal functions and calls to noreturn functions.  At any
rate, I see a similar problem in our custom target as well.


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

end of thread, other threads:[~2013-10-04 20:08 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-20  1:12 [Bug rtl-optimization/55747] New: Extra registers are saved in functions that only call noreturn functions josh.m.conner at gmail dot com
2012-12-20  1:22 ` [Bug rtl-optimization/55747] " pinskia at gcc dot gnu.org
2013-01-06  8:26 ` hp at gcc dot gnu.org
2013-10-04 18:46 ` olegendo at gcc dot gnu.org
2013-10-04 20:08 ` 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).