------- Comment #28 from rguenth at gcc dot gnu dot org 2010-07-07 11:59 ------- The following is a fix (or workaround) for the problem.
Index: gcc/tree-ssa-alias.c =================================================================== --- gcc/tree-ssa-alias.c (revision 161869) +++ gcc/tree-ssa-alias.c (working copy) @@ -801,7 +780,8 @@ indirect_refs_may_alias_p (tree ref1 ATT /* If both bases are based on pointers they cannot alias if they may not point to the same memory object or if they point to the same object and the accesses do not overlap. */ - if (operand_equal_p (ptr1, ptr2, 0)) + if (gimple_in_ssa_p (cfun) + && operand_equal_p (ptr1, ptr2, 0)) { if (TREE_CODE (base1) == MEM_REF) offset1 += mem_ref_offset (base1).low * BITS_PER_UNIT; In SSA form we are sure that if two SSA names are equal their (same) definition dominates them. So if you ask whether the two memory references do alias if they are still in loopy form they do not. For every iteration they have a strict ordering with respect to the definition of their name. Now if you unroll the loop and re-instantiate SSA form you can't use the previous alias query result to determine cross-loop-iteration dependences. The above patch disables offset-based disambiguation for accesses via pointers (technically a nice thing to have). -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44838