Commit 8732dd82 by Richard Biener Committed by Richard Biener

re PR tree-optimization/86232 (ICE in record_estimate, at tree-ssa-loop-niter.c:3258)

2018-06-21  Richard Biener  <rguenther@suse.de>

	PR tree-optimization/86232
	* tree-ssa-loop-niter.c (number_of_iterations_popcount): Adjust
	max for constant niter.

	* gcc.dg/torture/pr86232.c: New testcase.

From-SVN: r261843
parent 9b2e34ef
2018-06-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/86232
* tree-ssa-loop-niter.c (number_of_iterations_popcount): Adjust
max for constant niter.
2018-06-21 Andre Vieira <andre.simoesdiasvieira@arm.com> 2018-06-21 Andre Vieira <andre.simoesdiasvieira@arm.com>
* config/aarch64/aarch64-simd.md * config/aarch64/aarch64-simd.md
......
2018-06-21 Richard Biener <rguenther@suse.de>
PR tree-optimization/86232
* gcc.dg/torture/pr86232.c: New testcase.
2018-06-21 Andre Vieira <andre.simoesdiasvieira@arm.com> 2018-06-21 Andre Vieira <andre.simoesdiasvieira@arm.com>
* gcc/gcc.target/aarch64/aes_xor_combine.c: New test. * gcc/gcc.target/aarch64/aes_xor_combine.c: New test.
......
/* { dg-do compile } */
enum { a = 1 } b;
int c()
{
int d = a;
for (; d;)
d &= d - 1;
return b;
}
...@@ -2575,9 +2575,6 @@ number_of_iterations_popcount (loop_p loop, edge exit, ...@@ -2575,9 +2575,6 @@ number_of_iterations_popcount (loop_p loop, edge exit,
return false; return false;
/* Update NITER params accordingly */ /* Update NITER params accordingly */
max = TYPE_PRECISION (TREE_TYPE (src));
if (adjust)
max = max - 1;
tree utype = unsigned_type_for (TREE_TYPE (src)); tree utype = unsigned_type_for (TREE_TYPE (src));
src = fold_convert (utype, src); src = fold_convert (utype, src);
tree call = fold_convert (utype, build_call_expr (fn, 1, src)); tree call = fold_convert (utype, build_call_expr (fn, 1, src));
...@@ -2588,6 +2585,15 @@ number_of_iterations_popcount (loop_p loop, edge exit, ...@@ -2588,6 +2585,15 @@ number_of_iterations_popcount (loop_p loop, edge exit,
else else
iter = call; iter = call;
if (TREE_CODE (call) == INTEGER_CST)
max = tree_to_uhwi (call);
else
{
max = TYPE_PRECISION (TREE_TYPE (src));
if (adjust)
max = max - 1;
}
niter->niter = iter; niter->niter = iter;
niter->assumptions = boolean_true_node; niter->assumptions = boolean_true_node;
if (adjust) if (adjust)
......
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