On Mon, 14 Oct 2024, Tamar Christina wrote:
> Hi All,
>
> When move_dr copies a DR from one statement to another, it seems we've
> forgotten to copy the STMT_VINFO_STRIDED_P flag. This leaves the new DR in a
> broken state where it has a non constant stride but isn't marked as strided.
>
> This causes the ICE in the PR because dataref analysis fails during epilogue
> vectorization because there is an assumption in place that while costing may
> fail for epiloque vectorization, that DR analysis cannot if it succeeded for
> the main loop.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu, x86_64-pc-linux-gnu -m32,
> -m64 and no issues.
>
> Ok for master?
OK.
Thanks,
Richard.
> Thanks,
> Tamar
>
>
>
> gcc/ChangeLog:
>
> PR tree-optimization/116956
> * tree-vectorizer.cc (vec_info::move_dr): Copy STMT_VINFO_STRIDED_P.
>
> gcc/testsuite/ChangeLog:
>
> PR tree-optimization/116956
> * gfortran.dg/vect/pr116956.f90: New test.
>
> ---
> diff --git a/gcc/testsuite/gfortran.dg/vect/pr116956.f90
> b/gcc/testsuite/gfortran.dg/vect/pr116956.f90
> new file mode 100644
> index
> 0000000000000000000000000000000000000000..3ce4d1ab7927900ccb261ed468263797ea97c354
> --- /dev/null
> +++ b/gcc/testsuite/gfortran.dg/vect/pr116956.f90
> @@ -0,0 +1,11 @@
> +! { dg-do compile }
> +! { dg-require-effective-target vect_int }
> +! { dg-additional-options "-mcpu=neoverse-v2 -Ofast" { target aarch64*-*-* }
> }
> +
> +SUBROUTINE nesting_offl_init(u, v, mask)
> + IMPLICIT NONE
> + real :: u(:)
> + real :: v(:)
> + integer :: mask(:)
> + u = MERGE( u, v, BTEST (mask, 1) )
> +END SUBROUTINE nesting_offl_init
> diff --git a/gcc/tree-vectorizer.cc b/gcc/tree-vectorizer.cc
> index
> fed12c41f9cb1aa0a3322bda53338f46c548588a..0c471c5580d35e92441251f9b494223aa71944d8
> 100644
> --- a/gcc/tree-vectorizer.cc
> +++ b/gcc/tree-vectorizer.cc
> @@ -610,6 +610,8 @@ vec_info::move_dr (stmt_vec_info new_stmt_info,
> stmt_vec_info old_stmt_info)
> = STMT_VINFO_DR_WRT_VEC_LOOP (old_stmt_info);
> STMT_VINFO_GATHER_SCATTER_P (new_stmt_info)
> = STMT_VINFO_GATHER_SCATTER_P (old_stmt_info);
> + STMT_VINFO_STRIDED_P (new_stmt_info)
> + = STMT_VINFO_STRIDED_P (old_stmt_info);
> }
>
> /* Permanently remove the statement described by STMT_INFO from the
>
>
>
>
>
--
Richard Biener <[email protected]>
SUSE Software Solutions Germany GmbH,
Frankenstrasse 146, 90461 Nuernberg, Germany;
GF: Ivo Totev, Andrew McDonald, Werner Knoblich; (HRB 36809, AG Nuernberg)