[Bug tree-optimization/38895] New: missed type-based disambiguation

rguenth at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Sat Jan 17 12:55:00 GMT 2009


RTL alias analysis (nonoverlapping_component_refs_p) with a quadratic loop
finds that c->a1.i and b->a1.j cannot alias based on a offset test on the
common sub-reference base a1.  The tree based alias oracle only does two
linear searches for the base type *c in b->a1.j and for *b in c->a1.i.

This is related to PR13146 where even that is not enough, but a
(non-conservative?) answer based on not finding a common base needs to be
given.

/* { dg-do compile } */
/* { dg-options "-O -fstrict-aliasing -fdump-tree-optimized" } */

struct A {
  int i;
  int j;
};
struct B {
  struct A a1;
  struct A a2;
};
struct C {
  struct A a1;
  struct B b;
};
int foo(struct C *c, struct B *b)
{
  c->a1.i = 1;
  b->a1.j = 0;
  return c->a1.i;
}

/* { dg-final { scan-tree-dump "return 1;" "optimized" } } */
/* { dg-final { cleanup-tree-dump "optimized" } } */


-- 
           Summary: missed type-based disambiguation
           Product: gcc
           Version: 4.4.0
            Status: UNCONFIRMED
          Keywords: missed-optimization, alias, TREE
          Severity: enhancement
          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=38895



More information about the Gcc-bugs mailing list