diff options
author | Bin Cheng <bin.cheng@linux.alibaba.com> | 2019-04-23 03:54:59 +0000 |
---|---|---|
committer | Bin Cheng <amker@gcc.gnu.org> | 2019-04-23 03:54:59 +0000 |
commit | 9e14603dfeba1fc1d54f2373de20eea7469ee0c3 (patch) | |
tree | f859612eaba12970593f1be51bca49c98d577ba7 | |
parent | 6e8fc175bda51464ac124fcf20df62fd19801203 (diff) | |
download | gcc-9e14603dfeba1fc1d54f2373de20eea7469ee0c3.zip gcc-9e14603dfeba1fc1d54f2373de20eea7469ee0c3.tar.gz gcc-9e14603dfeba1fc1d54f2373de20eea7469ee0c3.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr90021.f90 | 21 | ||||
-rw-r--r-- | gcc/tree-chrec.c | 24 | ||||
-rw-r--r-- | gcc/tree-chrec.h | 2 | ||||
-rw-r--r-- | gcc/tree-data-ref.c | 2 |
6 files changed, 54 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d244681..e52b4c4 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e22996f..e855e15 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +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 diff --git a/gcc/testsuite/gfortran.dg/pr90021.f90 b/gcc/testsuite/gfortran.dg/pr90021.f90 new file mode 100644 index 0000000..4689e8b --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr90021.f90 @@ -0,0 +1,21 @@ +! { 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 diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 8b5371a..813b87f 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -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; diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h index 258b5d5..dbbc1b1 100644 --- a/gcc/tree-chrec.h +++ b/gcc/tree-chrec.h @@ -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); diff --git a/gcc/tree-data-ref.c b/gcc/tree-data-ref.c index 51da181..ccb1cfc 100644 --- a/gcc/tree-data-ref.c +++ b/gcc/tree-data-ref.c @@ -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) { |