[Bug tree-optimization/77387] Value range not computed in some cases for ABS_EXPR
kugan at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Aug 26 01:27:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=77387
--- Comment #1 from kugan at gcc dot gnu.org ---
With :
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index e4d789b..2d1f4c8 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3416,6 +3416,17 @@ extract_range_from_unary_expr_1 (value_range *vr,
return;
}
+ /* If SIGNED and VARYING set [0, TYPE_MAX]. */
+ if (!TYPE_UNSIGNED (type)
+ && vr0.type == VR_VARYING)
+ {
+ set_value_range (vr, VR_RANGE,
+ build_int_cst (type, 0),
+ vrp_val_max (type),
+ NULL);
+ return;
+ }
+
/* For the remaining varying or symbolic ranges we can't do anything
useful. */
if (vr0.type == VR_VARYING
vrp1 dump becomes:
Value ranges after VRP:
_1: [0, 127] EQUIVALENCES: { x_4 } (1 elements)
i_2(D): VARYING
x_3: [0, +INF]
x_4: [0, 127]
x_7: [0, 127] EQUIVALENCES: { x_4 } (1 elements)
Folding predicate x_4 > 256 to 0
Removing basic block 5
Merging blocks 2 and 3
Merging blocks 2 and 4
foo (int i)
{
int x;
<bb 2>:
x_3 = ABS_EXPR <i_2(D)>;
x_4 = x_3 >> 24;
return x_4;
}
More information about the Gcc-bugs
mailing list