From 98209db3dc215a0288df75f3f1b9432d244fe2a9 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 20 May 2015 11:46:00 +0000 Subject: [PATCH] expr.c (expand_cond_expr_using_cmove): Use COMPARISON_CLASS_P. * expr.c (expand_cond_expr_using_cmove): Use COMPARISON_CLASS_P. * gimple-expr.c (gimple_cond_get_ops_from_tree): Likewise. * gimple-fold.c (canonicalize_bool): Likewise. (same_bool_result_p): Likewise. * tree-if-conv.c (parse_predicate): Likewise. From-SVN: r223441 --- gcc/ChangeLog | 8 ++++++++ gcc/expr.c | 2 +- gcc/gimple-expr.c | 2 +- gcc/gimple-fold.c | 8 ++++---- gcc/tree-if-conv.c | 2 +- 5 files changed, 15 insertions(+), 7 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b78857c55dc..701b7590c41 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-05-20 Marek Polacek + + * expr.c (expand_cond_expr_using_cmove): Use COMPARISON_CLASS_P. + * gimple-expr.c (gimple_cond_get_ops_from_tree): Likewise. + * gimple-fold.c (canonicalize_bool): Likewise. + (same_bool_result_p): Likewise. + * tree-if-conv.c (parse_predicate): Likewise. + 2015-05-20 Marek Polacek * gimple-fold.c (fold_const_aggregate_ref_1): Use DECL_P. diff --git a/gcc/expr.c b/gcc/expr.c index e91383f9055..cf338085858 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -8073,7 +8073,7 @@ expand_cond_expr_using_cmove (tree treeop0 ATTRIBUTE_UNUSED, unsignedp = TYPE_UNSIGNED (type); comparison_code = convert_tree_comp_to_rtx (cmpcode, unsignedp); } - else if (TREE_CODE_CLASS (TREE_CODE (treeop0)) == tcc_comparison) + else if (COMPARISON_CLASS_P (treeop0)) { tree type = TREE_TYPE (TREE_OPERAND (treeop0, 0)); enum tree_code cmpcode = TREE_CODE (treeop0); diff --git a/gcc/gimple-expr.c b/gcc/gimple-expr.c index efc93b7a55f..4d683d6d7e4 100644 --- a/gcc/gimple-expr.c +++ b/gcc/gimple-expr.c @@ -607,7 +607,7 @@ void gimple_cond_get_ops_from_tree (tree cond, enum tree_code *code_p, tree *lhs_p, tree *rhs_p) { - gcc_assert (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison + gcc_assert (COMPARISON_CLASS_P (cond) || TREE_CODE (cond) == TRUTH_NOT_EXPR || is_gimple_min_invariant (cond) || SSA_VAR_P (cond)); diff --git a/gcc/gimple-fold.c b/gcc/gimple-fold.c index 4bef3502dfd..c91f218c218 100644 --- a/gcc/gimple-fold.c +++ b/gcc/gimple-fold.c @@ -3846,7 +3846,7 @@ canonicalize_bool (tree expr, bool invert) else if (TREE_CODE (expr) == SSA_NAME) return fold_build2 (EQ_EXPR, boolean_type_node, expr, build_int_cst (TREE_TYPE (expr), 0)); - else if (TREE_CODE_CLASS (TREE_CODE (expr)) == tcc_comparison) + else if (COMPARISON_CLASS_P (expr)) return fold_build2 (invert_tree_comparison (TREE_CODE (expr), false), boolean_type_node, TREE_OPERAND (expr, 0), @@ -3865,7 +3865,7 @@ canonicalize_bool (tree expr, bool invert) else if (TREE_CODE (expr) == SSA_NAME) return fold_build2 (NE_EXPR, boolean_type_node, expr, build_int_cst (TREE_TYPE (expr), 0)); - else if (TREE_CODE_CLASS (TREE_CODE (expr)) == tcc_comparison) + else if (COMPARISON_CLASS_P (expr)) return fold_build2 (TREE_CODE (expr), boolean_type_node, TREE_OPERAND (expr, 0), @@ -3946,12 +3946,12 @@ same_bool_result_p (const_tree op1, const_tree op2) /* Check the cases where at least one of the operands is a comparison. These are a bit smarter than operand_equal_p in that they apply some identifies on SSA_NAMEs. */ - if (TREE_CODE_CLASS (TREE_CODE (op2)) == tcc_comparison + if (COMPARISON_CLASS_P (op2) && same_bool_comparison_p (op1, TREE_CODE (op2), TREE_OPERAND (op2, 0), TREE_OPERAND (op2, 1))) return true; - if (TREE_CODE_CLASS (TREE_CODE (op1)) == tcc_comparison + if (COMPARISON_CLASS_P (op1) && same_bool_comparison_p (op2, TREE_CODE (op1), TREE_OPERAND (op1, 0), TREE_OPERAND (op1, 1))) diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 49ff4588f12..a85c7a24180 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -339,7 +339,7 @@ parse_predicate (tree cond, tree *op0, tree *op1) return ERROR_MARK; } - if (TREE_CODE_CLASS (TREE_CODE (cond)) == tcc_comparison) + if (COMPARISON_CLASS_P (cond)) { *op0 = TREE_OPERAND (cond, 0); *op1 = TREE_OPERAND (cond, 1); -- 2.30.2