aboutsummaryrefslogtreecommitdiff
path: root/gcc/fold-const.c
diff options
context:
space:
mode:
authorBin Cheng <bin.cheng@arm.com>2016-11-04 15:51:38 +0000
committerBin Cheng <amker@gcc.gnu.org>2016-11-04 15:51:38 +0000
commit26060734c0470c74ccef2f4b755d7be4ad6a0e20 (patch)
tree370a46b1911783cba506d452293205a75b071155 /gcc/fold-const.c
parentdac9376aeebc6021e3a73c34f5b8bc7e87e09fc7 (diff)
downloadgcc-26060734c0470c74ccef2f4b755d7be4ad6a0e20.zip
gcc-26060734c0470c74ccef2f4b755d7be4ad6a0e20.tar.gz
gcc-26060734c0470c74ccef2f4b755d7be4ad6a0e20.tar.bz2
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
Diffstat (limited to 'gcc/fold-const.c')
-rw-r--r--gcc/fold-const.c44
1 files changed, 14 insertions, 30 deletions
diff --git a/gcc/fold-const.c b/gcc/fold-const.c
index fb6e45d..593ea16 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: