summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-25 12:07:11 +0000
committerrakdver <rakdver@138bc75d-0d04-0410-961f-82ee72b054a4>2005-02-25 12:07:11 +0000
commit34bbbd2e900e208abce1756c200e7ab9a9061053 (patch)
treef8ee603bfd3418fc02fdb4850b03ae8255571708 /gcc/tree-ssa-loop-ivopts.c
parentc249682abe113009bb2474ceb8212cbc59866edd (diff)
downloadgcc-34bbbd2e900e208abce1756c200e7ab9a9061053.tar.gz
PR tree-optimization/19937
* tree-ssa-loop-ivopts.c (rewrite_use_compare): Cast the final value to the type of the induction variable. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@95535 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 8b069d058d7..b1636a7ffe9 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -4878,15 +4878,17 @@ rewrite_use_compare (struct ivopts_data *data,
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,
true, NULL_TREE);
if (stmts)
bsi_insert_before (&bsi, stmts, BSI_SAME_STMT);
- *use->op_p = build2 (compare, boolean_type_node,
- var_at_stmt (data->current_loop,
- cand, use->stmt), op);
+ *use->op_p = build2 (compare, boolean_type_node, var, op);
modify_stmt (use->stmt);
return;
}