public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug middle-end/52548] New: missed PRE optimization when function call follows to-be hoisted variable
@ 2012-03-09 21:09 aldyh at gcc dot gnu.org
  2012-03-10  0:15 ` [Bug middle-end/52548] " steven at gcc dot gnu.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: aldyh at gcc dot gnu.org @ 2012-03-09 21:09 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52548
           Summary: missed PRE optimization when function call follows
                    to-be hoisted variable
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: aldyh@gcc.gnu.org


For the following code (for -O2):

int flag, hoist, y, z;

void
foo (void)
{
  if (flag)
    y = hoist + 4;
  else
    flag = 888;
  z = hoist + 4;
  bark ();
}

...PRE should be moving "hoist + 4" to the else arm, but it fails to do so.

If you remove the call to bark(), [hoist + 4] gets moved appropriately.

The bark() function call is in the same basic block as "z = hoist + 4".  I wild
guess is that "hoist" isn't anticipatable at the *end* of the BB beginning with
"z = hoist + 4".  Splitting BB's at function calls may improve PRE.  Just a
guess...


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

end of thread, other threads:[~2012-03-22 13:17 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-09 21:09 [Bug middle-end/52548] New: missed PRE optimization when function call follows to-be hoisted variable aldyh at gcc dot gnu.org
2012-03-10  0:15 ` [Bug middle-end/52548] " steven at gcc dot gnu.org
2012-03-12  9:50 ` [Bug tree-optimization/52548] " rguenth at gcc dot gnu.org
2012-03-12 14:03 ` rguenth at gcc dot gnu.org
2012-03-21 11:41 ` rguenth at gcc dot gnu.org
2012-03-21 11:51 ` rguenth at gcc dot gnu.org
2012-03-22 13:17 ` rguenth at gcc dot gnu.org
2012-03-22 13:17 ` rguenth 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).