+ }
+
+ return chrec ? chrec : fold_build1 (code, type, op0);
+}
+
+/* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW
+ and EVOLUTION_LOOP, that were left under a symbolic form.
+
+ CHREC is an expression with 3 operands to be instantiated.
+
+ CACHE is the cache of already instantiated values.
+
+ FOLD_CONVERSIONS should be set to true when the conversions that
+ may wrap in signed/pointer type are folded, as long as the value of
+ the chrec is preserved.
+
+ SIZE_EXPR is used for computing the size of the expression to be
+ instantiated, and to stop if it exceeds some limit. */
+
+static tree
+instantiate_scev_3 (basic_block instantiate_below,
+ struct loop *evolution_loop, tree chrec,
+ bool fold_conversions, htab_t cache, int size_expr)
+{
+ tree op1, op2;
+ tree op0 = instantiate_scev_r (instantiate_below, evolution_loop,
+ TREE_OPERAND (chrec, 0),
+ fold_conversions, cache, size_expr);
+ if (op0 == chrec_dont_know)
+ return chrec_dont_know;
+
+ op1 = instantiate_scev_r (instantiate_below, evolution_loop,
+ TREE_OPERAND (chrec, 1),
+ fold_conversions, cache, size_expr);
+ if (op1 == chrec_dont_know)
+ return chrec_dont_know;
+
+ op2 = instantiate_scev_r (instantiate_below, evolution_loop,
+ TREE_OPERAND (chrec, 2),
+ fold_conversions, cache, size_expr);
+ if (op2 == chrec_dont_know)
+ return chrec_dont_know;
+
+ if (op0 == TREE_OPERAND (chrec, 0)
+ && op1 == TREE_OPERAND (chrec, 1)
+ && op2 == TREE_OPERAND (chrec, 2))
+ return chrec;
+
+ return fold_build3 (TREE_CODE (chrec),
+ TREE_TYPE (chrec), op0, op1, op2);
+}
+
+/* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW
+ and EVOLUTION_LOOP, that were left under a symbolic form.
+
+ CHREC is an expression with 2 operands to be instantiated.
+
+ CACHE is the cache of already instantiated values.
+
+ FOLD_CONVERSIONS should be set to true when the conversions that
+ may wrap in signed/pointer type are folded, as long as the value of
+ the chrec is preserved.
+
+ SIZE_EXPR is used for computing the size of the expression to be
+ instantiated, and to stop if it exceeds some limit. */
+
+static tree
+instantiate_scev_2 (basic_block instantiate_below,
+ struct loop *evolution_loop, tree chrec,
+ bool fold_conversions, htab_t cache, int size_expr)
+{
+ tree op1;
+ tree op0 = instantiate_scev_r (instantiate_below, evolution_loop,
+ TREE_OPERAND (chrec, 0),
+ fold_conversions, cache, size_expr);
+ if (op0 == chrec_dont_know)
+ return chrec_dont_know;
+
+ op1 = instantiate_scev_r (instantiate_below, evolution_loop,
+ TREE_OPERAND (chrec, 1),
+ fold_conversions, cache, size_expr);
+ if (op1 == chrec_dont_know)
+ return chrec_dont_know;
+
+ if (op0 == TREE_OPERAND (chrec, 0)
+ && op1 == TREE_OPERAND (chrec, 1))
+ return chrec;
+
+ return fold_build2 (TREE_CODE (chrec), TREE_TYPE (chrec), op0, op1);
+}
+
+/* Analyze all the parameters of the chrec, between INSTANTIATE_BELOW
+ and EVOLUTION_LOOP, that were left under a symbolic form.
+
+ CHREC is an expression with 2 operands to be instantiated.