On Wed, May 27, 2026 at 5:51 AM Daniel Barboza
<[email protected]> wrote:
>
> Remove compare_values_warn and all the Wstrict-overflow related logic
> from the previous callers.

Ok.

>
> 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.
> ---
>  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 e080af5fcaa..a112e5e1be2 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 9c0733831e9..2b88ba5230d 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 7d486c3a306..cdd5db1a195 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);
>         }
>      }
>
> --
> 2.43.0
>

Reply via email to