diff mbox series

[2/8] parloops: Allow poly nit and bound

Message ID 0942baa7-f186-4d0b-f556-3b8f926a24ad@arm.com
State New
Headers show
Series [1/8] parloops: Copy target and optimizations when creating a function clone | expand

Commit Message

Andre Vieira (lists) Aug. 30, 2023, 9:08 a.m. UTC
Teach parloops how to handle a poly nit and bound e ahead of the changes 
to enable non-constant simdlen.

gcc/ChangeLog:

	* tree-parloops.cc (try_to_transform_to_exit_first_loop_alt): Accept
	poly NIT and ALT_BOUND.

Comments

Richard Biener Aug. 30, 2023, 12:32 p.m. UTC | #1
On Wed, 30 Aug 2023, Andre Vieira (lists) wrote:

> Teach parloops how to handle a poly nit and bound e ahead of the changes to
> enable non-constant simdlen.

Can you use poly_int_tree_p to combine INTEGER_CST || POLY_INT_CST please?

OK with that change.

> gcc/ChangeLog:
> 
> 	* tree-parloops.cc (try_to_transform_to_exit_first_loop_alt): Accept
> 	poly NIT and ALT_BOUND.
>
Andre Vieira (lists) Oct. 18, 2023, 2:40 p.m. UTC | #2
Posting the changed patch for completion, already reviewed.

On 30/08/2023 13:32, Richard Biener wrote:
> On Wed, 30 Aug 2023, Andre Vieira (lists) wrote:
> 
>> Teach parloops how to handle a poly nit and bound e ahead of the changes to
>> enable non-constant simdlen.
> 
> Can you use poly_int_tree_p to combine INTEGER_CST || POLY_INT_CST please?
> 
> OK with that change.
> 
>> gcc/ChangeLog:
>>
>> 	* tree-parloops.cc (try_to_transform_to_exit_first_loop_alt): Accept
>> 	poly NIT and ALT_BOUND.
>>
>
diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc
index a35f3d5023b06e5ef96eb4222488fcb34dd7bd45..80f3dd6dce281e1eb1d76d38bd09e6638a875142 100644
--- a/gcc/tree-parloops.cc
+++ b/gcc/tree-parloops.cc
@@ -2531,14 +2531,15 @@ 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 (poly_int_tree_p (nit))
     {
       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;
 	}
diff mbox series

Patch

diff --git a/gcc/tree-parloops.cc b/gcc/tree-parloops.cc
index a35f3d5023b06e5ef96eb4222488fcb34dd7bd45..cf713e53d712fb5ad050e274f373adba5a90c5a7 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;
 	}