re PR tree-optimization/31183 (ICE in int_cst_value, at tree.c:7684 with -O3 -ftree-loop-linear)

PR tree-optimization/31183
	* tree-loop-linear.c (gather_interchange_stats, try_interchange_loops): 
	Use double_int instead of unsigned int for representing access_strides.
	* testsuite/gcc.dg/tree-ssa/pr31183.c: New.

From-SVN: r122988
This commit is contained in:
Sebastian Pop 2007-03-16 12:30:48 +01:00 committed by Sebastian Pop
parent 945a98a4b2
commit a9549792d3
3 changed files with 29 additions and 6 deletions

View File

@ -1,3 +1,10 @@
2007-03-16 Sebastian Pop <sebastian.pop@inria.fr>
PR tree-optimization/31183
* tree-loop-linear.c (gather_interchange_stats, try_interchange_loops):
Use double_int instead of unsigned int for representing access_strides.
* testsuite/gcc.dg/tree-ssa/pr31183.c: New.
2007-03-16 Richard Guenther <rguenther@suse.de>
PR tree-optimization/31146

View File

@ -0,0 +1,14 @@
/* { dg-do compile } */
/* { dg-options "-O2 -ftree-loop-linear" } */
int buf[256 * 9];
int f()
{
int i, j;
for (i = 0; i < 256; ++i)
for (j = 0; j < 8; ++j)
buf[j + 1] = buf[j] + 1;
return buf[10];
}

View File

@ -95,7 +95,7 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
struct loop *first_loop,
unsigned int *dependence_steps,
unsigned int *nb_deps_not_carried_by_loop,
unsigned int *access_strides)
double_int *access_strides)
{
unsigned int i, j;
struct data_dependence_relation *ddr;
@ -103,7 +103,7 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
*dependence_steps = 0;
*nb_deps_not_carried_by_loop = 0;
*access_strides = 0;
*access_strides = double_int_zero;
for (i = 0; VEC_iterate (ddr_p, dependence_relations, i, ddr); i++)
{
@ -149,6 +149,7 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
tree chrec = DR_ACCESS_FN (dr, it);
tree tstride = evolution_part_in_loop_num (chrec, loop->num);
tree array_size = TYPE_SIZE (TREE_TYPE (ref));
double_int dstride;
if (tstride == NULL_TREE
|| array_size == NULL_TREE
@ -156,8 +157,9 @@ gather_interchange_stats (VEC (ddr_p, heap) *dependence_relations,
|| TREE_CODE (array_size) != INTEGER_CST)
continue;
(*access_strides) +=
int_cst_value (array_size) * int_cst_value (tstride);
dstride = double_int_mul (tree_to_double_int (array_size),
tree_to_double_int (tstride));
(*access_strides) = double_int_add (*access_strides, dstride);
}
}
}
@ -180,7 +182,7 @@ try_interchange_loops (lambda_trans_matrix trans,
struct loop *loop_i;
struct loop *loop_j;
unsigned int dependence_steps_i, dependence_steps_j;
unsigned int access_strides_i, access_strides_j;
double_int access_strides_i, access_strides_j;
unsigned int nb_deps_not_carried_by_i, nb_deps_not_carried_by_j;
struct data_dependence_relation *ddr;
@ -225,7 +227,7 @@ try_interchange_loops (lambda_trans_matrix trans,
*/
if (dependence_steps_i < dependence_steps_j
|| nb_deps_not_carried_by_i > nb_deps_not_carried_by_j
|| access_strides_i < access_strides_j)
|| double_int_ucmp (access_strides_i, access_strides_j) < 0)
{
lambda_matrix_row_exchange (LTM_MATRIX (trans),
loop_i->depth - first_loop->depth,