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.

Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.

        * tree-vect-slp.cc (vect_analyze_slp): Fail for non-canonical
        gconds.
---
 gcc/tree-vect-slp.cc | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

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
-- 
2.43.0

Reply via email to