diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d0a4199be3bf..25129cb5d964 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2016-09-30 Richard Biener + + * tree-vrp.c (intersect_ranges): If we failed to handle + the intersection choose a constant singleton range if available. + 2016-09-30 Richard Biener PR tree-optimization/77399 diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index dbff92f69ea8..7a08be7b2aa8 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; }