diff options
author | Richard Guenther <rguenther@suse.de> | 2008-05-22 10:32:55 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2008-05-22 10:32:55 +0000 |
commit | 1842e4d44ec1023a2c7f74ccfae56a91f858d759 (patch) | |
tree | c10b9f776be672e50cfb69db5d6ee71cb80cf2c5 /gcc/tree-ssa-loop-im.c | |
parent | 3f9f247417d7704a6b7808ec14a4ab67d55e9f07 (diff) | |
download | gcc-1842e4d44ec1023a2c7f74ccfae56a91f858d759.zip gcc-1842e4d44ec1023a2c7f74ccfae56a91f858d759.tar.gz gcc-1842e4d44ec1023a2c7f74ccfae56a91f858d759.tar.bz2 |
tree-dfa.c (refs_may_alias_p): Exit early if possible.
2008-05-22 Richard Guenther <rguenther@suse.de>
* tree-dfa.c (refs_may_alias_p): Exit early if possible. Handle
more cases of offset disambiguation that is possible if
strict-aliasing rules apply.
* tree-ssa-loop-im.c (mem_refs_may_alias_p): Use refs_may_alias_p
for basic offset and type-based disambiguation.
* gcc.dg/tree-ssa/alias-18.c: New testcase.
From-SVN: r135754
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r-- | gcc/tree-ssa-loop-im.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c index 8740030..2336263 100644 --- a/gcc/tree-ssa-loop-im.c +++ b/gcc/tree-ssa-loop-im.c @@ -1617,41 +1617,13 @@ mem_refs_may_alias_p (tree mem1, tree mem2, struct pointer_map_t **ttae_cache) /* Perform BASE + OFFSET analysis -- if MEM1 and MEM2 are based on the same object and their offset differ in such a way that the locations cannot overlap, then they cannot alias. */ - aff_tree off1, off2; double_int size1, size2; - tree base1, base2; - - /* If MEM1 and MEM2 are based on different variables, they cannot alias. */ - base1 = get_base_address (mem1); - base2 = get_base_address (mem2); + aff_tree off1, off2; - if (base1 - && !INDIRECT_REF_P (base1) - && base2 - && !INDIRECT_REF_P (base2) - && !operand_equal_p (base1, base2, 0)) + /* Perform basic offset and type-based disambiguation. */ + if (!refs_may_alias_p (mem1, mem2)) return false; - /* With strict aliasing, it is impossible to access a scalar variable through - anything but a pointer dereference or through a union (gcc extension). */ - if (flag_strict_aliasing) - { - if (!INDIRECT_REF_P (mem1) - && base1 - && TREE_CODE (TREE_TYPE (base1)) != UNION_TYPE - && SSA_VAR_P (mem2) - && !AGGREGATE_TYPE_P (TREE_TYPE (mem2))) - return false; - if (!INDIRECT_REF_P (mem2) - && base2 - && TREE_CODE (TREE_TYPE (base2)) != UNION_TYPE - && SSA_VAR_P (mem1) - && !AGGREGATE_TYPE_P (TREE_TYPE (mem1))) - return false; - if (!alias_sets_conflict_p (get_alias_set (mem1), get_alias_set (mem2))) - return false; - } - /* The expansion of addresses may be a bit expensive, thus we only do the check at -O2 and higher optimization levels. */ if (optimize < 2) |