This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tree-optimization/52009] New: Another missed tail merging opportunity


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

             Bug #: 52009
           Summary: Another missed tail merging opportunity
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: vries@gcc.gnu.org


test-case pr51879-7.c:
...
int bar (int);
void baz (int);

int z;

void
foo (int y)
{
  int a;
  if (y == 6)
    {
      z = 5;
      a = bar (7);
    }
  else
    {
      z = 5;
      a = bar (7);
    }
  baz (a);
}
...

compile:
...
$ gcc -O2 -fdump-tree-all-all pr51879-7.c -S
...

representation at pr51879-7.c.094t.pre:
...
  # BLOCK 3 freq:1991
  # PRED: 2 [19.9%]  (true,exec)
  # .MEMD.1717_7 = VDEF <.MEMD.1717_6(D)>
  zD.1708 = 5;
  # .MEMD.1717_8 = VDEF <.MEMD.1717_7>
  # USE = nonlocal 
  # CLB = nonlocal 
  aD.1712_3 = barD.1703 (7);
  goto <bb 5>;
  # SUCC: 5 [100.0%]  (fallthru,exec)

  # BLOCK 4 freq:8009
  # PRED: 2 [80.1%]  (false,exec)
  # .MEMD.1717_9 = VDEF <.MEMD.1717_6(D)>
  zD.1708 = 5;
  # .MEMD.1717_10 = VDEF <.MEMD.1717_9>
  # USE = nonlocal 
  # CLB = nonlocal 
  aD.1712_4 = barD.1703 (7);
  # SUCC: 5 [100.0%]  (fallthru,exec)

  # BLOCK 5 freq:10000
  # PRED: 3 [100.0%]  (fallthru,exec) 4 [100.0%]  (fallthru,exec)
  # aD.1712_1 = PHI <aD.1712_3(3), aD.1712_4(4)>
  # .MEMD.1717_5 = PHI <.MEMD.1717_8(3), .MEMD.1717_10(4)>
  # .MEMD.1717_11 = VDEF <.MEMD.1717_5>
  # USE = nonlocal 
  # CLB = nonlocal 
  bazD.1705 (aD.1712_1);
  # VUSE <.MEMD.1717_11>
  return;
...

Blocks 3 and 4 are not merged, because .MEMD.1717_7 and .MEMD.1717_9 are not
value numbered the same:
...
SCC consists of: .MEM_7 
Value numbering .MEM_7 stmt = z = 5;
RHS 5 simplified to 5
No store match
Value numbering store z to 5
Setting value number of .MEM_7 to .MEM_7 (changed)
...
SCC consists of: .MEM_9 
Value numbering .MEM_9 stmt = z = 5;
RHS 5 simplified to 5
No store match
Value numbering store z to 5
Setting value number of .MEM_9 to .MEM_9 (changed)
...


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]