summaryrefslogtreecommitdiff
path: root/gcc/tree-loop-linear.c
diff options
context:
space:
mode:
authorspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-14 23:23:24 +0000
committerspop <spop@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-14 23:23:24 +0000
commit28d4f5a1a67f31e3e69b696c8d3d8f5a123a1322 (patch)
treed21c23b85fba4827eae8894e489ee403c78576ed /gcc/tree-loop-linear.c
parentd44eb2e37e1f1f2c1871d751dc3c0947a95055e2 (diff)
downloadgcc-28d4f5a1a67f31e3e69b696c8d3d8f5a123a1322.tar.gz
* tree-loop-linear.c (gather_interchange_stats): For multidimensional
arrays, multiply the access strides by the size of the sub-array. * testsuite/gcc.dg/tree-ssa/ltrans-5.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@122935 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-loop-linear.c')
-rw-r--r--gcc/tree-loop-linear.c22
1 files changed, 14 insertions, 8 deletions
diff --git a/gcc/tree-loop-linear.c b/gcc/tree-loop-linear.c
index 61fdee3f068..94f3d59f753 100644
--- a/gcc/tree-loop-linear.c
+++ b/gcc/tree-loop-linear.c
@@ -134,24 +134,30 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
for (i = 0; VEC_iterate (data_reference_p, datarefs, i, dr); i++)
{
unsigned int it;
+ tree ref = DR_REF (dr);
tree stmt = DR_STMT (dr);
struct loop *stmt_loop = loop_containing_stmt (stmt);
struct loop *inner_loop = first_loop->inner;
-
+
if (inner_loop != stmt_loop
&& !flow_loop_nested_p (inner_loop, stmt_loop))
continue;
- for (it = 0; it < DR_NUM_DIMENSIONS (dr); it++)
+
+ for (it = 0; it < DR_NUM_DIMENSIONS (dr);
+ it++, ref = TREE_OPERAND (ref, 0))
{
tree chrec = DR_ACCESS_FN (dr, it);
- tree tstride = evolution_part_in_loop_num
- (chrec, loop->num);
-
+ tree tstride = evolution_part_in_loop_num (chrec, loop->num);
+ tree array_size = TYPE_SIZE (TREE_TYPE (ref));
+
if (tstride == NULL_TREE
- || TREE_CODE (tstride) != INTEGER_CST)
+ || array_size == NULL_TREE
+ || TREE_CODE (tstride) != INTEGER_CST
+ || TREE_CODE (array_size) != INTEGER_CST)
continue;
-
- (*access_strides) += int_cst_value (tstride);
+
+ (*access_strides) +=
+ int_cst_value (array_size) * int_cst_value (tstride);
}
}
}