[Bug tree-optimization/37892] New: phi-translation and SCCVN do not optimize *&

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Wed Oct 22 18:16:00 GMT 2008


struct X { int i; };

int foo (int x)
{
  struct X a;
  struct X b;
  struct X *p;
  a.i = 1;
  b.i = 2;
  if (x)
    p = &a;
  else
    p = &b;
  return p->i;
}

should be optimized to return 1 or 2, removing the loads on both paths.

One piece that is missing is that PHI-translation does not optimize the
reference ops vector after phi-translating the operands.  So we end up
looking up (*(&a)).i instead of a.i.  If you fix that we still have
mismatched virtual operands.  This will be fixed on the alias-improvements
branch.


-- 
           Summary: phi-translation and SCCVN do not optimize *&
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, alias
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rguenth at gcc dot gnu dot org


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



More information about the Gcc-bugs mailing list