diff options
author | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-11 00:09:35 +0000 |
---|---|---|
committer | spop <spop@138bc75d-0d04-0410-961f-82ee72b054a4> | 2007-04-11 00:09:35 +0000 |
commit | 3e6bc865e88020ba2650605936bff3dd57947f99 (patch) | |
tree | 0fa302f4379fe52efe787effc1171e8bc6322e1e /gcc/tree-chrec.h | |
parent | b2a72faeda2b6f88f9de7525da970f83451424f7 (diff) | |
download | gcc-3e6bc865e88020ba2650605936bff3dd57947f99.tar.gz |
PR tree-optimization/31343
* tree-chrec.h (chrec_zerop): Moved before build_polynomial_chrec.
(build_polynomial_chrec): Return a scalar when the evolution is zero.
* testsuite/gcc.dg/vect/pr31343.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123708 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-chrec.h')
-rw-r--r-- | gcc/tree-chrec.h | 35 |
1 files changed, 16 insertions, 19 deletions
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h index c22867ba0d2..95c6f384dde 100644 --- a/gcc/tree-chrec.h +++ b/gcc/tree-chrec.h @@ -84,7 +84,19 @@ extern bool evolution_function_is_affine_multivariate_p (tree); extern bool evolution_function_is_univariate_p (tree); extern unsigned nb_vars_in_chrec (tree); - +/* Determines whether CHREC is equal to zero. */ + +static inline bool +chrec_zerop (tree chrec) +{ + if (chrec == NULL_TREE) + return false; + + if (TREE_CODE (chrec) == INTEGER_CST) + return integer_zerop (chrec); + + return false; +} /* Build a polynomial chain of recurrence. */ @@ -99,28 +111,13 @@ build_polynomial_chrec (unsigned loop_num, gcc_assert (TREE_TYPE (left) == TREE_TYPE (right)); + if (chrec_zerop (right)) + return left; + return build3 (POLYNOMIAL_CHREC, TREE_TYPE (left), build_int_cst (NULL_TREE, loop_num), left, right); } - - -/* Observers. */ - -/* Determines whether CHREC is equal to zero. */ - -static inline bool -chrec_zerop (tree chrec) -{ - if (chrec == NULL_TREE) - return false; - - if (TREE_CODE (chrec) == INTEGER_CST) - return integer_zerop (chrec); - - return false; -} - /* Determines whether the expression CHREC is a constant. */ static inline bool |