Commit e4c03378 by Eric Botcazou

fold-const.c (fold_range_test): Pass LOC to build_range_check.

	* fold-const.c (fold_range_test): Pass LOC to build_range_check.
	(fold_ternary_loc): Use expr_location_or.

From-SVN: r173588
parent 805d6a75
2011-05-09 Eric Botcazou <ebotcazou@adacore.com>
* fold-const.c (fold_range_test): Pass LOC to build_range_check.
(fold_ternary_loc): Use expr_location_or.
2011-05-09 H.J. Lu <hongjiu.lu@intel.com> 2011-05-09 H.J. Lu <hongjiu.lu@intel.com>
PR debug/48853 PR debug/48853
...@@ -5,10 +10,10 @@ ...@@ -5,10 +10,10 @@
POINTERS_EXTEND_UNSIGNED is defined, don't give up if mode is POINTERS_EXTEND_UNSIGNED is defined, don't give up if mode is
Pmode and mem_mode is not VOIDmode. Pmode and mem_mode is not VOIDmode.
2011-05-08 Ville Voutilainen <ville.voutilainen@gmail.com> 2011-05-09 Ville Voutilainen <ville.voutilainen@gmail.com>
* tree.h (TYPE_UNQUALIFIED, TYPE_QUAL_CONST): Convert to enum. * tree.h (TYPE_UNQUALIFIED, TYPE_QUAL_CONST, TYPE_QUAL_VOLATILE,
(TYPE_QUAL_VOLATILE, TYPE_QUAL_RESTRICT): Likewise. TYPE_QUAL_RESTRICT): Convert to enum.
2011-05-09 Uros Bizjak <ubizjak@gmail.com> 2011-05-09 Uros Bizjak <ubizjak@gmail.com>
......
...@@ -4822,7 +4822,7 @@ fold_range_test (location_t loc, enum tree_code code, tree type, ...@@ -4822,7 +4822,7 @@ fold_range_test (location_t loc, enum tree_code code, tree type,
if ((lhs == 0 || rhs == 0 || operand_equal_p (lhs, rhs, 0)) if ((lhs == 0 || rhs == 0 || operand_equal_p (lhs, rhs, 0))
&& merge_ranges (&in_p, &low, &high, in0_p, low0, high0, && merge_ranges (&in_p, &low, &high, in0_p, low0, high0,
in1_p, low1, high1) in1_p, low1, high1)
&& 0 != (tem = (build_range_check (UNKNOWN_LOCATION, type, && 0 != (tem = (build_range_check (loc, type,
lhs != 0 ? lhs lhs != 0 ? lhs
: rhs != 0 ? rhs : integer_zero_node, : rhs != 0 ? rhs : integer_zero_node,
in_p, low, high)))) in_p, low, high))))
...@@ -13332,9 +13332,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, ...@@ -13332,9 +13332,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
TREE_OPERAND (arg0, 1)) TREE_OPERAND (arg0, 1))
&& !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (op2)))) && !HONOR_SIGNED_ZEROS (TYPE_MODE (TREE_TYPE (op2))))
{ {
location_t loc0 = EXPR_LOCATION (arg0); location_t loc0 = expr_location_or (arg0, loc);
if (loc0 == UNKNOWN_LOCATION)
loc0 = loc;
tem = fold_truth_not_expr (loc0, arg0); tem = fold_truth_not_expr (loc0, arg0);
if (tem && COMPARISON_CLASS_P (tem)) if (tem && COMPARISON_CLASS_P (tem))
{ {
...@@ -13349,9 +13347,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, ...@@ -13349,9 +13347,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
if (truth_value_p (TREE_CODE (arg0)) if (truth_value_p (TREE_CODE (arg0))
&& tree_swap_operands_p (op1, op2, false)) && tree_swap_operands_p (op1, op2, false))
{ {
location_t loc0 = EXPR_LOCATION (arg0); location_t loc0 = expr_location_or (arg0, loc);
if (loc0 == UNKNOWN_LOCATION)
loc0 = loc;
/* See if this can be inverted. If it can't, possibly because /* See if this can be inverted. If it can't, possibly because
it was a floating-point inequality comparison, don't do it was a floating-point inequality comparison, don't do
anything. */ anything. */
...@@ -13500,9 +13496,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, ...@@ -13500,9 +13496,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
&& truth_value_p (TREE_CODE (arg0)) && truth_value_p (TREE_CODE (arg0))
&& truth_value_p (TREE_CODE (arg1))) && truth_value_p (TREE_CODE (arg1)))
{ {
location_t loc0 = EXPR_LOCATION (arg0); location_t loc0 = expr_location_or (arg0, loc);
if (loc0 == UNKNOWN_LOCATION)
loc0 = loc;
/* Only perform transformation if ARG0 is easily inverted. */ /* Only perform transformation if ARG0 is easily inverted. */
tem = fold_truth_not_expr (loc0, arg0); tem = fold_truth_not_expr (loc0, arg0);
if (tem) if (tem)
...@@ -13516,9 +13510,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type, ...@@ -13516,9 +13510,7 @@ fold_ternary_loc (location_t loc, enum tree_code code, tree type,
&& truth_value_p (TREE_CODE (arg0)) && truth_value_p (TREE_CODE (arg0))
&& truth_value_p (TREE_CODE (op2))) && truth_value_p (TREE_CODE (op2)))
{ {
location_t loc0 = EXPR_LOCATION (arg0); location_t loc0 = expr_location_or (arg0, loc);
if (loc0 == UNKNOWN_LOCATION)
loc0 = loc;
/* Only perform transformation if ARG0 is easily inverted. */ /* Only perform transformation if ARG0 is easily inverted. */
tem = fold_truth_not_expr (loc0, arg0); tem = fold_truth_not_expr (loc0, arg0);
if (tem) if (tem)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment