Commit 5212068f by Nathan Sidwell Committed by Nathan Sidwell

builtins.c (fold_builtin_strchr): Use build_int_cst, not fold_convert.

	* builtins.c (fold_builtin_strchr): Use build_int_cst, not
	fold_convert.
	(fold_builtin_strpbrk): Likewise.
	* expr.c (array_ref_low_bound): Likewise.
	* tree-scalar-evolution.c (chrec_is_positive, add_to_evolution_1,
	interpret_rhs_modify_expr, number_of_iterations_in_loop): Likewise.
	* tree-sra.c (generate_element_zero): Likewise.
	* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
	* tree-ssa-loop-ivopts.c (determine_biv_step, idx_find_step,
	add_old_iv_candidates, add_iv_candidates): Likewise.
	* tree-tailcall.c (tree_optimize_tail_calls_1): Likewise.

From-SVN: r87141
parent 366de0ce
2004-09-07 Nathan Sidwell <nathan@codesourcery.com> 2004-09-07 Nathan Sidwell <nathan@codesourcery.com>
* builtins.c (fold_builtin_strchr): Use build_int_cst, not
fold_convert.
(fold_builtin_strpbrk): Likewise.
* expr.c (array_ref_low_bound): Likewise.
* tree-scalar-evolution.c (chrec_is_positive, add_to_evolution_1,
interpret_rhs_modify_expr, number_of_iterations_in_loop): Likewise.
* tree-sra.c (generate_element_zero): Likewise.
* tree-ssa-dom.c (simplify_rhs_and_lookup_avail_expr): Likewise.
* tree-ssa-loop-ivopts.c (determine_biv_step, idx_find_step,
add_old_iv_candidates, add_iv_candidates): Likewise.
* tree-tailcall.c (tree_optimize_tail_calls_1): Likewise.
2004-09-07 Nathan Sidwell <nathan@codesourcery.com>
* c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable. * c-aux-info.c (gen_type): Use gcc_assert or gcc_unreachable.
* c-common.c (c_type_hash, c_common_nodes_and_builtins, * c-common.c (c_type_hash, c_common_nodes_and_builtins,
c_expand_expr, boolean_increment, nonnull_check_p, c_expand_expr, boolean_increment, nonnull_check_p,
......
...@@ -7210,12 +7210,11 @@ fold_builtin_strchr (tree exp, bool actually_strrchr) ...@@ -7210,12 +7210,11 @@ fold_builtin_strchr (tree exp, bool actually_strrchr)
r = actually_strrchr ? strrchr (p1, c) : strchr (p1, c); r = actually_strrchr ? strrchr (p1, c) : strchr (p1, c);
if (r == NULL) if (r == NULL)
return fold_convert (TREE_TYPE (s1), integer_zero_node); return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */ /* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1), return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
s1, fold_convert (TREE_TYPE (s1), s1, build_int_cst (TREE_TYPE (s1), r - p1)));
ssize_int (r - p1))));
} }
if (actually_strrchr) if (actually_strrchr)
...@@ -8645,12 +8644,11 @@ simplify_builtin_strstr (tree arglist) ...@@ -8645,12 +8644,11 @@ simplify_builtin_strstr (tree arglist)
const char *r = strstr (p1, p2); const char *r = strstr (p1, p2);
if (r == NULL) if (r == NULL)
return fold_convert (TREE_TYPE (s1), integer_zero_node); return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */ /* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1), return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
s1, fold_convert (TREE_TYPE (s1), s1, build_int_cst (TREE_TYPE (s1), r - p1)));
ssize_int (r - p1))));
} }
if (p2[0] == '\0') if (p2[0] == '\0')
...@@ -8714,12 +8712,11 @@ simplify_builtin_strchr (tree arglist) ...@@ -8714,12 +8712,11 @@ simplify_builtin_strchr (tree arglist)
r = strchr (p1, c); r = strchr (p1, c);
if (r == NULL) if (r == NULL)
return fold_convert (TREE_TYPE (s1), integer_zero_node); return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */ /* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1), return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
s1, fold_convert (TREE_TYPE (s1), s1, build_int_cst (TREE_TYPE (s1), r - p1)));
ssize_int (r - p1))));
} }
/* FIXME: Should use here strchrM optab so that ports can optimize /* FIXME: Should use here strchrM optab so that ports can optimize
...@@ -8771,12 +8768,11 @@ simplify_builtin_strrchr (tree arglist) ...@@ -8771,12 +8768,11 @@ simplify_builtin_strrchr (tree arglist)
r = strrchr (p1, c); r = strrchr (p1, c);
if (r == NULL) if (r == NULL)
return fold_convert (TREE_TYPE (s1), integer_zero_node); return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */ /* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1), return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
s1, fold_convert (TREE_TYPE (s1), s1, build_int_cst (TREE_TYPE (s1), r - p1)));
ssize_int (r - p1))));
} }
if (! integer_zerop (s2)) if (! integer_zerop (s2))
...@@ -8829,12 +8825,11 @@ simplify_builtin_strpbrk (tree arglist) ...@@ -8829,12 +8825,11 @@ simplify_builtin_strpbrk (tree arglist)
const char *r = strpbrk (p1, p2); const char *r = strpbrk (p1, p2);
if (r == NULL) if (r == NULL)
return fold_convert (TREE_TYPE (s1), integer_zero_node); return build_int_cst (TREE_TYPE (s1), 0);
/* Return an offset into the constant string argument. */ /* Return an offset into the constant string argument. */
return fold (build2 (PLUS_EXPR, TREE_TYPE (s1), return fold (build2 (PLUS_EXPR, TREE_TYPE (s1),
s1, fold_convert (TREE_TYPE (s1), s1, build_int_cst (TREE_TYPE (s1), r - p1)));
ssize_int (r - p1))));
} }
if (p2[0] == '\0') if (p2[0] == '\0')
......
...@@ -5514,7 +5514,7 @@ array_ref_low_bound (tree exp) ...@@ -5514,7 +5514,7 @@ array_ref_low_bound (tree exp)
return SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_MIN_VALUE (domain_type), exp); return SUBSTITUTE_PLACEHOLDER_IN_EXPR (TYPE_MIN_VALUE (domain_type), exp);
/* Otherwise, return a zero of the appropriate type. */ /* Otherwise, return a zero of the appropriate type. */
return fold_convert (TREE_TYPE (TREE_OPERAND (exp, 1)), integer_zero_node); return build_int_cst (TREE_TYPE (TREE_OPERAND (exp, 1)), 0);
} }
/* Return a tree representing the upper bound of the array mentioned in /* Return a tree representing the upper bound of the array mentioned in
......
...@@ -571,7 +571,7 @@ chrec_is_positive (tree chrec, bool *value) ...@@ -571,7 +571,7 @@ chrec_is_positive (tree chrec, bool *value)
nb_iter = chrec_fold_minus nb_iter = chrec_fold_minus
(chrec_type (nb_iter), nb_iter, (chrec_type (nb_iter), nb_iter,
fold_convert (chrec_type (nb_iter), integer_one_node)); build_int_cst (chrec_type (nb_iter), 1));
#if 0 #if 0
/* TODO -- If the test is after the exit, we may decrease the number of /* TODO -- If the test is after the exit, we may decrease the number of
...@@ -579,7 +579,7 @@ chrec_is_positive (tree chrec, bool *value) ...@@ -579,7 +579,7 @@ chrec_is_positive (tree chrec, bool *value)
if (after_exit) if (after_exit)
nb_iter = chrec_fold_minus nb_iter = chrec_fold_minus
(chrec_type (nb_iter), nb_iter, (chrec_type (nb_iter), nb_iter,
fold_convert (chrec_type (nb_iter), integer_one_node)); build_int_cst (chrec_type (nb_iter), 1));
#endif #endif
end_value = chrec_apply (CHREC_VARIABLE (chrec), chrec, nb_iter); end_value = chrec_apply (CHREC_VARIABLE (chrec), chrec, nb_iter);
...@@ -704,7 +704,7 @@ add_to_evolution_1 (unsigned loop_nb, ...@@ -704,7 +704,7 @@ add_to_evolution_1 (unsigned loop_nb,
{ {
var = loop_nb; var = loop_nb;
left = chrec_before; left = chrec_before;
right = fold_convert (type, integer_zero_node); right = build_int_cst (type, 0);
} }
else else
{ {
...@@ -1748,8 +1748,7 @@ interpret_rhs_modify_expr (struct loop *loop, ...@@ -1748,8 +1748,7 @@ interpret_rhs_modify_expr (struct loop *loop,
opnd10 = TREE_OPERAND (opnd1, 0); opnd10 = TREE_OPERAND (opnd1, 0);
chrec10 = analyze_scalar_evolution (loop, opnd10); chrec10 = analyze_scalar_evolution (loop, opnd10);
chrec10 = chrec_convert (type, chrec10); chrec10 = chrec_convert (type, chrec10);
res = chrec_fold_minus (type, fold_convert (type, integer_zero_node), res = chrec_fold_minus (type, build_int_cst (type, 0), chrec10);
chrec10);
break; break;
case MULT_EXPR: case MULT_EXPR:
...@@ -2192,7 +2191,7 @@ number_of_iterations_in_loop (struct loop *loop) ...@@ -2192,7 +2191,7 @@ number_of_iterations_in_loop (struct loop *loop)
type = TREE_TYPE (niter_desc.niter); type = TREE_TYPE (niter_desc.niter);
if (integer_nonzerop (niter_desc.may_be_zero)) if (integer_nonzerop (niter_desc.may_be_zero))
res = fold_convert (type, integer_zero_node); res = build_int_cst (type, 0);
else if (integer_zerop (niter_desc.may_be_zero)) else if (integer_zerop (niter_desc.may_be_zero))
res = niter_desc.niter; res = niter_desc.niter;
else else
......
...@@ -1537,7 +1537,7 @@ generate_element_zero (struct sra_elt *elt, tree *list_p) ...@@ -1537,7 +1537,7 @@ generate_element_zero (struct sra_elt *elt, tree *list_p)
tree t; tree t;
if (elt->is_scalar) if (elt->is_scalar)
t = fold_convert (elt->type, integer_zero_node); t = build_int_cst (elt->type, 0);
else else
/* We generated a replacement for a non-scalar? */ /* We generated a replacement for a non-scalar? */
abort (); abort ();
......
...@@ -1836,7 +1836,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data, ...@@ -1836,7 +1836,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), LE_EXPR); TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), LE_EXPR);
TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op; TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op;
TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1) TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1)
= fold_convert (type, integer_zero_node); = build_int_cst (type, 0);
} }
val = simplify_cond_and_lookup_avail_expr (dummy_cond, val = simplify_cond_and_lookup_avail_expr (dummy_cond,
&bd->avail_exprs, &bd->avail_exprs,
...@@ -1847,7 +1847,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data, ...@@ -1847,7 +1847,7 @@ simplify_rhs_and_lookup_avail_expr (struct dom_walk_data *walk_data,
TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), GE_EXPR); TREE_SET_CODE (TREE_OPERAND (dummy_cond, 0), GE_EXPR);
TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op; TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 0) = op;
TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1) TREE_OPERAND (TREE_OPERAND (dummy_cond, 0), 1)
= fold_convert (type, integer_zero_node); = build_int_cst (type, 0);
val = simplify_cond_and_lookup_avail_expr (dummy_cond, val = simplify_cond_and_lookup_avail_expr (dummy_cond,
&bd->avail_exprs, &bd->avail_exprs,
......
...@@ -687,7 +687,7 @@ determine_biv_step (tree phi) ...@@ -687,7 +687,7 @@ determine_biv_step (tree phi)
return NULL_TREE; return NULL_TREE;
if (!step) if (!step)
return fold_convert (type, integer_zero_node); return build_int_cst (type, 0);
return step; return step;
} }
...@@ -1173,10 +1173,8 @@ idx_find_step (tree base, tree *idx, void *data) ...@@ -1173,10 +1173,8 @@ idx_find_step (tree base, tree *idx, void *data)
if (TREE_CODE (base) == ARRAY_REF) if (TREE_CODE (base) == ARRAY_REF)
step = array_ref_element_size (base); step = array_ref_element_size (base);
else else
{ /* The step for pointer arithmetics already is 1 byte. */
/* The step for pointer arithmetics already is 1 byte. */ step = build_int_cst (type, 1);
step = fold_convert (type, integer_one_node);
}
if (TYPE_PRECISION (iv_type) < TYPE_PRECISION (type)) if (TYPE_PRECISION (iv_type) < TYPE_PRECISION (type))
iv_step = can_count_iv_in_wider_type (dta->ivopts_data->current_loop, iv_step = can_count_iv_in_wider_type (dta->ivopts_data->current_loop,
...@@ -1586,7 +1584,7 @@ add_old_iv_candidates (struct ivopts_data *data, struct iv *iv) ...@@ -1586,7 +1584,7 @@ add_old_iv_candidates (struct ivopts_data *data, struct iv *iv)
/* The same, but with initial value zero. */ /* The same, but with initial value zero. */
add_candidate (data, add_candidate (data,
fold_convert (TREE_TYPE (iv->base), integer_zero_node), build_int_cst (TREE_TYPE (iv->base), 0),
iv->step, true, NULL); iv->step, true, NULL);
phi = SSA_NAME_DEF_STMT (iv->ssa_name); phi = SSA_NAME_DEF_STMT (iv->ssa_name);
...@@ -1628,8 +1626,7 @@ add_iv_value_candidates (struct ivopts_data *data, ...@@ -1628,8 +1626,7 @@ add_iv_value_candidates (struct ivopts_data *data,
add_candidate (data, iv->base, iv->step, false, use); add_candidate (data, iv->base, iv->step, false, use);
/* The same, but with initial value zero. */ /* The same, but with initial value zero. */
add_candidate (data, add_candidate (data, build_int_cst (TREE_TYPE (iv->base), 0),
fold_convert (TREE_TYPE (iv->base), integer_zero_node),
iv->step, false, use); iv->step, false, use);
} }
......
...@@ -875,8 +875,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) ...@@ -875,8 +875,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
add_referenced_tmp_var (tmp); add_referenced_tmp_var (tmp);
phi = create_phi_node (tmp, first); phi = create_phi_node (tmp, first);
add_phi_arg (&phi, fold_convert (ret_type, integer_zero_node), add_phi_arg (&phi, build_int_cst (ret_type, 0), first->pred);
first->pred);
a_acc = PHI_RESULT (phi); a_acc = PHI_RESULT (phi);
} }
...@@ -888,8 +887,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls) ...@@ -888,8 +887,7 @@ tree_optimize_tail_calls_1 (bool opt_tailcalls)
add_referenced_tmp_var (tmp); add_referenced_tmp_var (tmp);
phi = create_phi_node (tmp, first); phi = create_phi_node (tmp, first);
add_phi_arg (&phi, fold_convert (ret_type, integer_one_node), add_phi_arg (&phi, build_int_cst (ret_type, 1), first->pred);
first->pred);
m_acc = PHI_RESULT (phi); m_acc = PHI_RESULT (phi);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment