VEC_COND_EXPR code cleanup
authorRichard Biener <rguenther@suse.de>
Wed, 14 Apr 2021 08:53:30 +0000 (10:53 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 23 Apr 2021 11:05:45 +0000 (13:05 +0200)
This removes now unnecessary special-casings of VEC_COND_EXPRs after
making its first operand a gimple value.

2021-04-14  Richard Biener  <rguenther@suse.de>

* genmatch.c (lower_cond): Remove VEC_COND_EXPR special-casing.
(capture_info::capture_info): Likewise.
(capture_info::walk_match): Likewise.
(expr::gen_transform): Likewise.
(dt_simplify::gen_1): Likewise.
* gimple-match-head.c (maybe_resimplify_conditional_op):
Remove VEC_COND_EXPR special-casing.
(gimple_simplify): Likewise.
* gimple.c (gimple_could_trap_p_1): Adjust.
* tree-ssa-pre.c (compute_avail): Allow VEC_COND_EXPR
to participate in PRE.

gcc/genmatch.c
gcc/gimple-match-head.c
gcc/gimple.c
gcc/tree-ssa-pre.c

index 8311f5d..5db1d96 100644 (file)
@@ -1210,7 +1210,7 @@ lower_opt (simplify *s, vec<simplify *>& simplifiers)
     }
 }
 
-/* Lower the compare operand of COND_EXPRs and VEC_COND_EXPRs to a
+/* Lower the compare operand of COND_EXPRs to a
    GENERIC and a GIMPLE variant.  */
 
 static vec<operand *>
@@ -1257,8 +1257,7 @@ lower_cond (operand *o)
       /* If this is a COND with a captured expression or an
          expression with two operands then also match a GENERIC
         form on the compare.  */
-      if ((*e->operation == COND_EXPR
-          || *e->operation == VEC_COND_EXPR)
+      if (*e->operation == COND_EXPR
          && ((is_a <capture *> (e->ops[0])
               && as_a <capture *> (e->ops[0])->what
               && is_a <expr *> (as_a <capture *> (e->ops[0])->what)
@@ -1296,7 +1295,7 @@ lower_cond (operand *o)
   return ro;
 }
 
-/* Lower the compare operand of COND_EXPRs and VEC_COND_EXPRs to a
+/* Lower the compare operand of COND_EXPRs to a
    GENERIC and a GIMPLE variant.  */
 
 static void
@@ -2132,9 +2131,7 @@ capture_info::capture_info (simplify *s, operand *result, bool gimple_)
                (i != 0 && *e->operation == COND_EXPR)
                || *e->operation == TRUTH_ANDIF_EXPR
                || *e->operation == TRUTH_ORIF_EXPR,
-               i == 0
-               && (*e->operation == COND_EXPR
-                   || *e->operation == VEC_COND_EXPR));
+               i == 0 && *e->operation == COND_EXPR);
 
   walk_result (s->result, false, result);
 }
@@ -2197,8 +2194,7 @@ capture_info::walk_match (operand *o, unsigned toplevel_arg,
                   || *e->operation == TRUTH_ORIF_EXPR)
            cond_p = true;
          if (i == 0
-             && (*e->operation == COND_EXPR
-                 || *e->operation == VEC_COND_EXPR))
+             && *e->operation == COND_EXPR)
            expr_cond_p = true;
          walk_match (e->ops[i], toplevel_arg, cond_p, expr_cond_p);
        }
@@ -2494,8 +2490,7 @@ expr::gen_transform (FILE *f, int indent, const char *dest, bool gimple,
                            i == 0 ? NULL : op0type);
       ops[i]->gen_transform (f, indent, dest1, gimple, depth + 1, optype1,
                             cinfo, indexes,
-                            (*opr == COND_EXPR
-                             || *opr == VEC_COND_EXPR) && i == 0 ? 1 : 2);
+                            *opr == COND_EXPR && i == 0 ? 1 : 2);
     }
 
   const char *opr_name;
@@ -3417,8 +3412,7 @@ dt_simplify::gen_1 (FILE *f, int indent, bool gimple, operand *result)
                 into COND_EXPRs.  */
              int cond_handling = 0;
              if (!is_predicate)
-               cond_handling = ((*opr == COND_EXPR
-                                 || *opr == VEC_COND_EXPR) && j == 0) ? 1 : 2;
+               cond_handling = (*opr == COND_EXPR && j == 0) ? 1 : 2;
              e->ops[j]->gen_transform (f, indent, dest, true, 1, optype,
                                        &cinfo, indexes, cond_handling);
            }
index d941b8b..84fbaef 100644 (file)
@@ -147,10 +147,10 @@ maybe_resimplify_conditional_op (gimple_seq *seq, gimple_match_op *res_op,
       tree_code op_code = (tree_code) res_op->code;
       bool op_could_trap;
 
-      /* COND_EXPR and VEC_COND_EXPR will trap if, and only if, the condition
+      /* COND_EXPR will trap if, and only if, the condition
         traps and hence we have to check this.  For all other operations, we
         don't need to consider the operands.  */
-      if (op_code == COND_EXPR || op_code == VEC_COND_EXPR)
+      if (op_code == COND_EXPR)
        op_could_trap = generic_expr_could_trap_p (res_op->ops[0]);
       else
        op_could_trap = operation_could_trap_p ((tree_code) res_op->code,
@@ -961,10 +961,9 @@ gimple_simplify (gimple *stmt, gimple_match_op *res_op, gimple_seq *seq,
            {
              bool valueized = false;
              tree rhs1 = gimple_assign_rhs1 (stmt);
-             /* If this is a [VEC_]COND_EXPR first try to simplify an
+             /* If this is a COND_EXPR first try to simplify an
                 embedded GENERIC condition.  */
-             if (code == COND_EXPR
-                 || code == VEC_COND_EXPR)
+             if (code == COND_EXPR)
                {
                  if (COMPARISON_CLASS_P (rhs1))
                    {
index 87864f3..d067656 100644 (file)
@@ -2158,9 +2158,12 @@ gimple_could_trap_p_1 (gimple *s, bool include_mem, bool include_stores)
     case GIMPLE_ASSIGN:
       op = gimple_assign_rhs_code (s);
 
-      /* For COND_EXPR and VEC_COND_EXPR only the condition may trap.  */
-      if (op == COND_EXPR || op == VEC_COND_EXPR)
+      /* For COND_EXPR only the condition may trap.  */
+      if (op == COND_EXPR)
        return tree_could_trap_p (gimple_assign_rhs1 (s));
+      /* A VEC_COND_EXPR cannot trap.  */
+      else if (op == VEC_COND_EXPR)
+       return false;
 
       /* For comparisons we need to check rhs operand types instead of rhs type
          (which is BOOLEAN_TYPE).  */
index 91dd492..2803b58 100644 (file)
@@ -4038,11 +4038,10 @@ compute_avail (void)
                      enum tree_code code = gimple_assign_rhs_code (stmt);
                      vn_nary_op_t nary;
 
-                     /* COND_EXPR and VEC_COND_EXPR are awkward in
-                        that they contain an embedded complex expression.
-                        Don't even try to shove those through PRE.  */
-                     if (code == COND_EXPR
-                         || code == VEC_COND_EXPR)
+                     /* COND_EXPR is awkward in that it contains an
+                        embedded complex expression.
+                        Don't even try to shove it through PRE.  */
+                     if (code == COND_EXPR)
                        continue;
 
                      vn_nary_op_lookup_stmt (stmt, &nary);