aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-chrec.h
diff options
context:
space:
mode:
authorSebastian Pop <sebastian.pop@inria.fr>2007-04-11 02:09:35 +0200
committerSebastian Pop <spop@gcc.gnu.org>2007-04-11 00:09:35 +0000
commite9793dae58b5eaa6bf0a939be473f98dd83719f6 (patch)
tree0fa302f4379fe52efe787effc1171e8bc6322e1e /gcc/tree-chrec.h
parent0334147da1db614a99d09fe96a065b5eceae4d69 (diff)
downloadgcc-e9793dae58b5eaa6bf0a939be473f98dd83719f6.zip
gcc-e9793dae58b5eaa6bf0a939be473f98dd83719f6.tar.gz
gcc-e9793dae58b5eaa6bf0a939be473f98dd83719f6.tar.bz2
re PR tree-optimization/31343 (ICE in data-refs dependence testing)
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. From-SVN: r123708
Diffstat (limited to 'gcc/tree-chrec.h')
-rw-r--r--gcc/tree-chrec.h35
1 files changed, 16 insertions, 19 deletions
diff --git a/gcc/tree-chrec.h b/gcc/tree-chrec.h
index c22867b..95c6f38 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