summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-im.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-ssa-loop-im.c')
-rw-r--r--gcc/tree-ssa-loop-im.c34
1 files changed, 3 insertions, 31 deletions
diff --git a/gcc/tree-ssa-loop-im.c b/gcc/tree-ssa-loop-im.c
index 8740030397f..2336263b499 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)