summaryrefslogtreecommitdiff
path: root/gcc/tree-data-ref.c
diff options
context:
space:
mode:
authorrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-24 10:07:20 +0000
committerrguenth <rguenth@138bc75d-0d04-0410-961f-82ee72b054a4>2011-08-24 10:07:20 +0000
commit0f00ec21dbd0d077473f2fc0a97f13e733a415d2 (patch)
treefc7988f1e91f1893a1dc187b191cac060c088615 /gcc/tree-data-ref.c
parente2089de66810846f898942950fb8e2f8e888da10 (diff)
downloadgcc-0f00ec21dbd0d077473f2fc0a97f13e733a415d2.tar.gz
2011-08-24 Richard Guenther <rguenther@suse.de>
PR tree-optimization/50067 * tree-data-ref.c (dr_analyze_indices): Do not add an access function for a MEM_REF base that has no evolution in the loop nest or that is not analyzable. * gcc.dg/torture/pr50067-3.c: New testcase. * gcc.dg/torture/pr50067-4.c: Likewise. * gcc.dg/torture/pr50067-5.c: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178028 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-data-ref.c')
-rw-r--r--gcc/tree-data-ref.c31
1 files changed, 19 insertions, 12 deletions
diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c
index 2c488ab400d..fe2be57d1c5 100644
--- a/gcc/tree-data-ref.c
+++ b/gcc/tree-data-ref.c
@@ -881,25 +881,32 @@ dr_analyze_indices (struct data_reference *dr, loop_p nest, loop_p loop)
aref = TREE_OPERAND (aref, 0);
}
+ /* If the address operand of a MEM_REF base has an evolution in the
+ analyzed nest, add it as an additional independent access-function. */
if (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 (!integer_zerop (TREE_OPERAND (aref, 1)))
+ if (TREE_CODE (access_fn) == POLYNOMIAL_CHREC)
{
- 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);
+ base = initial_condition (access_fn);
+ split_constant_offset (base, &base, &off);
+ /* Fold the MEM_REF offset into the evolutions initial
+ value to make more bases comparable. */
+ 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));
+ TREE_OPERAND (aref, 0) = base;
+ VEC_safe_push (tree, heap, access_fns, access_fn);
}
- access_fn = chrec_replace_initial_condition (access_fn,
- fold_convert (TREE_TYPE (base), off));
-
- TREE_OPERAND (aref, 0) = base;
- VEC_safe_push (tree, heap, access_fns, access_fn);
}
if (TREE_CODE (ref) == MEM_REF