]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Handle failed gcond pattern gracefully
authorRichard Biener <rguenther@suse.de>
Thu, 10 Jul 2025 09:26:04 +0000 (11:26 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Thu, 10 Jul 2025 11:11:39 +0000 (13:11 +0200)
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.

gcc/tree-vect-slp.cc

index 5ef45fd60f5788bed1d4a3a0aec45dcf5b3f1f65..ad75386926a8f99dd88188684f61bd954fa25cba 100644 (file)
@@ -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