The following places a few strathegic asserts so we do not end up
with COND_EXPRs with a comparison as the first operand during
vectorization.

Bootstrap and regtest running on x86_64-unknown-linux-gnu.

These are the asserts I'd like to keep, I will followup with quite
some dead code removal when this holds.

        * tree-vect-slp.cc (vect_get_operand_map): Mark
        COMPARISON_CLASS_P COND_EXPR condition path unreachable.
        * tree-vect-stmts.cc (vect_is_simple_use): Likewise.
        (vectorizable_condition): Assert the COND_EXPR condition isn't
        COMPARISON_CLASS_P.
---
 gcc/tree-vect-slp.cc   | 2 +-
 gcc/tree-vect-stmts.cc | 8 ++------
 2 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/gcc/tree-vect-slp.cc b/gcc/tree-vect-slp.cc
index b192328e3eb..2e98a943e06 100644
--- a/gcc/tree-vect-slp.cc
+++ b/gcc/tree-vect-slp.cc
@@ -549,7 +549,7 @@ vect_get_operand_map (const gimple *stmt, bool 
gather_scatter_p = false,
     {
       if (gimple_assign_rhs_code (assign) == COND_EXPR
          && COMPARISON_CLASS_P (gimple_assign_rhs1 (assign)))
-       return cond_expr_maps[swap];
+       gcc_unreachable ();
       if (TREE_CODE_CLASS (gimple_assign_rhs_code (assign)) == tcc_comparison
          && swap)
        return op1_op0_map;
diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 396eea070a4..4a824d16955 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -12290,6 +12290,7 @@ vectorizable_condition (vec_info *vinfo,
     return false; /* FORNOW */
 
   cond_expr = gimple_assign_rhs1 (stmt);
+  gcc_assert (! COMPARISON_CLASS_P (cond_expr));
 
   if (!vect_is_simple_cond (cond_expr, vinfo, stmt_info, slp_node,
                            &comp_vectype, &dts[0], vectype)
@@ -14257,12 +14258,7 @@ vect_is_simple_use (vec_info *vinfo, stmt_vec_info 
stmt, slp_tree slp_node,
        {
          if (gimple_assign_rhs_code (ass) == COND_EXPR
              && COMPARISON_CLASS_P (gimple_assign_rhs1 (ass)))
-           {
-             if (operand < 2)
-               *op = TREE_OPERAND (gimple_assign_rhs1 (ass), operand);
-             else
-               *op = gimple_op (ass, operand);
-           }
+           gcc_unreachable ();
          else if (gimple_assign_rhs_code (ass) == VIEW_CONVERT_EXPR)
            *op = TREE_OPERAND (gimple_assign_rhs1 (ass), 0);
          else
-- 
2.43.0

Reply via email to