https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
Richard Biener <rguenth at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |NEW
Last reconfirmed| |2023-11-10
Ever confirmed|0 |1
--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Robin Dapp from comment #2)
> I tested
>
> diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
> index a544bc9b059..257fd40793e 100644
> --- a/gcc/tree-vect-loop.cc
> +++ b/gcc/tree-vect-loop.cc
> @@ -7084,7 +7084,7 @@ vectorize_fold_left_reduction (loop_vec_info
> loop_vinfo,
> opmask, &vec_opmask);
> }
>
> - gimple *sdef = scalar_dest_def_info->stmt;
> + gimple *sdef = vect_orig_stmt (scalar_dest_def_info)->stmt;
>
> overnight on x86 and aarch64. This seems to help for the reduced testcase.
>
> It appears as if we "look through" a statement pattern in
> vect_finish_replace_stmt but not before when we replace the newly created
> vector statement's lhs. Then the lhs is the statement pattern's lhs while
> in vect_finish_replace_stmt we assert that it's from the statement the
> pattern replaced.
Hmm, that will only work if the orig stmt is the root of the pattern
sequence. But otherwise it looks correct to me.