aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorJiong Wang <jiwang@gcc.gnu.org>2015-11-23 12:14:05 +0000
committerJiong Wang <jiwang@gcc.gnu.org>2015-11-23 12:14:05 +0000
commitf7b492ea50624b72ec1d3c109fe0128a69b9e343 (patch)
tree87ac82b67ee566ffc72ae143a1af2161f5edf2a2 /gcc/tree-vrp.c
parenta789b24062605aee7cdf3cc20a79524e3984edc5 (diff)
downloadgcc-f7b492ea50624b72ec1d3c109fe0128a69b9e343.zip
gcc-f7b492ea50624b72ec1d3c109fe0128a69b9e343.tar.gz
gcc-f7b492ea50624b72ec1d3c109fe0128a69b9e343.tar.bz2
[Patch] Drop constant overflow flag in adjust_range_with_scev when possible
2015-11-23 Richard Biener <rguenth@gcc.gnu.com> Jiong Wang <jiong.wang@arm.com> gcc/ PR tree-optimization/68317 PR tree-optimization/68326 * tree-vrp.c (adjust_range_with_scev): Call drop_tree_overflow if the final min and max are not infinity. gcc/testsuite/ * gcc.dg/pr68317.c: New testcase. From-SVN: r230754
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index f2c948c..7001190 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -4323,6 +4323,17 @@ adjust_range_with_scev (value_range *vr, struct loop *loop,
&& is_positive_overflow_infinity (max)))
return;
+ /* Even for valid range info, sometimes overflow flag will leak in.
+ As GIMPLE IL should have no constants with TREE_OVERFLOW set, we
+ drop them except for +-overflow_infinity which still need special
+ handling in vrp pass. */
+ if (TREE_OVERFLOW_P (min)
+ && ! is_negative_overflow_infinity (min))
+ min = drop_tree_overflow (min);
+ if (TREE_OVERFLOW_P (max)
+ && ! is_positive_overflow_infinity (max))
+ max = drop_tree_overflow (max);
+
set_value_range (vr, VR_RANGE, min, max, vr->equiv);
}