This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] adjust make_range
> Bootstrapped and regression tested on x86-linux. Tested on
> mipsisa64-elf. No regressions.
>
> OK?
And since I noticed that now there's no difference other than the
ultimate value of in_p between calls I fixed that up.
Tested same, no regressions again.
OK?
-eric
--
Eric Christopher <echristo@redhat.com>
2004-06-09 Eric Christopher <echristo@redhat.com>
* fold-const.c (make_range): Use orig_type in type precision.
Refactor merge_ranges use in NOP/CONVERT/NON_LVALUE_EXPR case.
Index: fold-const.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/fold-const.c,v
retrieving revision 1.390
diff -u -p -w -r1.390 fold-const.c
--- fold-const.c 9 Jun 2004 15:32:33 -0000 1.390
+++ fold-const.c 10 Jun 2004 22:21:13 -0000
@@ -3680,7 +3680,7 @@ make_range (tree exp, int *pin_p, tree *
So we have to make sure that the original unsigned value will
be interpreted as positive. */
- if (TYPE_UNSIGNED (type) && ! TYPE_UNSIGNED (TREE_TYPE (exp)))
+ if (TYPE_UNSIGNED (type) && ! TYPE_UNSIGNED (orig_type))
{
tree equiv_type = lang_hooks.types.type_for_mode
(TYPE_MODE (type), 1);
@@ -3693,7 +3693,7 @@ make_range (tree exp, int *pin_p, tree *
= TYPE_MAX_VALUE (equiv_type) ? TYPE_MAX_VALUE (equiv_type)
: TYPE_MAX_VALUE (type);
- if (TYPE_PRECISION (type) == TYPE_PRECISION (TREE_TYPE (exp)))
+ if (TYPE_PRECISION (type) == TYPE_PRECISION (orig_type))
high_positive = fold (build2 (RSHIFT_EXPR, type,
fold_convert (type,
high_positive),
@@ -3703,29 +3703,19 @@ make_range (tree exp, int *pin_p, tree *
/* If the low bound is specified, "and" the range with the
range for which the original unsigned value will be
positive. */
- if (low != 0)
- {
if (! merge_ranges (&n_in_p, &n_low, &n_high,
1, n_low, n_high, 1,
fold_convert (type, integer_zero_node),
high_positive))
break;
+ if (low != 0)
in_p = (n_in_p == in_p);
- }
else
- {
/* Otherwise, "or" the range with the range of the input
that will be interpreted as negative. */
- if (! merge_ranges (&n_in_p, &n_low, &n_high,
- 0, n_low, n_high, 1,
- fold_convert (type, integer_zero_node),
- high_positive))
- break;
-
in_p = (in_p != n_in_p);
}
- }
exp = arg0;
low = n_low, high = n_high;