diff options
Diffstat (limited to 'gcc/tree-ssa-loop-niter.c')
-rw-r--r-- | gcc/tree-ssa-loop-niter.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/gcc/tree-ssa-loop-niter.c b/gcc/tree-ssa-loop-niter.c index 9365915..f5ffc0f 100644 --- a/gcc/tree-ssa-loop-niter.c +++ b/gcc/tree-ssa-loop-niter.c @@ -2575,9 +2575,6 @@ number_of_iterations_popcount (loop_p loop, edge exit, return false; /* Update NITER params accordingly */ - max = TYPE_PRECISION (TREE_TYPE (src)); - if (adjust) - max = max - 1; tree utype = unsigned_type_for (TREE_TYPE (src)); src = fold_convert (utype, 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, else 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->assumptions = boolean_true_node; if (adjust) |