> Hmm, this looks fragile - isn't the same effect when using
> -fdisable-tree-cunroll?

Maybe.

> That is, it looks like we could "move" the assert to decide_unrolling
> instead, deciding LPT_NONE?

We already have a guard for the assertion but it is bypassed here.

I'm going to commit this (equivalent to Jakub's fixlet) after retesting.


        PR rtl-optimization/89588
        * loop-unroll.c (decide_unroll_constant_iterations): Make guard for
        explicit unrolling factor more robust.

-- 
Eric Botcazou
Index: loop-unroll.c
===================================================================
--- loop-unroll.c	(revision 269546)
+++ loop-unroll.c	(working copy)
@@ -400,7 +400,7 @@ decide_unroll_constant_iterations (struc
     {
       /* However we cannot unroll completely at the RTL level a loop with
 	 constant number of iterations; it should have been peeled instead.  */
-      if ((unsigned) loop->unroll - 1 > desc->niter - 2)
+      if (desc->niter < 2 || (unsigned) loop->unroll - 1 > desc->niter - 2)
 	{
 	  if (dump_file)
 	    fprintf (dump_file, ";; Loop should have been peeled\n");

Reply via email to