summaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-19 14:26:13 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-19 14:26:13 +0000
commit9488020c72a0d42c510afbf50ec7b2d9e87755fd (patch)
tree344cbc6a924b0938fd46d8936660a382d88f1139 /gcc/tree-data-ref.c
parentaff5fb4dd5c1a7a34b1dc1fd6d5f3bdc8335e14f (diff)
downloadgcc-9488020c72a0d42c510afbf50ec7b2d9e87755fd.tar.gz
2011-08-19 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50067 * tree-data-ref.c (dr_analyze_indices): Simplify, strip MEM_REF offset only if we accounted for it. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@177903 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 51badb48dd9..f7c7ae5e45a 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -863,17 +863,20 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
}
if (nest
- && (INDIRECT_REF_P (aref)
- || TREE_CODE (aref) == MEM_REF))
+ && TREE_CODE (aref) == MEM_REF)
{
op = TREE_OPERAND (aref, 0);
access_fn = analyze_scalar_evolution (loop, op);
access_fn = instantiate_scev (before_loop, loop, access_fn);
base = initial_condition (access_fn);
split_constant_offset (base, &base, &off);
- if (TREE_CODE (aref) == MEM_REF)
- off = size_binop (PLUS_EXPR, off,
- fold_convert (ssizetype, TREE_OPERAND (aref, 1)));
+ if (!integer_zerop (TREE_OPERAND (aref, 1)))
+ {
+ off = size_binop (PLUS_EXPR, off,
+ fold_convert (ssizetype, TREE_OPERAND (aref, 1)));
+ TREE_OPERAND (aref, 1)
+ = build_int_cst (TREE_TYPE (TREE_OPERAND (aref, 1)), 0);
+ }
access_fn = chrec_replace_initial_condition (access_fn,
fold_convert (TREE_TYPE (base), off));
@@ -881,10 +884,6 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
VEC_safe_push (tree, heap, access_fns, access_fn);
}
- if (TREE_CODE (aref) == MEM_REF)
- TREE_OPERAND (aref, 1)
- = build_int_cst (TREE_TYPE (TREE_OPERAND (aref, 1)), 0);
-
if (TREE_CODE (ref) == MEM_REF
&& TREE_CODE (TREE_OPERAND (ref, 0)) == ADDR_EXPR
&& integer_zerop (TREE_OPERAND (ref, 1)))