[v2] vect: Check that vector factor is a compile-time constant

Message ID 20230309075710.2236986-1-collison@rivosinc.com
State Accepted
Headers
Series [v2] vect: Check that vector factor is a compile-time constant |

Checks

Context Check Description
snail/gcc-patch-check success Github commit url

Commit Message

Michael Collison March 9, 2023, 7:57 a.m. UTC
  2023-03-05  Michael Collison  <collison@rivosinc.com>

	* tree-vect-loop-manip.cc (vect_do_peeling): Use
	result of constant_lower_bound instead of vf in case
	vf is not a compile time constant.
---
 gcc/tree-vect-loop-manip.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Richard Biener March 9, 2023, 8:55 a.m. UTC | #1
On Thu, Mar 9, 2023 at 8:57 AM Michael Collison <collison@rivosinc.com> wrote:

OK.

Thanks,
Richard.

> 2023-03-05  Michael Collison  <collison@rivosinc.com>
>
>         * tree-vect-loop-manip.cc (vect_do_peeling): Use
>         result of constant_lower_bound instead of vf in case
>         vf is not a compile time constant.
> ---
>  gcc/tree-vect-loop-manip.cc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
> index d88edafa018..f60fa50e8f4 100644
> --- a/gcc/tree-vect-loop-manip.cc
> +++ b/gcc/tree-vect-loop-manip.cc
> @@ -2921,7 +2921,7 @@ vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
>        if (new_var_p)
>         {
>           value_range vr (type,
> -                         wi::to_wide (build_int_cst (type, vf)),
> +                         wi::to_wide (build_int_cst (type, lowest_vf)),
>                           wi::to_wide (TYPE_MAX_VALUE (type)));
>           set_range_info (niters, vr);
>         }
> --
> 2.34.1
>
  

Patch

diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc
index d88edafa018..f60fa50e8f4 100644
--- a/gcc/tree-vect-loop-manip.cc
+++ b/gcc/tree-vect-loop-manip.cc
@@ -2921,7 +2921,7 @@  vect_do_peeling (loop_vec_info loop_vinfo, tree niters, tree nitersm1,
       if (new_var_p)
 	{
 	  value_range vr (type,
-			  wi::to_wide (build_int_cst (type, vf)),
+			  wi::to_wide (build_int_cst (type, lowest_vf)),
 			  wi::to_wide (TYPE_MAX_VALUE (type)));
 	  set_range_info (niters, vr);
 	}