summaryrefslogtreecommitdiff
path: root/gcc/tree-ssa-loop-ivopts.c
diff options
context:
space:
mode:
authorrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-17 13:19:46 +0000
committerrsandifo <rsandifo@138bc75d-0d04-0410-961f-82ee72b054a4>2014-04-17 13:19:46 +0000
commitb4f314ea97f04620d290f3ae25d831f46692864f (patch)
treee99df6f0f35dce95dacd7a91b0242e81462a0860 /gcc/tree-ssa-loop-ivopts.c
parent644412e1c29a2984b1b37656c18fe9f33791eff1 (diff)
parent7de380af566c189319d706d3b4ab04e32ecc5d90 (diff)
downloadgcc-b4f314ea97f04620d290f3ae25d831f46692864f.tar.gz
Merge from trunk.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/wide-int@209485 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree-ssa-loop-ivopts.c')
-rw-r--r--gcc/tree-ssa-loop-ivopts.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/tree-ssa-loop-ivopts.c b/gcc/tree-ssa-loop-ivopts.c
index 049da5fcdfa..b0d39271798 100644
--- a/gcc/tree-ssa-loop-ivopts.c
+++ b/gcc/tree-ssa-loop-ivopts.c
@@ -4363,8 +4363,10 @@ cand_value_at (struct loop *loop, struct iv_cand *cand, gimple at, tree niter,
tree steptype = type;
if (POINTER_TYPE_P (type))
steptype = sizetype;
+ steptype = unsigned_type_for (type);
- tree_to_aff_combination (iv->step, steptype, &step);
+ tree_to_aff_combination (iv->step, TREE_TYPE (iv->step), &step);
+ aff_combination_convert (&step, steptype);
tree_to_aff_combination (niter, TREE_TYPE (niter), &nit);
aff_combination_convert (&nit, steptype);
aff_combination_mult (&nit, &step, &delta);
@@ -4372,6 +4374,8 @@ cand_value_at (struct loop *loop, struct iv_cand *cand, gimple at, tree niter,
aff_combination_add (&delta, &step);
tree_to_aff_combination (iv->base, type, val);
+ if (!POINTER_TYPE_P (type))
+ aff_combination_convert (val, steptype);
aff_combination_add (val, &delta);
}
@@ -4750,7 +4754,8 @@ may_eliminate_iv (struct ivopts_data *data,
cand_value_at (loop, cand, use->stmt, desc->niter, &bnd);
- *bound = aff_combination_to_tree (&bnd);
+ *bound = fold_convert (TREE_TYPE (cand->iv->base),
+ aff_combination_to_tree (&bnd));
*comp = iv_elimination_compare (data, use);
/* It is unlikely that computing the number of iterations using division