[Bug tree-optimization/104112] [12 Regression] ICE with -Ofast -march=armv8.2-a+sve -msve-vector-bits=512 since r12-2292-g1dd3f21095858fbfd3e28a149578d5fb67e75f95
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Wed Jan 19 11:29:01 GMT 2022
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=104112
--- Comment #6 from Richard Biener <rguenth at gcc dot gnu.org> ---
The following adds such verification
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 0fe3529b2d1..6ce33f3cef0 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -4979,9 +4979,20 @@ vect_find_reusable_accumulator (loop_vec_info
loop_vinfo,
/* Handle the case where we can reduce wider vectors to narrower ones. */
tree vectype = STMT_VINFO_VECTYPE (reduc_info);
tree old_vectype = TREE_TYPE (accumulator->reduc_input);
+ unsigned HOST_WIDE_INT m;
if (!constant_multiple_p (TYPE_VECTOR_SUBPARTS (old_vectype),
- TYPE_VECTOR_SUBPARTS (vectype)))
+ TYPE_VECTOR_SUBPARTS (vectype), &m))
return false;
+ /* Check the intermediate vector types are available. */
+ while (m > 2)
+ {
+ m /= 2;
+ tree intermediate_vectype = get_related_vectype_for_scalar_type
+ (TYPE_MODE (vectype), TREE_TYPE (vectype),
+ exact_div (TYPE_VECTOR_SUBPARTS (old_vectype), m));
+ if (!intermediate_vectype)
+ return false;
+ }
/* Non-SLP reductions might apply an adjustment after the reduction
operation, in order to simplify the initialization of the accumulator.
More information about the Gcc-bugs
mailing list