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: unassig...@gcc.gnu.org ReportedBy: rgue...@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.