diff mbox series

[3/X] parloops: Allow poly number of iterations

Message ID 8172aa80-cb23-ade6-23f0-67f420ac84e3@arm.com
State New
Headers show
Series [3/X] parloops: Allow poly number of iterations | expand

Commit Message

Andre Vieira (lists) March 8, 2023, 4:23 p.m. UTC
Hi,

This patch modifies this function in parloops to allow it to handle 
loops with poly iteration counts.

gcc/ChangeLog:

         * tree-parloops.cc (try_transform_to_exit_first_loop_alt): 
Handle poly nits.

Is this OK for Stage 1?
diff mbox series

Patch

diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc
index 02c1ed3220a949c1349536ef3f74bb497bf76f71..0a3133a3ae7932e11aa680dc14b8ea01613a514c 100644
--- a/gcc/tree-parloops.cc
+++ b/gcc/tree-parloops.cc
@@ -2531,14 +2531,16 @@  try_transform_to_exit_first_loop_alt (class loop *loop,
   tree nit_type = TREE_TYPE (nit);
 
   /* Figure out whether nit + 1 overflows.  */
-  if (TREE_CODE (nit) == INTEGER_CST)
+  if (TREE_CODE (nit) == INTEGER_CST
+      || TREE_CODE (nit) == POLY_INT_CST)
     {
       if (!tree_int_cst_equal (nit, TYPE_MAX_VALUE (nit_type)))
 	{
 	  alt_bound = fold_build2_loc (UNKNOWN_LOCATION, PLUS_EXPR, nit_type,
 				       nit, build_one_cst (nit_type));
 
-	  gcc_assert (TREE_CODE (alt_bound) == INTEGER_CST);
+	  gcc_assert (TREE_CODE (alt_bound) == INTEGER_CST
+		      || TREE_CODE (alt_bound) == POLY_INT_CST);
 	  transform_to_exit_first_loop_alt (loop, reduction_list, alt_bound);
 	  return true;
 	}