summaryrefslogtreecommitdiff
path: root/gcc/tree-chrec.h
diff options
context:
space:
mode:
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 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