diff --git a/gcc/gimple-match-exports.cc b/gcc/gimple-match-exports.cc index 77d225825cf..bc8038c19f0 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 9f768ca20fd..00520319aa9 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 (stmt)) diff --git a/gcc/gimple.cc b/gcc/gimple.cc index eeb1badff5f..f7b313be40e 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) {