https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112464
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Robin Dapp from comment #4)
> Is there another way to make it more robust?
>
> Or does the existing
>
> void
> vect_finish_replace_stmt (vec_info *vinfo,
> stmt_vec_info stmt_info, gimple *vec_stmt)
> {
> gimple *scalar_stmt = vect_orig_stmt (stmt_info)->stmt;
>
> have the same problem?
Well, yeah, it also implicitly assumes that. I couldn't come up with
the "correct" assert quickly, so I didn't suggest any. That is, just
go with your patch.