Drea Pinski (pinskia) <[email protected]> requested changes to the code:


> +++ gcc/match.pd
> @@ -12710,0 +12719,4 @@
> +   (with {
> +     tree bound = (minmax == MIN_EXPR)
> +               ? TYPE_MAX_VALUE (type)
> +               : TYPE_MIN_VALUE (type);
I think we should use the ranger here.
Similar to minmax_from_comparison.
It should be something like
```
          int_range_max r;
          get_range_query (cfun)->range_of_expr (r, @0);
          if (r.undefined_p ())
            r.set_varying (TREE_TYPE (@0));
          widest_int value;
          if (minmax == MIN_EXPR)
            value = widest_int::from (r.upper_bound (),
                                                     TYPE_SIGN (TREE_TYPE 
(@0)));
          else
            value = widest_int::from (r.lower_bound (),
                                                     TYPE_SIGN (TREE_TYPE 
(@0)));
```
Then the if would be:
          if (max == wi::to_widdest (@0))


--
https://forge.sourceware.org/gcc/gcc/pulls/214#issuecomment-7122

Reply via email to