diff options
author | Richard Guenther <rguenther@suse.de> | 2010-09-05 10:47:05 +0000 |
---|---|---|
committer | Richard Guenther <rguenther@suse.de> | 2010-09-05 10:47:05 +0000 |
commit | 518cd9f689a55efff5e6dc12a6ae1f015384a1e1 (patch) | |
tree | 67feb12fc771c5fabd29cc9489e084e60304dbdd /gcc/tree-ssa-alias.c | |
parent | c0f3aeb5870d64e482e25621b11f3e00d8e832c9 (diff) |
2010-09-05 Richard Guenther <rguenther@suse.de>
PR tree-optimization/45535
* tree-ssa-alias.c (indirect_ref_may_alias_decl_p): Properly
handle TMR_INDEX2. Make sure TMR_INDEX is not NULL before
dereferencing it.
(indirect_refs_may_alias_p): Likewise.
* gcc.c-torture/compile/pr45535.c: New testcase.
git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@163877 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-alias.c')
-rw-r--r-- | gcc/tree-ssa-alias.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/tree-ssa-alias.c b/gcc/tree-ssa-alias.c index a9f1c19f7ac..e00c50a2ef9 100644 --- a/gcc/tree-ssa-alias.c +++ b/gcc/tree-ssa-alias.c @@ -693,7 +693,8 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, (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)) + if ((TREE_CODE (base1) != TARGET_MEM_REF + || (!TMR_INDEX (base1) && !TMR_INDEX2 (base1))) && !ranges_overlap_p (MAX (0, offset1p), -1, offset2p, max_size2)) return false; if (!ptr_deref_may_alias_decl_p (ptr1, base2)) @@ -725,7 +726,8 @@ indirect_ref_may_alias_decl_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, is relative to the start of the type which we ensure by comparing rvalue and access type and disregarding the constant pointer offset. */ - if ((TREE_CODE (base1) != TARGET_MEM_REF || !TMR_INDEX (base1)) + if ((TREE_CODE (base1) != TARGET_MEM_REF + || (!TMR_INDEX (base1) && !TMR_INDEX2 (base1))) && (TREE_CODE (base1) != MEM_REF || same_type_for_tbaa (TREE_TYPE (base1), TREE_TYPE (ptrtype1)) == 1) && same_type_for_tbaa (TREE_TYPE (ptrtype1), TREE_TYPE (base2)) == 1) @@ -807,16 +809,23 @@ indirect_refs_may_alias_p (tree ref1 ATTRIBUTE_UNUSED, tree base1, if ((!cfun || gimple_in_ssa_p (cfun)) && operand_equal_p (ptr1, ptr2, 0) && (((TREE_CODE (base1) != TARGET_MEM_REF - || !TMR_INDEX (base1)) + || (!TMR_INDEX (base1) && !TMR_INDEX2 (base1))) && (TREE_CODE (base2) != TARGET_MEM_REF - || !TMR_INDEX (base2))) + || (!TMR_INDEX (base2) && !TMR_INDEX2 (base2)))) || (TREE_CODE (base1) == TARGET_MEM_REF && TREE_CODE (base2) == TARGET_MEM_REF && (TMR_STEP (base1) == TMR_STEP (base2) || (TMR_STEP (base1) && TMR_STEP (base2) && operand_equal_p (TMR_STEP (base1), TMR_STEP (base2), 0))) - && operand_equal_p (TMR_INDEX (base1), TMR_INDEX (base2), 0)))) + && (TMR_INDEX (base1) == TMR_INDEX (base2) + || (TMR_INDEX (base1) && TMR_INDEX (base2) + && operand_equal_p (TMR_INDEX (base1), + TMR_INDEX (base2), 0))) + && (TMR_INDEX2 (base1) == TMR_INDEX2 (base2) + || (TMR_INDEX2 (base1) && TMR_INDEX2 (base2) + && operand_equal_p (TMR_INDEX2 (base1), + TMR_INDEX2 (base2), 0)))))) { /* The offset embedded in MEM_REFs can be negative. Bias them so that the resulting offset adjustment is positive. */ |