summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-alias.c
diff options
context:
space:
mode:
authorRichard Guenther <rguenther@suse.de>2011-05-26 13:01:48 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2011-05-26 13:01:48 +0000
commitac8e18759f24063961458ba1e94ca0bfa3138775 (patch)
tree6ba8d1096dc8083667067ab711fce8126259c02e /gcc/tree-ssa-alias.c
parent7e32e6521aa6f699ddc1a00af5f38ceae120cb17 (diff)
downloadgcc-ac8e18759f24063961458ba1e94ca0bfa3138775.tar.gz
re PR tree-optimization/48702 (optimization regression with gcc-4.6 on x86_64-unknown-linux-gnu)
2011-05-26 Richard Guenther <rguenther@suse.de> PR tree-optimization/48702 * tree-ssa-address.c (create_mem_ref_raw): Create MEM_REFs only when we know the base address is within bounds. * tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Do not assume the base address of TARGET_MEM_REFs is in bounds. * gcc.dg/torture/pr48702.c: New testcase. From-SVN: r174282
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r--gcc/tree-ssa-alias.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c
index 3656b396d86..02b3ca07e07 100644
--- a/gcc/tree-ssa-alias.c
+++ b/gcc/tree-ssa-alias.c
@@ -745,11 +745,12 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
the pointer access is beyond the extent of the variable access.
(the pointer base cannot validly point to an offset less than zero
of the variable).
- They also cannot alias if the pointer may not point to the decl. */
- if ((TREE_CODE (base1) != TARGET_MEM_REF
- || (!TMR_INDEX (base1) && !TMR_INDEX2 (base1)))
+ ??? IVOPTs creates bases that do not honor this restriction,
+ so do not apply this optimization for TARGET_MEM_REFs. */
+ if (TREE_CODE (base1) != TARGET_MEM_REF
&& !ranges_overlap_p (MAX (0, offset1p), -1, offset2p, max_size2))
return false;
+ /* They also cannot alias if the pointer may not point to the decl. */
if (!ptr_deref_may_alias_decl_p (ptr1, base2))
return false;
@@ -799,7 +800,7 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1,
if (!ref2)
return true;
- /* If the decl is accressed via a MEM_REF, reconstruct the base
+ /* If the decl is accessed via a MEM_REF, reconstruct the base
we can use for TBAA and an appropriately adjusted offset. */
dbase2 = ref2;
while (handled_component_p (dbase2))