From: Richard Biener Date: Tue, 21 Oct 2025 09:09:41 +0000 (+0200) Subject: Fix partial epilog for bool vectors X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=6588bfab5c13fb4c3e47dd7e1a1aab86c9b70308;p=thirdparty%2Fgcc.git Fix partial epilog for bool vectors When we do epilogue vectorization the partial reduction of a bool vector via vect_create_partial_epilog ends up being done on an integer vector but we fail to pun back to a bool vector at the end, causing an ICE later. I couldn't manage to create a testcase running into the failure but a pending patch will expose this on gcc.dg/vect/vect-switch-ifcvt-3.c * tree-vect-loop.cc (vect_create_partial_epilog): Pun back to the requested type if necessary. --- diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc index 6c242024971..455205069f6 100644 --- a/gcc/tree-vect-loop.cc +++ b/gcc/tree-vect-loop.cc @@ -5219,6 +5219,15 @@ vect_create_partial_epilog (tree vec_def, tree vectype, code_helper code, new_temp = gimple_build (seq, code, vectype1, dst1, dst2); } + if (!useless_type_conversion_p (vectype, TREE_TYPE (new_temp))) + { + tree dst3 = make_ssa_name (vectype); + gimple *epilog_stmt = gimple_build_assign (dst3, VIEW_CONVERT_EXPR, + build1 (VIEW_CONVERT_EXPR, + vectype, new_temp)); + gimple_seq_add_stmt_without_update (seq, epilog_stmt); + new_temp = dst3; + } return new_temp; }