diff options
author | Richard Guenther <rguenther@suse.de> | 2011-05-26 13:01:48 +0000 |
---|---|---|
committer | Richard Guenther <rguenther@suse.de> | 2011-05-26 13:01:48 +0000 |
commit | 0b380e31dbc36995af0d1baf2bf9128cbad35303 (patch) | |
tree | 6ba8d1096dc8083667067ab711fce8126259c02e /gcc/tree-ssa-alias.c | |
parent | ee6886c6d2291dfdbed3035fa2846bfda30a3a72 (diff) |
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.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@174282 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 9 |
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)) |