Commit 9e14603d by Bin Cheng Committed by Bin Cheng

re PR tree-optimization/90021 (ICE in index_in_loop_nest, at tree-data-ref.h:587 since r270203)

	PR tree-optimization/92001
	* tree-chrec.c (evolution_function_is_univariate_p): New parameter
	and check univariate against it.
	* tree-chrec.h (evolution_function_is_univariate_p): New parameter.
	* tree-data-ref.c (add_other_self_distances): Pass new argument.

	gcc/testsuite
	* gcc/testsuite/gfortran.dg/pr90021.f90: New test.

From-SVN: r270499
parent 6e8fc175
2019-04-23 Bin Cheng <bin.cheng@linux.alibaba.com>
PR tree-optimization/92001
* tree-chrec.c (evolution_function_is_univariate_p): New parameter
and check univariate against it.
* tree-chrec.h (evolution_function_is_univariate_p): New parameter.
* tree-data-ref.c (add_other_self_distances): Pass new argument.
2019-04-21 H.J. Lu <hongjiu.lu@intel.com>
PR target/90178
......
2018-04-23 Bin Cheng <bin.cheng@linux.alibaba.com>
PR tree-optimization/92001
* gcc/testsuite/gfortran.dg/pr90021.f90: New test.
2019-04-22 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/90166
......
! { dg-do compile }
! { dg-options "-fno-tree-loop-ivcanon -O1 -floop-interchange -fno-tree-ccp -fno-tree-ch -fipa-pta" }
! PR tree-optimization/90021
MODULE a
INTEGER b
CONTAINS
SUBROUTINE bar(c)
REAL c(1)
INTEGER g, d, e, f
DO g = 1,3
DO f = 1,1
DO e = 1,3
DO d = 1,1
c(f-1+d) = c(f-1+d)*b
END DO
END DO
END DO
END DO
END
END
......@@ -1142,23 +1142,30 @@ evolution_function_is_affine_multivariate_p (const_tree chrec, int loopnum)
}
/* Determine whether the given tree is a function in zero or one
variables. */
variables with respect to loop specified by LOOPNUM. Note only positive
LOOPNUM stands for a real loop. */
bool
evolution_function_is_univariate_p (const_tree chrec)
evolution_function_is_univariate_p (const_tree chrec, int loopnum)
{
if (chrec == NULL_TREE)
return true;
tree sub_chrec;
switch (TREE_CODE (chrec))
{
case POLYNOMIAL_CHREC:
switch (TREE_CODE (CHREC_LEFT (chrec)))
{
case POLYNOMIAL_CHREC:
if (CHREC_VARIABLE (chrec) != CHREC_VARIABLE (CHREC_LEFT (chrec)))
sub_chrec = CHREC_LEFT (chrec);
if (CHREC_VARIABLE (chrec) != CHREC_VARIABLE (sub_chrec)
&& (loopnum <= 0
|| CHREC_VARIABLE (sub_chrec) == (unsigned) loopnum
|| flow_loop_nested_p (get_loop (cfun, loopnum),
get_chrec_loop (sub_chrec))))
return false;
if (!evolution_function_is_univariate_p (CHREC_LEFT (chrec)))
if (!evolution_function_is_univariate_p (sub_chrec, loopnum))
return false;
break;
......@@ -1171,9 +1178,14 @@ evolution_function_is_univariate_p (const_tree chrec)
switch (TREE_CODE (CHREC_RIGHT (chrec)))
{
case POLYNOMIAL_CHREC:
if (CHREC_VARIABLE (chrec) != CHREC_VARIABLE (CHREC_RIGHT (chrec)))
sub_chrec = CHREC_RIGHT (chrec);
if (CHREC_VARIABLE (chrec) != CHREC_VARIABLE (sub_chrec)
&& (loopnum <= 0
|| CHREC_VARIABLE (sub_chrec) == (unsigned) loopnum
|| flow_loop_nested_p (get_loop (cfun, loopnum),
get_chrec_loop (sub_chrec))))
return false;
if (!evolution_function_is_univariate_p (CHREC_RIGHT (chrec)))
if (!evolution_function_is_univariate_p (sub_chrec, loopnum))
return false;
break;
......
......@@ -85,7 +85,7 @@ extern bool chrec_contains_symbols_defined_in_loop (const_tree, unsigned);
extern bool chrec_contains_undetermined (const_tree);
extern bool tree_contains_chrecs (const_tree, int *);
extern bool evolution_function_is_affine_multivariate_p (const_tree, int);
extern bool evolution_function_is_univariate_p (const_tree);
extern bool evolution_function_is_univariate_p (const_tree, int = 0);
extern unsigned nb_vars_in_chrec (tree);
extern bool evolution_function_is_invariant_p (tree, int);
extern bool scev_is_linear_expression (tree);
......
......@@ -4431,7 +4431,7 @@ add_other_self_distances (struct data_dependence_relation *ddr)
if (TREE_CODE (access_fun) == POLYNOMIAL_CHREC)
{
if (!evolution_function_is_univariate_p (access_fun))
if (!evolution_function_is_univariate_p (access_fun, loop->num))
{
if (DDR_NUM_SUBSCRIPTS (ddr) != 1)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment