+2014-04-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60766
+ * tree-ssa-loop-ivopts.c (cand_value_at): Compute in an
+ unsigned type.
+ (may_eliminate_iv): Convert cand_value_at result to desired
+ type.
+
2014-04-07 Jason Merrill <jason@redhat.com>
PR c++/60731
+2014-04-07 Richard Biener <rguenther@suse.de>
+
+ PR tree-optimization/60766
+ * gcc.dg/torture/pr60766.c: New testcase.
+
2014-04-07 Jason Merrill <jason@redhat.com>
* lib/gcc-dg.exp (dg-build-dso): New.
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);
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);
}
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