public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug tree-optimization/52081] New: Missed tail merging with pure calls
@ 2012-02-01 10:24 vries at gcc dot gnu.org
  2012-02-01 10:27 ` [Bug tree-optimization/52081] " vries at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2012-02-01 10:24 UTC (permalink / raw)
  To: gcc-bugs

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

             Bug #: 52081
           Summary: Missed tail merging with pure calls
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vries@gcc.gnu.org


pr51879-12.c:
...
__attribute__((pure)) int bar (int);
__attribute__((pure)) int bar2 (int);
void baz (int);

int x, z;

void
foo (int y)
{
  int a = 0;
  if (y == 6)
    {
      a += bar (7);
      a += bar2 (6);
    }
  else
    {
      a += bar2 (6);
      a += bar (7);
    }
  baz (a);
}
...

When compiling at -O2, pr51879-12.c.094t.pre looks like this:
...
  # BLOCK 3 freq:1991
  # PRED: 2 [19.9%]  (true,exec)
  # VUSE <.MEMD.1722_12(D)>
  # USE = nonlocal escaped 
  D.1717_4 = barD.1703 (7);
  # VUSE <.MEMD.1722_12(D)>
  # USE = nonlocal escaped 
  D.1718_6 = bar2D.1705 (6);
  aD.1713_7 = D.1717_4 + D.1718_6;
  goto <bb 5>;
  # SUCC: 5 [100.0%]  (fallthru,exec)

  # BLOCK 4 freq:8009
  # PRED: 2 [80.1%]  (false,exec)
  # VUSE <.MEMD.1722_12(D)>
  # USE = nonlocal escaped 
  D.1720_8 = bar2D.1705 (6);
  # VUSE <.MEMD.1722_12(D)>
  # USE = nonlocal escaped 
  D.1721_10 = barD.1703 (7);
  aD.1713_11 = D.1720_8 + D.1721_10;
  # SUCC: 5 [100.0%]  (fallthru,exec)

  # BLOCK 5 freq:10000
  # PRED: 3 [100.0%]  (fallthru,exec) 4 [100.0%]  (fallthru,exec)
  # aD.1713_1 = PHI <aD.1713_7(3), aD.1713_11(4)>
  # .MEMD.1722_13 = VDEF <.MEMD.1722_12(D)>
  # USE = nonlocal 
  # CLB = nonlocal 
  bazD.1707 (aD.1713_1);
  # VUSE <.MEMD.1722_13>
  return;
...

Value numbering numbers the two phi arguments a_7 and a_11 the same so the
problem is not in value numbering:
...
Setting value number of a_11 to a_7 (changed)
...


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

* [Bug tree-optimization/52081] Missed tail merging with pure calls
  2012-02-01 10:24 [Bug tree-optimization/52081] New: Missed tail merging with pure calls vries at gcc dot gnu.org
@ 2012-02-01 10:27 ` vries at gcc dot gnu.org
  2012-02-02 10:47 ` vries at gcc dot gnu.org
  2012-04-14  6:04 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2012-02-01 10:27 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from vries at gcc dot gnu.org 2012-02-01 10:27:01 UTC ---
Created attachment 26540
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=26540
tentative patch


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

* [Bug tree-optimization/52081] Missed tail merging with pure calls
  2012-02-01 10:24 [Bug tree-optimization/52081] New: Missed tail merging with pure calls vries at gcc dot gnu.org
  2012-02-01 10:27 ` [Bug tree-optimization/52081] " vries at gcc dot gnu.org
@ 2012-02-02 10:47 ` vries at gcc dot gnu.org
  2012-04-14  6:04 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2012-02-02 10:47 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from vries at gcc dot gnu.org 2012-02-02 10:46:42 UTC ---
submitted patch: http://gcc.gnu.org/ml/gcc-patches/2012-02/msg00078.html


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

* [Bug tree-optimization/52081] Missed tail merging with pure calls
  2012-02-01 10:24 [Bug tree-optimization/52081] New: Missed tail merging with pure calls vries at gcc dot gnu.org
  2012-02-01 10:27 ` [Bug tree-optimization/52081] " vries at gcc dot gnu.org
  2012-02-02 10:47 ` vries at gcc dot gnu.org
@ 2012-04-14  6:04 ` vries at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: vries at gcc dot gnu.org @ 2012-04-14  6:04 UTC (permalink / raw)
  To: gcc-bugs

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

vries at gcc dot gnu.org changed:

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

--- Comment #3 from vries at gcc dot gnu.org 2012-04-14 06:04:03 UTC ---
Fixed in r186447.


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

end of thread, other threads:[~2012-04-14  6:04 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-01 10:24 [Bug tree-optimization/52081] New: Missed tail merging with pure calls vries at gcc dot gnu.org
2012-02-01 10:27 ` [Bug tree-optimization/52081] " vries at gcc dot gnu.org
2012-02-02 10:47 ` vries at gcc dot gnu.org
2012-04-14  6:04 ` vries 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).