Commit 9e7376e5 by Zdenek Dvorak Committed by Zdenek Dvorak

re PR tree-optimization/19937 (Wrong loop exit (causes binutils to fail))

	PR tree-optimization/19937
	* tree-ssa-loop-ivopts.c (rewrite_use_compare): Cast the final value
	to the type of the induction variable.

From-SVN: r95535
parent bd182be8
2005-02-25 Zdenek Dvorak <dvorakz@suse.cz>
PR tree-optimization/19937
* tree-ssa-loop-ivopts.c (rewrite_use_compare): Cast the final value
to the type of the induction variable.
2005-02-25 Kaz Kojima <kkojima@gcc.gnu.org> 2005-02-25 Kaz Kojima <kkojima@gcc.gnu.org>
PR rtl-optimization/20117 PR rtl-optimization/20117
......
...@@ -4878,15 +4878,17 @@ rewrite_use_compare (struct ivopts_data *data, ...@@ -4878,15 +4878,17 @@ rewrite_use_compare (struct ivopts_data *data,
if (may_eliminate_iv (data, use, cand, &compare, &bound)) if (may_eliminate_iv (data, use, cand, &compare, &bound))
{ {
tree var = var_at_stmt (data->current_loop, cand, use->stmt);
tree var_type = TREE_TYPE (var);
bound = fold_convert (var_type, bound);
op = force_gimple_operand (unshare_expr (bound), &stmts, op = force_gimple_operand (unshare_expr (bound), &stmts,
true, NULL_TREE); true, NULL_TREE);
if (stmts) if (stmts)
bsi_insert_before (&bsi, stmts, BSI_SAME_STMT); bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
*use->op_p = build2 (compare, boolean_type_node, *use->op_p = build2 (compare, boolean_type_node, var, op);
var_at_stmt (data->current_loop,
cand, use->stmt), op);
modify_stmt (use->stmt); modify_stmt (use->stmt);
return; return;
} }
......
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