]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Tweak assert_compare_value_ranges so it will work on trunk...
authorAldy Hernandez <aldyh@gcc.gnu.org>
Fri, 28 Jun 2019 14:53:51 +0000 (14:53 +0000)
committerAldy Hernandez <aldyh@gcc.gnu.org>
Fri, 28 Jun 2019 14:53:51 +0000 (14:53 +0000)
Tweak assert_compare_value_ranges so it will work on trunk, which
doesn't have our range_misc changes that degrade all symbolics before
hand.

From-SVN: r272786

gcc/tree-vrp.c

index 2aee500c83628db6aaa17ffad9fedadcd1845e55..04d3b82cd438408bc8e8d0c6a39e97e81f0de680 100644 (file)
@@ -2369,7 +2369,8 @@ assert_compare_value_ranges (const value_range_base *old_vr,
 
   /* Sigh.  extract_range_from_binary_expr may refuse to work on
      varying ranges for some codes, but range-ops can sometimes derive
-     useful information.  */
+     useful information.  This is the same check we have in
+     extract_range_from_binary_expr.  */
   if (code != BIT_AND_EXPR
       && code != BIT_IOR_EXPR
       && code != TRUNC_DIV_EXPR
@@ -2384,9 +2385,15 @@ assert_compare_value_ranges (const value_range_base *old_vr,
       && code != MINUS_EXPR
       && code != RSHIFT_EXPR
       && code != POINTER_PLUS_EXPR
-      && (vr0->varying_p () || vr1->varying_p ())
-      && old_vr->varying_p ())
-    return;
+      && (vr0->varying_p ()
+         || vr1->varying_p ()
+         || vr0->symbolic_p ()
+         || vr1->symbolic_p ()))
+    {
+      /* If VRP was varying, we know we did better.  */
+      if (old_vr->varying_p ())
+       return;
+    }
 
   /* There's an unaccounted difference.  This may be a real bug.  */