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
Bootstrapped and tested on x86_64-unknown-linux-gnu.
* tree-vect-loop.cc (vect_create_partial_epilog): Pun back
to the requested type if necessary.
---
gcc/tree-vect-loop.cc | 9 +++++++++
1 file changed, 9 insertions(+)
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;
}
--
2.51.0