diff options
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. */ |