https://gcc.gnu.org/g:8c6adf1ab1c9a3f8a95773273cbdd1e9fdd3f264

commit r17-1052-g8c6adf1ab1c9a3f8a95773273cbdd1e9fdd3f264
Author: Daniel Barboza <[email protected]>
Date:   Mon May 25 14:52:56 2026 -0300

    tree-vrp: remove compare_values_warnv ()
    
    Remove compare_values_warn and all the Wstrict-overflow related logic
    from the previous callers.
    
    gcc/ChangeLog:
    
            * tree-vrp.cc (compare_values_warnv): Removed.
            (compare_values): Changed to do the same thing as the former
            compare_values_warn but without the strict_overflow_p logic.
            * tree-vrp.h (compare_values_warnv): Removed.
            * vr-values.cc (test_for_singularity): Removed the
            supress_warning logic that was used by compare_values_warnv.

Diff:
---
 gcc/tree-vrp.cc  | 31 ++-----------------------------
 gcc/tree-vrp.h   |  1 -
 gcc/vr-values.cc | 11 +----------
 3 files changed, 3 insertions(+), 40 deletions(-)

diff --git a/gcc/tree-vrp.cc b/gcc/tree-vrp.cc
index 47cbe769dd4b..473e3da7bbc2 100644
--- a/gcc/tree-vrp.cc
+++ b/gcc/tree-vrp.cc
@@ -547,14 +547,10 @@ get_single_symbol (tree t, bool *neg, tree *inv)
        +2 if VAL1 != VAL2
 
    This is similar to tree_int_cst_compare but supports pointer values
-   and values that cannot be compared at compile time.
-
-   If STRICT_OVERFLOW_P is not NULL, then set *STRICT_OVERFLOW_P to
-   true if the return value is only valid if we assume that signed
-   overflow is undefined.  */
+   and values that cannot be compared at compile time.  */
 
 int
-compare_values_warnv (tree val1, tree val2, bool *strict_overflow_p)
+compare_values (tree val1, tree val2)
 {
   if (val1 == val2)
     return 0;
@@ -593,13 +589,6 @@ compare_values_warnv (tree val1, tree val2, bool 
*strict_overflow_p)
       if (!overflow_undefined)
        return -2;
 
-      if (strict_overflow_p != NULL
-         /* Symbolic range building sets the no-warning bit to declare
-            that overflow doesn't happen.  */
-         && (!inv1 || !warning_suppressed_p (val1, OPT_Woverflow))
-         && (!inv2 || !warning_suppressed_p (val2, OPT_Woverflow)))
-       *strict_overflow_p = true;
-
       if (!inv1)
        inv1 = build_int_cst (TREE_TYPE (val1), 0);
       if (!inv2)
@@ -619,13 +608,6 @@ compare_values_warnv (tree val1, tree val2, bool 
*strict_overflow_p)
       if (!overflow_undefined)
        return -2;
 
-      if (strict_overflow_p != NULL
-         /* Symbolic range building sets the no-warning bit to declare
-            that overflow doesn't happen.  */
-         && (!sym1 || !warning_suppressed_p (val1, OPT_Woverflow))
-         && (!sym2 || !warning_suppressed_p (val2, OPT_Woverflow)))
-       *strict_overflow_p = true;
-
       const signop sgn = TYPE_SIGN (TREE_TYPE (val1));
       tree cst = cst1 ? val1 : val2;
       tree inv = cst1 ? inv2 : inv1;
@@ -716,15 +698,6 @@ compare_values_warnv (tree val1, tree val2, bool 
*strict_overflow_p)
     }
 }
 
-/* Compare values like compare_values_warnv.  */
-
-int
-compare_values (tree val1, tree val2)
-{
-  bool sop;
-  return compare_values_warnv (val1, val2, &sop);
-}
-
 /* Helper for overflow_comparison_p
 
    OP0 CODE OP1 is a comparison.  Examine the comparison and potentially
diff --git a/gcc/tree-vrp.h b/gcc/tree-vrp.h
index 9c0733831e90..2b88ba5230d5 100644
--- a/gcc/tree-vrp.h
+++ b/gcc/tree-vrp.h
@@ -23,7 +23,6 @@ along with GCC; see the file COPYING3.  If not see
 #include "value-range.h"
 
 extern int compare_values (tree, tree);
-extern int compare_values_warnv (tree, tree, bool *);
 
 extern enum value_range_kind intersect_range_with_nonzero_bits
   (enum value_range_kind, wide_int *, wide_int *, const wide_int &, signop);
diff --git a/gcc/vr-values.cc b/gcc/vr-values.cc
index 135217cdc075..f0d9a71bd40e 100644
--- a/gcc/vr-values.cc
+++ b/gcc/vr-values.cc
@@ -868,10 +868,7 @@ simplify_using_ranges::simplify_bit_ops_using_ranges
    a known value range VR.
 
    If there is one and only one value which will satisfy the
-   conditional, then return that value.  Else return NULL.
-
-   If signed overflow must be undefined for the value to satisfy
-   the conditional, then set *STRICT_OVERFLOW_P to true.  */
+   conditional, then return that value.  Else return NULL.  */
 
 static tree
 test_for_singularity (enum tree_code cond_code, tree op0,
@@ -891,9 +888,6 @@ test_for_singularity (enum tree_code cond_code, tree op0,
        {
          tree one = build_int_cst (TREE_TYPE (op0), 1);
          max = fold_build2 (MINUS_EXPR, TREE_TYPE (op0), max, one);
-         /* Signal to compare_values_warnv this expr doesn't overflow.  */
-         if (EXPR_P (max))
-           suppress_warning (max, OPT_Woverflow);
        }
     }
   else if (cond_code == GE_EXPR || cond_code == GT_EXPR)
@@ -905,9 +899,6 @@ test_for_singularity (enum tree_code cond_code, tree op0,
        {
          tree one = build_int_cst (TREE_TYPE (op0), 1);
          min = fold_build2 (PLUS_EXPR, TREE_TYPE (op0), min, one);
-         /* Signal to compare_values_warnv this expr doesn't overflow.  */
-         if (EXPR_P (min))
-           suppress_warning (min, OPT_Woverflow);
        }
     }

Reply via email to