[Bug tree-optimization/52054] New: Value-numbering does not enter translated expressions into the hash table

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Jan 30 14:43:00 GMT 2012


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

             Bug #: 52054
           Summary: Value-numbering does not enter translated expressions
                    into the hash table
    Classification: Unclassified
           Product: gcc
           Version: 4.7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: normal
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rguenth@gcc.gnu.org


When VN comes across

foo (struct S * p)
{
  struct S s;
  int D.1715;
  int D.1712;
  int D.1711;

<bb 2>:
  s = *p_2(D);
  D.1711_3 = s.i;
  D.1712_4 = p_2(D)->i;
  if (D.1711_3 != D.1712_4)

it does not enter p_2(D)->i valued D.1711_3 into the hashtables when
visiting D.1711_3 = s.i but only s.i valued D.1711_3.  It either should
insert both or the most translated expression (or even all the exprs
generated inbetween?  All but the most translated expressions are
compile-time savers only).

This way it can value-number D.1711_3 and D.1712_4 the same.

struct S { int i; int j; };
int foo (struct S *p)
{
  struct S s = *p;
  if (s.i != p->i)
    return 1;
  return 0;
}

see gnat.dg/pack9.ads for an Ada testcase that fails this way w/o SRA.



More information about the Gcc-bugs mailing list