diff options
author | Bin Cheng <bin.cheng@linux.alibaba.com> | 2019-04-08 11:52:18 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-04-08 11:52:18 +0000 |
commit | d6366157deac0b526ce7ecfd2821745eecce06c8 (patch) | |
tree | 3042ff24ef928ab4c8b2ad26e74939b33f07787b /gcc/tree-chrec.c | |
parent | 145f764aae16c101baf41c815abe99353fcf797d (diff) | |
download | gcc-d6366157deac0b526ce7ecfd2821745eecce06c8.zip gcc-d6366157deac0b526ce7ecfd2821745eecce06c8.tar.gz gcc-d6366157deac0b526ce7ecfd2821745eecce06c8.tar.bz2 |
re PR middle-end/89725 (ICE in get_fnname_from_decl, at varasm.c:1723)
2019-04-01 Bin Cheng <bin.cheng@linux.alibaba.com>
PR tree-optimization/89725
* tree-chrec.c (chrec_contains_symbols): New parameter. Handle outer
loop's chrec as invariant symbol.
* tree-chrec.h (chrec_contains_symbols): New parameter.
* tree-data-ref.c (analyze_miv_subscript): Pass new argument.
(build_classic_dist_vector_1, add_other_self_distances): Bypass access
function of loops not in DDR's loop_nest.
* tree-data-ref.h (index_in_loop_nest): Add unreachable check.
* gcc.dg/tree-ssa/pr89725.c: New test.
From-SVN: r270203
Diffstat (limited to 'gcc/tree-chrec.c')
-rw-r--r-- | gcc/tree-chrec.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/gcc/tree-chrec.c b/gcc/tree-chrec.c index 3987041..8b5371a 100644 --- a/gcc/tree-chrec.c +++ b/gcc/tree-chrec.c @@ -932,10 +932,12 @@ is_multivariate_chrec (const_tree chrec) return false; } -/* Determines whether the chrec contains symbolic names or not. */ +/* Determines whether the chrec contains symbolic names or not. If LOOP isn't + NULL, we also consider chrec wrto outer loops of LOOP as symbol. */ static bool -chrec_contains_symbols (const_tree chrec, hash_set<const_tree> &visited) +chrec_contains_symbols (const_tree chrec, hash_set<const_tree> &visited, + struct loop *loop) { int i, n; @@ -952,18 +954,28 @@ chrec_contains_symbols (const_tree chrec, hash_set<const_tree> &visited) || TREE_CODE (chrec) == FIELD_DECL) return true; + if (loop != NULL + && TREE_CODE (chrec) == POLYNOMIAL_CHREC + && flow_loop_nested_p (get_chrec_loop (chrec), loop)) + return true; + n = TREE_OPERAND_LENGTH (chrec); for (i = 0; i < n; i++) - if (chrec_contains_symbols (TREE_OPERAND (chrec, i), visited)) + if (chrec_contains_symbols (TREE_OPERAND (chrec, i), visited, loop)) return true; return false; } +/* Return true if CHREC contains any symbols. If LOOP is not NULL, check if + CHREC contains any chrec which is invariant wrto the loop (nest), in other + words, chrec defined by outer loops of loop, so from LOOP's point of view, + the chrec is considered as a SYMBOL. */ + bool -chrec_contains_symbols (const_tree chrec) +chrec_contains_symbols (const_tree chrec, struct loop* loop) { hash_set<const_tree> visited; - return chrec_contains_symbols (chrec, visited); + return chrec_contains_symbols (chrec, visited, loop); } /* Determines whether the chrec contains undetermined coefficients. */ |