From: Richard Biener Date: Thu, 10 Jul 2025 09:26:04 +0000 (+0200) Subject: Handle failed gcond pattern gracefully X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2f2e9bcfb0fd9cbf46e2d0d03b3f32f7df8d4fff;p=thirdparty%2Fgcc.git Handle failed gcond pattern gracefully SLP analysis of early break conditions asserts pattern recognition canonicalized all of them. But the pattern can fail, for example when vector types cannot be computed. So be graceful here, so we don't ICE when we didn't yet compute vector types. * tree-vect-slp.cc (vect_analyze_slp): Fail for non-canonical gconds. --- diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc index 5ef45fd60f5..ad75386926a 100644 --- a/gcc/tree-vect-slp.cc +++ b/gcc/tree-vect-slp.cc @@ -5068,9 +5068,15 @@ vect_analyze_slp (vec_info *vinfo, unsigned max_tree_size, tree args0 = gimple_cond_lhs (stmt); tree args1 = gimple_cond_rhs (stmt); - /* These should be enforced by cond lowering. */ - gcc_assert (gimple_cond_code (stmt) == NE_EXPR); - gcc_assert (zerop (args1)); + /* These should be enforced by cond lowering, but if it failed + bail. */ + if (gimple_cond_code (stmt) != NE_EXPR + || TREE_TYPE (args0) != boolean_type_node + || !integer_zerop (args1)) + { + roots.release (); + continue; + } /* An argument without a loop def will be codegened from vectorizing the root gcond itself. As such we don't need to try to build an SLP tree