summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2021-04-14 10:53:30 +0200
committerRichard Biener <rguenther@suse.de>2021-04-23 13:05:45 +0200
commit35b2be219fc1934ae040d045e355680a83d839c4 (patch)
treefc0d9490569f66db1b5ff3668c7671b772529e7e
parent58ad6b2802592f1448eed48e8ad4e0e87985cecb (diff)
downloadgcc-35b2be219fc1934ae040d045e355680a83d839c4.tar.gz
VEC_COND_EXPR code cleanup
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.
-rw-r--r--gcc/genmatch.c20
-rw-r--r--gcc/gimple-match-head.c9
-rw-r--r--gcc/gimple.c7
-rw-r--r--gcc/tree-ssa-pre.c9
4 files changed, 20 insertions, 25 deletions
diff --git a/gcc/genmatch.c b/gcc/genmatch.c
index 8311f5d768a..5db1d969688 100644
--- a/gcc/genmatch.c
+++ b/gcc/genmatch.c
@@ -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);
}
diff --git a/gcc/gimple-match-head.c b/gcc/gimple-match-head.c
index d941b8b386f..84fbaefd762 100644
--- a/gcc/gimple-match-head.c
+++ b/gcc/gimple-match-head.c
@@ -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))
{
diff --git a/gcc/gimple.c b/gcc/gimple.c
index 87864f3d0dd..d067656d315 100644
--- a/gcc/gimple.c
+++ b/gcc/gimple.c
@@ -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). */
diff --git a/gcc/tree-ssa-pre.c b/gcc/tree-ssa-pre.c
index 91dd49200c3..2803b58430e 100644
--- a/gcc/tree-ssa-pre.c
+++ b/gcc/tree-ssa-pre.c
@@ -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);