From e7437b594f9c54bc07a2ef0bda9801ce62b1eab7 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 3 May 2016 13:43:06 +0200 Subject: [PATCH] re PR tree-optimization/70916 (gcc ICE at -O3 on valid code on x86_64-linux-gnu in "tree_operand_check") PR tree-optimization/70916 * tree-if-conv.c (constant_or_ssa_name): Removed. (fold_build_cond_expr): Use is_gimple_val instead of constant_or_ssa_name. From-SVN: r235815 --- gcc/ChangeLog | 5 +++++ gcc/tree-if-conv.c | 28 ++++------------------------ 2 files changed, 9 insertions(+), 24 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 83760681c0d..f2952eb9625 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,10 @@ 2016-05-03 Jakub Jelinek + PR tree-optimization/70916 + * tree-if-conv.c (constant_or_ssa_name): Removed. + (fold_build_cond_expr): Use is_gimple_val instead of + constant_or_ssa_name. + PR tree-optimization/70916 * tree-vect-patterns.c (vect_recog_mask_conversion_pattern): Give up if COND_EXPR rhs1 is neither SSA_NAME nor COMPARISON_CLASS_P. diff --git a/gcc/tree-if-conv.c b/gcc/tree-if-conv.c index 97b62b7a79e..72dca985d74 100644 --- a/gcc/tree-if-conv.c +++ b/gcc/tree-if-conv.c @@ -416,24 +416,6 @@ fold_or_predicates (location_t loc, tree c1, tree c2) return fold_build2_loc (loc, TRUTH_OR_EXPR, boolean_type_node, c1, c2); } -/* Returns true if N is either a constant or a SSA_NAME. */ - -static bool -constant_or_ssa_name (tree n) -{ - switch (TREE_CODE (n)) - { - case SSA_NAME: - case INTEGER_CST: - case REAL_CST: - case COMPLEX_CST: - case VECTOR_CST: - return true; - default: - return false; - } -} - /* Returns either a COND_EXPR or the folded expression if the folded expression is a MIN_EXPR, a MAX_EXPR, an ABS_EXPR, a constant or a SSA_NAME. */ @@ -454,22 +436,21 @@ fold_build_cond_expr (tree type, tree cond, tree rhs, tree lhs) && (integer_zerop (op1))) cond = op0; } - cond_expr = fold_ternary (COND_EXPR, type, cond, - rhs, lhs); + cond_expr = fold_ternary (COND_EXPR, type, cond, rhs, lhs); if (cond_expr == NULL_TREE) return build3 (COND_EXPR, type, cond, rhs, lhs); STRIP_USELESS_TYPE_CONVERSION (cond_expr); - if (constant_or_ssa_name (cond_expr)) + if (is_gimple_val (cond_expr)) return cond_expr; if (TREE_CODE (cond_expr) == ABS_EXPR) { rhs1 = TREE_OPERAND (cond_expr, 1); STRIP_USELESS_TYPE_CONVERSION (rhs1); - if (constant_or_ssa_name (rhs1)) + if (is_gimple_val (rhs1)) return build1 (ABS_EXPR, type, rhs1); } @@ -480,8 +461,7 @@ fold_build_cond_expr (tree type, tree cond, tree rhs, tree lhs) STRIP_USELESS_TYPE_CONVERSION (lhs1); rhs1 = TREE_OPERAND (cond_expr, 1); STRIP_USELESS_TYPE_CONVERSION (rhs1); - if (constant_or_ssa_name (rhs1) - && constant_or_ssa_name (lhs1)) + if (is_gimple_val (rhs1) && is_gimple_val (lhs1)) return build2 (TREE_CODE (cond_expr), type, lhs1, rhs1); } return build3 (COND_EXPR, type, cond, rhs, lhs); -- 2.30.2