From: Bin Cheng Date: Fri, 4 Nov 2016 15:51:38 +0000 (+0000) Subject: fold-const.c (fold_cond_expr_with_comparison): Remove call to pedantic_non_lvalue_loc. X-Git-Tag: basepoints/gcc-8~3383 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=26060734c0470c74ccef2f4b755d7be4ad6a0e20;p=thirdparty%2Fgcc.git fold-const.c (fold_cond_expr_with_comparison): Remove call to pedantic_non_lvalue_loc. * fold-const.c (fold_cond_expr_with_comparison): Remove call to pedantic_non_lvalue_loc. Remove useless code for lvalue where cond_expr can't be a lvalue. From-SVN: r241847 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 64ed5f1e0b0e..11518b77eaf1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2016-11-04 Bin Cheng + + * fold-const.c (fold_cond_expr_with_comparison): Remove call + to pedantic_non_lvalue_loc. Remove useless code for lvalue + where cond_expr can't be a lvalue. + 2016-11-04 Claudiu Zissulescu * config/arc/arc.c (arc_process_double_reg_moves): Use diff --git a/gcc/fold-const.c b/gcc/fold-const.c index fb6e45dd393c..593ea16f8d45 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -5082,12 +5082,10 @@ fold_cond_expr_with_comparison (location_t loc, tree type, case EQ_EXPR: case UNEQ_EXPR: tem = fold_convert_loc (loc, arg1_type, arg1); - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, - negate_expr (tem))); + return fold_convert_loc (loc, type, negate_expr (tem)); case NE_EXPR: case LTGT_EXPR: - return pedantic_non_lvalue_loc (loc, fold_convert_loc (loc, type, arg1)); + return fold_convert_loc (loc, type, arg1); case UNGE_EXPR: case UNGT_EXPR: if (flag_trapping_math) @@ -5098,7 +5096,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type, if (TYPE_UNSIGNED (TREE_TYPE (arg1))) break; tem = fold_build1_loc (loc, ABS_EXPR, TREE_TYPE (arg1), arg1); - return pedantic_non_lvalue_loc (loc, fold_convert_loc (loc, type, tem)); + return fold_convert_loc (loc, type, tem); case UNLE_EXPR: case UNLT_EXPR: if (flag_trapping_math) @@ -5124,7 +5122,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type, && integer_zerop (arg01) && integer_zerop (arg2)) { if (comp_code == NE_EXPR) - return pedantic_non_lvalue_loc (loc, fold_convert_loc (loc, type, arg1)); + return fold_convert_loc (loc, type, arg1); else if (comp_code == EQ_EXPR) return build_zero_cst (type); } @@ -5170,20 +5168,12 @@ fold_cond_expr_with_comparison (location_t loc, tree type, tree comp_op1 = arg01; tree comp_type = TREE_TYPE (comp_op0); - /* Avoid adding NOP_EXPRs in case this is an lvalue. */ - if (TYPE_MAIN_VARIANT (comp_type) == TYPE_MAIN_VARIANT (type)) - { - comp_type = type; - comp_op0 = arg1; - comp_op1 = arg2; - } - switch (comp_code) { case EQ_EXPR: - return pedantic_non_lvalue_loc (loc, fold_convert_loc (loc, type, arg2)); + return fold_convert_loc (loc, type, arg2); case NE_EXPR: - return pedantic_non_lvalue_loc (loc, fold_convert_loc (loc, type, arg1)); + return fold_convert_loc (loc, type, arg1); case LE_EXPR: case LT_EXPR: case UNLE_EXPR: @@ -5200,8 +5190,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type, ? fold_build2_loc (loc, MIN_EXPR, comp_type, comp_op0, comp_op1) : fold_build2_loc (loc, MIN_EXPR, comp_type, comp_op1, comp_op0); - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, tem)); + return fold_convert_loc (loc, type, tem); } break; case GE_EXPR: @@ -5216,19 +5205,16 @@ fold_cond_expr_with_comparison (location_t loc, tree type, ? fold_build2_loc (loc, MAX_EXPR, comp_type, comp_op0, comp_op1) : fold_build2_loc (loc, MAX_EXPR, comp_type, comp_op1, comp_op0); - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, tem)); + return fold_convert_loc (loc, type, tem); } break; case UNEQ_EXPR: if (!HONOR_NANS (arg1)) - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, arg2)); + return fold_convert_loc (loc, type, arg2); break; case LTGT_EXPR: if (!HONOR_NANS (arg1)) - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, arg1)); + return fold_convert_loc (loc, type, arg1); break; default: gcc_assert (TREE_CODE_CLASS (comp_code) == tcc_comparison); @@ -5267,8 +5253,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type, tem = fold_build2_loc (loc, MIN_EXPR, TREE_TYPE (arg00), arg00, fold_convert_loc (loc, TREE_TYPE (arg00), arg2)); - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, tem)); + return fold_convert_loc (loc, type, tem); } break; @@ -5285,8 +5270,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type, tem = fold_build2_loc (loc, MIN_EXPR, TREE_TYPE (arg00), arg00, fold_convert_loc (loc, TREE_TYPE (arg00), arg2)); - return pedantic_non_lvalue_loc (loc, - fold_convert_loc (loc, type, tem)); + return fold_convert_loc (loc, type, tem); } break; @@ -5303,7 +5287,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type, tem = fold_build2_loc (loc, MAX_EXPR, TREE_TYPE (arg00), arg00, fold_convert_loc (loc, TREE_TYPE (arg00), arg2)); - return pedantic_non_lvalue_loc (loc, fold_convert_loc (loc, type, tem)); + return fold_convert_loc (loc, type, tem); } break; @@ -5319,7 +5303,7 @@ fold_cond_expr_with_comparison (location_t loc, tree type, tem = fold_build2_loc (loc, MAX_EXPR, TREE_TYPE (arg00), arg00, fold_convert_loc (loc, TREE_TYPE (arg00), arg2)); - return pedantic_non_lvalue_loc (loc, fold_convert_loc (loc, type, tem)); + return fold_convert_loc (loc, type, tem); } break; case NE_EXPR: