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 /gcc/tree-chrec.c | |
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
Diffstat (limited to 'gcc/tree-chrec.c')
-rw-r--r-- | gcc/tree-chrec.c | 24 |
1 files changed, 18 insertions, 6 deletions
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; |