From: aldyh Date: Mon, 17 Sep 2018 06:07:52 +0000 (+0000) Subject: * tree-vrp.c (extract_range_from_unary_expr): Do not special case X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e3fdb3c699ca39f0543a27c81786b7b41c1001e6;p=thirdparty%2Fgcc.git * tree-vrp.c (extract_range_from_unary_expr): Do not special case symbolics or VR_VARYING ranges for ABS_EXPR. * wide-int-range.cc (wide_int_range_abs): Return positive numbers when range will wrap. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@264356 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f6b4b53fc44..59b73ed08980 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2018-09-17 Aldy Hernandez + + * tree-vrp.c (extract_range_from_unary_expr): Do not special case + symbolics or VR_VARYING ranges for ABS_EXPR. + * wide-int-range.cc (wide_int_range_abs): Return positive numbers + when range will wrap. + 2018-09-15 Eric Botcazou PR middle-end/86864 diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 1adb919a6dfd..622ccbc2df7f 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -1894,11 +1894,6 @@ extract_range_from_unary_expr (value_range *vr, } else if (code == ABS_EXPR) { - if (vr0.type != VR_RANGE || symbolic_range_p (&vr0)) - { - set_value_range_to_varying (vr); - return; - } wide_int wmin, wmax; wide_int vr0_min, vr0_max; extract_range_into_wide_ints (&vr0, sign, prec, vr0_min, vr0_max); diff --git a/gcc/wide-int-range.cc b/gcc/wide-int-range.cc index 8a3dfd256845..a85fe9f9ad70 100644 --- a/gcc/wide-int-range.cc +++ b/gcc/wide-int-range.cc @@ -728,10 +728,13 @@ wide_int_range_abs (wide_int &min, wide_int &max, } /* If the new range has its limits swapped around (MIN > MAX), then - the operation caused one of them to wrap around, mark the new - range VARYING. */ + the operation caused one of them to wrap around. The only thing + we know is that the result is positive. */ if (wi::gt_p (min, max, sign)) - return false; + { + min = wi::zero (prec); + max = max_value; + } return true; }