There's a logic error for vect_remove_slp_scalar_calls where it simply ignores pattern stmts but it should instead look at the original stmt.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed. * tree-vect-slp.cc (vect_remove_slp_scalar_calls): Look at the original stmt. --- gcc/tree-vect-slp.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index b5a9604d074..9bf142d0faf 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -11361,12 +11361,12 @@ vect_remove_slp_scalar_calls (vec_info *vinfo, { if (!stmt_info) continue; + if (!PURE_SLP_STMT (stmt_info)) + continue; + stmt_info = vect_orig_stmt (stmt_info); gcall *stmt = dyn_cast <gcall *> (stmt_info->stmt); if (!stmt || gimple_bb (stmt) == NULL) continue; - if (is_pattern_stmt_p (stmt_info) - || !PURE_SLP_STMT (stmt_info)) - continue; lhs = gimple_call_lhs (stmt); if (lhs) new_stmt = gimple_build_assign (lhs, build_zero_cst (TREE_TYPE (lhs))); -- 2.43.0