Avoid unnecessary epilogues from tree_unroll_loop

Message ID 20230309103806.D4516385781F@sourceware.org
State Committed
Commit 01e79e21bbb2d10ecac784d383cefb88d2e20692
Headers
Series Avoid unnecessary epilogues from tree_unroll_loop |

Commit Message

Richard Biener March 9, 2023, 10:37 a.m. UTC
  The following fixes the condition determining whether we need an
epilogue.

When r12-2429-g62acc72a957b56 introduced this check I didn't notice
the odd condition on review.  Richard - do you remember if this
was on purpose?

I've noticed the mismatch with gcc.dg/tree-ssa/predcom-1.c for example.

Bootstrapped and tested on x86_64-unknown-linux-gnu, queued for stage1.

Richard.

	* tree-ssa-loop-manip.cc (determine_exit_conditions): Fix
	no epilogue condition.
---
 gcc/tree-ssa-loop-manip.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Patch

diff --git a/gcc/tree-ssa-loop-manip.cc b/gcc/tree-ssa-loop-manip.cc
index c804a7353d5..a52277abdbf 100644
--- a/gcc/tree-ssa-loop-manip.cc
+++ b/gcc/tree-ssa-loop-manip.cc
@@ -1010,7 +1010,7 @@  determine_exit_conditions (class loop *loop, class tree_niter_desc *desc,
       /* Convert the latch count to an iteration count.  */
       tree niter = fold_build2 (PLUS_EXPR, type, desc->niter,
 				build_one_cst (type));
-      if (multiple_of_p (type, niter, bigstep))
+      if (multiple_of_p (type, niter, build_int_cst (type, factor)))
 	return;
     }