[PATCH] Fix short-cut in nonaliasing_component_refs_p
Richard Guenther
rguenther@suse.de
Fri May 29 15:00:00 GMT 2009
The short-cut is invalid because it misses an early out by
same_type_for_tbaa else.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk.
Richard.
2009-05-29 Richard Guenther <rguenther@suse.de>
* tree-ssa-alias.c (nonaliasing_component_refs_p): Remove
short-cutting on the first component.
Index: gcc/tree-ssa-alias.c
===================================================================
*** gcc/tree-ssa-alias.c (revision 147972)
--- gcc/tree-ssa-alias.c (working copy)
*************** nonaliasing_component_refs_p (tree ref1,
*** 539,546 ****
/* Now search for the type1 in the access path of ref2. This
would be a common base for doing offset based disambiguation on. */
! /* Skip the outermost ref - we would have caught that earlier. */
! refp = &TREE_OPERAND (ref2, 0);
while (handled_component_p (*refp)
&& same_type_for_tbaa (TREE_TYPE (*refp), type1) == 0)
refp = &TREE_OPERAND (*refp, 0);
--- 539,545 ----
/* Now search for the type1 in the access path of ref2. This
would be a common base for doing offset based disambiguation on. */
! refp = &ref2;
while (handled_component_p (*refp)
&& same_type_for_tbaa (TREE_TYPE (*refp), type1) == 0)
refp = &TREE_OPERAND (*refp, 0);
*************** nonaliasing_component_refs_p (tree ref1,
*** 556,562 ****
return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
}
/* If we didn't find a common base, try the other way around. */
! refp = &TREE_OPERAND (ref1, 0);
while (handled_component_p (*refp)
&& same_type_for_tbaa (TREE_TYPE (*refp), type2) == 0)
refp = &TREE_OPERAND (*refp, 0);
--- 555,561 ----
return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
}
/* If we didn't find a common base, try the other way around. */
! refp = &ref1;
while (handled_component_p (*refp)
&& same_type_for_tbaa (TREE_TYPE (*refp), type2) == 0)
refp = &TREE_OPERAND (*refp, 0);
More information about the Gcc-patches
mailing list