aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorAndrew Pinski <quic_apinski@quicinc.com>2024-10-29 14:43:42 -0700
committerAndrew Pinski <quic_apinski@quicinc.com>2024-10-30 18:07:24 -0700
commitb60031e8f9f8fe89ec0cb600d0e3dc5b799c825f (patch)
treecca1fc0e04c832e9597831e47b376df2901cecbb /gcc
parent717051a6901b1107cc264190b8ebdde21c42f371 (diff)
downloadgcc-b60031e8f9f8fe89ec0cb600d0e3dc5b799c825f.zip
gcc-b60031e8f9f8fe89ec0cb600d0e3dc5b799c825f.tar.gz
gcc-b60031e8f9f8fe89ec0cb600d0e3dc5b799c825f.tar.bz2
gimple: Remove special handling of COND_EXPR for COMPARISON_CLASS_P [PR116949, PR114785]
After r13-707-g68e0063397ba82, COND_EXPR for gimple assign no longer could contain a comparison. The vectorizer was builting gimple assigns with comparison until r15-4695-gd17e672ce82e69 (which added an assert to make sure it no longer builds it). So let's remove the special handling COND_EXPR in a few places and add an assert to gimple_build_assign_1 to make sure we don't build a gimple assign any more with a comparison. Bootstrapped and tested on x86_64-linux-gnu. gcc/ChangeLog: PR middle-end/114785 PR middle-end/116949 * gimple-match-exports.cc (maybe_push_res_to_seq): Remove special handling of COMPARISON_CLASS_P in COND_EXPR/VEC_COND_EXPR. (gimple_extract): Likewise. * gimple-walk.cc (walk_stmt_load_store_addr_ops): Likewise. * gimple.cc (gimple_build_assign_1): Add assert for COND_EXPR so its 1st operand is not a comparison. Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/gimple-match-exports.cc12
-rw-r--r--gcc/gimple-walk.cc11
-rw-r--r--gcc/gimple.cc3
3 files changed, 4 insertions, 22 deletions
diff --git a/gcc/gimple-match-exports.cc b/gcc/gimple-match-exports.cc
index 77d2258..bc8038c 100644
--- a/gcc/gimple-match-exports.cc
+++ b/gcc/gimple-match-exports.cc
@@ -489,12 +489,6 @@ maybe_push_res_to_seq (gimple_match_op *res_op, gimple_seq *seq, tree res)
&& SSA_NAME_OCCURS_IN_ABNORMAL_PHI (ops[i]))
return NULL_TREE;
- if (num_ops > 0 && COMPARISON_CLASS_P (ops[0]))
- for (unsigned int i = 0; i < 2; ++i)
- if (TREE_CODE (TREE_OPERAND (ops[0], i)) == SSA_NAME
- && SSA_NAME_OCCURS_IN_ABNORMAL_PHI (TREE_OPERAND (ops[0], i)))
- return NULL_TREE;
-
if (res_op->code.is_tree_code ())
{
auto code = tree_code (res_op->code);
@@ -786,11 +780,7 @@ gimple_extract (gimple *stmt, gimple_match_op *res_op,
}
case GIMPLE_TERNARY_RHS:
{
- tree rhs1 = gimple_assign_rhs1 (stmt);
- if (code == COND_EXPR && COMPARISON_CLASS_P (rhs1))
- rhs1 = valueize_condition (rhs1);
- else
- rhs1 = valueize_op (rhs1);
+ tree rhs1 = valueize_op (gimple_assign_rhs1 (stmt));
tree rhs2 = valueize_op (gimple_assign_rhs2 (stmt));
tree rhs3 = valueize_op (gimple_assign_rhs3 (stmt));
res_op->set_op (code, type, rhs1, rhs2, rhs3);
diff --git a/gcc/gimple-walk.cc b/gcc/gimple-walk.cc
index 9f768ca..0052031 100644
--- a/gcc/gimple-walk.cc
+++ b/gcc/gimple-walk.cc
@@ -835,17 +835,6 @@ walk_stmt_load_store_addr_ops (gimple *stmt, void *data,
;
else if (TREE_CODE (op) == ADDR_EXPR)
ret |= visit_addr (stmt, TREE_OPERAND (op, 0), op, data);
- /* COND_EXPR and VCOND_EXPR rhs1 argument is a comparison
- tree with two operands. */
- else if (i == 1 && COMPARISON_CLASS_P (op))
- {
- if (TREE_CODE (TREE_OPERAND (op, 0)) == ADDR_EXPR)
- ret |= visit_addr (stmt, TREE_OPERAND (TREE_OPERAND (op, 0),
- 0), op, data);
- if (TREE_CODE (TREE_OPERAND (op, 1)) == ADDR_EXPR)
- ret |= visit_addr (stmt, TREE_OPERAND (TREE_OPERAND (op, 1),
- 0), op, data);
- }
}
}
else if (gcall *call_stmt = dyn_cast <gcall *> (stmt))
diff --git a/gcc/gimple.cc b/gcc/gimple.cc
index eeb1bad..f7b313b 100644
--- a/gcc/gimple.cc
+++ b/gcc/gimple.cc
@@ -475,6 +475,9 @@ gimple_build_assign_1 (tree lhs, enum tree_code subcode, tree op1,
gimple_build_with_ops_stat (GIMPLE_ASSIGN, (unsigned)subcode, num_ops
PASS_MEM_STAT));
gimple_assign_set_lhs (p, lhs);
+ /* For COND_EXPR, op1 should not be a comparison. */
+ if (op1 && subcode == COND_EXPR)
+ gcc_assert (!COMPARISON_CLASS_P (op1));
gimple_assign_set_rhs1 (p, op1);
if (op2)
{