* [PATCH] VEC_COND_EXPR code cleanup
@ 2021-04-23 12:00 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2021-04-23 12:00 UTC (permalink / raw)
To: gcc-patches
This removes now unnecessary special-casings of VEC_COND_EXPRs after
making its first operand a gimple value.
Bootstrapped and tested on x86_64-unknown-linux-gnu, pushed.
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 | 20 +++++++-------------
gcc/gimple-match-head.c | 9 ++++-----
gcc/gimple.c | 7 +++++--
gcc/tree-ssa-pre.c | 9 ++++-----
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);
--
2.26.2
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-23 12:00 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-23 12:00 [PATCH] VEC_COND_EXPR code cleanup Richard Biener
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).