Adjust overflow for invariants in bounds_of_var_in_loop.
authorAldy Hernandez <aldyh@redhat.com>
Wed, 21 Oct 2020 07:33:06 +0000 (09:33 +0200)
committerAldy Hernandez <aldyh@redhat.com>
Wed, 21 Oct 2020 08:44:10 +0000 (10:44 +0200)
Invariants returned from SCEV can have TREE_OVERFLOW set.  Clear the
overflow as we do with the rest of the values returned from this
function.

gcc/ChangeLog:

* gimple-range.cc (gimple_ranger::range_of_ssa_name_with_loop_info):
Remove TREE_OVERFLOW special case.
* vr-values.c (bounds_of_var_in_loop): Adjust overflow for
invariants.

gcc/gimple-range.cc
gcc/vr-values.c

index b790d62d75f496a7e4e46938129a0a615fd4c49a..c5520e0700b3f9cb70aaedb2e52f7e9975528db3 100644 (file)
@@ -1156,9 +1156,9 @@ gimple_ranger::range_of_ssa_name_with_loop_info (irange &r, tree name,
       // ?? We could do better here.  Since MIN/MAX can only be an
       // SSA, SSA +- INTEGER_CST, or INTEGER_CST, we could easily call
       // the ranger and solve anything not an integer.
-      if (TREE_CODE (min) != INTEGER_CST || TREE_OVERFLOW (min))
+      if (TREE_CODE (min) != INTEGER_CST)
        min = vrp_val_min (type);
-      if (TREE_CODE (max) != INTEGER_CST || TREE_OVERFLOW (max))
+      if (TREE_CODE (max) != INTEGER_CST)
        max = vrp_val_max (type);
       r.set (min, max);
     }
index cc0ddca2bd31423c623d6d35434650c574b79ca0..7a0e70eab64230158f76994aa64f831c0bdec19a 100644 (file)
@@ -1844,7 +1844,7 @@ bounds_of_var_in_loop (tree *min, tree *max, range_query *query,
   if (is_gimple_min_invariant (chrec))
     {
       *min = *max = chrec;
-      return true;
+      goto fix_overflow;
     }
 
   if (TREE_CODE (chrec) != POLYNOMIAL_CHREC)
@@ -1964,6 +1964,7 @@ bounds_of_var_in_loop (tree *min, tree *max, range_query *query,
   else
     *min = init;
 
+ fix_overflow:
   /* 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.  */