aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vrp.c
diff options
context:
space:
mode:
authorRichard Biener <rguenther@suse.de>2016-09-30 07:09:28 +0000
committerRichard Biener <rguenth@gcc.gnu.org>2016-09-30 07:09:28 +0000
commit68ad1df5f5cd80b15c5015bb86230bf2c5b2bc3e (patch)
tree2288d16253c0d992f87308a69b56b0cf44c0c04c /gcc/tree-vrp.c
parentf334c828feae86ecdcc6a8f0b35425147057539f (diff)
downloadgcc-68ad1df5f5cd80b15c5015bb86230bf2c5b2bc3e.zip
gcc-68ad1df5f5cd80b15c5015bb86230bf2c5b2bc3e.tar.gz
gcc-68ad1df5f5cd80b15c5015bb86230bf2c5b2bc3e.tar.bz2
tree-vrp.c (intersect_ranges): If we failed to handle the intersection choose a constant singleton range if...
2016-09-30 Richard Biener <rguenther@suse.de> * tree-vrp.c (intersect_ranges): If we failed to handle the intersection choose a constant singleton range if available. From-SVN: r240647
Diffstat (limited to 'gcc/tree-vrp.c')
-rw-r--r--gcc/tree-vrp.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index dbff92f..7a08be7 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -8555,7 +8555,16 @@ intersect_ranges (enum value_range_type *vr0type,
/* As a fallback simply use { *VRTYPE, *VR0MIN, *VR0MAX } as
result for the intersection. That's always a conservative
- correct estimate. */
+ correct estimate unless VR1 is a constant singleton range
+ in which case we choose that. */
+ if (vr1type == VR_RANGE
+ && is_gimple_min_invariant (vr1min)
+ && vrp_operand_equal_p (vr1min, vr1max))
+ {
+ *vr0type = vr1type;
+ *vr0min = vr1min;
+ *vr0max = vr1max;
+ }
return;
}