Commit 4a28e1f1 by Marc Glisse Committed by Marc Glisse

Simplify loop size when step=1

2019-06-04  Marc Glisse  <marc.glisse@inria.fr>

	* tree-ssa-loop-niter.c (number_of_iterations_ne): Skip
	computations when step is 1.

From-SVN: r271926
parent 8d3620ba
2019-06-04 Marc Glisse <marc.glisse@inria.fr>
* tree-ssa-loop-niter.c (number_of_iterations_ne): Skip
computations when step is 1.
2019-06-04 Segher Boessenkool <segher@kernel.crashing.org> 2019-06-04 Segher Boessenkool <segher@kernel.crashing.org>
* config/rs6000/constraints.md (define_register_constraint "wf"): * config/rs6000/constraints.md (define_register_constraint "wf"):
......
...@@ -1125,8 +1125,15 @@ number_of_iterations_ne (struct loop *loop, tree type, affine_iv *iv, ...@@ -1125,8 +1125,15 @@ number_of_iterations_ne (struct loop *loop, tree type, affine_iv *iv,
} }
c = fold_build2 (EXACT_DIV_EXPR, niter_type, c, d); c = fold_build2 (EXACT_DIV_EXPR, niter_type, c, d);
tmp = fold_build2 (MULT_EXPR, niter_type, c, inverse (s, bound)); if (integer_onep (s))
niter->niter = fold_build2 (BIT_AND_EXPR, niter_type, tmp, bound); {
niter->niter = c;
}
else
{
tmp = fold_build2 (MULT_EXPR, niter_type, c, inverse (s, bound));
niter->niter = fold_build2 (BIT_AND_EXPR, niter_type, tmp, bound);
}
return true; return true;
} }
......
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