[gcc r17-3856] tree-optimization/127190 - ICE in vectorizable_lane_reducing
Richard Biener
rguenth@gcc.gnu.org
Wed Sep 2 11:21:33 GMT 2026
https://gcc.gnu.org/g:439cd07b51676996889b1277afd46c1053d24ebc
commit r17-3856-g439cd07b51676996889b1277afd46c1053d24ebc
Author: Richard Biener <rguenther@suse.de>
Date: Wed Sep 2 11:41:23 2026 +0200
tree-optimization/127190 - ICE in vectorizable_lane_reducing
The following properly fails analyzing a lane-reducing reduction
when vect_get_num_copies_for_invariant fails instead of asserting
it does not. While analysis later verifies we can create the
constant we use the info here for costing, so we have to fail
early.
PR tree-optimization/127190
* tree-vect-loop.cc (vectorizable_lane_reducing): Fail
when vect_get_num_copies_for_invariant does.
Diff:
---
gcc/tree-vect-loop.cc | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index cb961440656d..19e7a6fa884f 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -6855,10 +6855,16 @@ vectorizable_lane_reducing (loop_vec_info loop_vinfo, stmt_vec_info stmt_info,
/* Compute number of effective vector statements for costing from the
number of input lanes allow for excess lanes in the last input vector. */
unsigned int ncopies_for_cost, excess_elts;
- bool res = vect_get_num_copies_for_invariant (loop_vinfo, node_in,
- &ncopies_for_cost,
- &excess_elts);
- gcc_assert (res && ncopies_for_cost >= 1);
+ if (!vect_get_num_copies_for_invariant (loop_vinfo, node_in,
+ &ncopies_for_cost,
+ &excess_elts))
+ {
+ if (dump_enabled_p ())
+ dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location,
+ "incompatible vector types for invariants\n");
+ return false;
+ }
+ gcc_assert (ncopies_for_cost >= 1);
if (vect_is_emulated_mixed_dot_prod (slp_node))
{
More information about the Gcc-cvs
mailing list