middle-end: don't pass loop_vinfo to vect_set_loop_condition during prolog peeling [PR111866]

Message ID patch-17865-tamar@arm.com
State Unresolved
Headers
Series middle-end: don't pass loop_vinfo to vect_set_loop_condition during prolog peeling [PR111866] |

Checks

Context Check Description
snail/gcc-patch-check warning Git am fail log

Commit Message

Tamar Christina Oct. 20, 2023, 10:50 a.m. UTC
  Hi All,

During the refactoring I had passed loop_vinfo on to vect_set_loop_condition
during prolog peeling.  This parameter is unused in most cases except for in
vect_set_loop_condition_partial_vectors where it's behaviour depends on whether
loop_vinfo is NULL or not.  Apparently this code expect it to be NULL and it
reads the structures from a different location.

This fixes the failing testcase which was not using the lens values determined
earlier in vectorizable_store because it was looking it up in the given
loop_vinfo instead.

Bootstrapped Regtested on aarch64-none-linux-gnu, powerpc64le-unknown-linux-gnu,
x86_64--nonelinux-gnu and no issues.  PowerPC test failures are fixed as well.

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

	PR tree-optimization/PR111866
	* tree-vect-loop-manip.cc (vect_do_peeling): Pass null as vinfo to
	vect_set_loop_condition during prolog peeling.

--- inline copy of patch -- 
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index db1d4f867ead5c6079cda3ff0d0870234d11e39d..9c2551261e33738feac71721d4f0160033907260 100644




--
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index db1d4f867ead5c6079cda3ff0d0870234d11e39d..9c2551261e33738feac71721d4f0160033907260 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3235,7 +3235,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
 
       /* Update the number of iterations for prolog loop.  */
       tree step_prolog = build_one_cst (TREE_TYPE (niters_prolog));
-      vect_set_loop_condition (prolog, prolog_e, loop_vinfo, niters_prolog,
+      vect_set_loop_condition (prolog, prolog_e, NULL, niters_prolog,
 			       step_prolog, NULL_TREE, false);
 
       /* Skip the prolog loop.  */
  

Comments

Richard Biener Oct. 20, 2023, 1:24 p.m. UTC | #1
On Fri, 20 Oct 2023, Tamar Christina wrote:

> Hi All,
> 
> During the refactoring I had passed loop_vinfo on to vect_set_loop_condition
> during prolog peeling.  This parameter is unused in most cases except for in
> vect_set_loop_condition_partial_vectors where it's behaviour depends on whether
> loop_vinfo is NULL or not.  Apparently this code expect it to be NULL and it
> reads the structures from a different location.
> 
> This fixes the failing testcase which was not using the lens values determined
> earlier in vectorizable_store because it was looking it up in the given
> loop_vinfo instead.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu, powerpc64le-unknown-linux-gnu,
> x86_64--nonelinux-gnu and no issues.  PowerPC test failures are fixed as well.
> 
> Ok for master?

Eh, I remember PR110571 seeing this.

But OK.

Thanks,
Richard.

> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
> 	PR tree-optimization/PR111866
> 	* tree-vect-loop-manip.cc (vect_do_peeling): Pass null as vinfo to
> 	vect_set_loop_condition during prolog peeling.
> 
> --- inline copy of patch -- 
> diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
> index db1d4f867ead5c6079cda3ff0d0870234d11e39d..9c2551261e33738feac71721d4f0160033907260 100644
> --- a/gcc/tree-vect-loop-manip.cc
> +++ b/gcc/tree-vect-loop-manip.cc
> @@ -3235,7 +3235,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
>  
>        /* Update the number of iterations for prolog loop.  */
>        tree step_prolog = build_one_cst (TREE_TYPE (niters_prolog));
> -      vect_set_loop_condition (prolog, prolog_e, loop_vinfo, niters_prolog,
> +      vect_set_loop_condition (prolog, prolog_e, NULL, niters_prolog,
>  			       step_prolog, NULL_TREE, false);
>  
>        /* Skip the prolog loop.  */
> 
> 
> 
> 
>
  

Patch

--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -3235,7 +3235,7 @@  vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
 
       /* Update the number of iterations for prolog loop.  */
       tree step_prolog = build_one_cst (TREE_TYPE (niters_prolog));
-      vect_set_loop_condition (prolog, prolog_e, loop_vinfo, niters_prolog,
+      vect_set_loop_condition (prolog, prolog_e, NULL, niters_prolog,
 			       step_prolog, NULL_TREE, false);
 
       /* Skip the prolog loop.  */