https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119683

--- Comment #11 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jakub Jelinek <[email protected]>:

https://gcc.gnu.org/g:b7169019d7d75d7bdc93cfce86ee161627df3c22

commit r16-5646-gb7169019d7d75d7bdc93cfce86ee161627df3c22
Author: Jakub Jelinek <[email protected]>
Date:   Thu Nov 27 11:54:43 2025 +0100

    match.pd: Introduce gimple_match_range_of_expr [PR119683]

    On Wed, Nov 26, 2025 at 09:52:50AM +0100, Richard Biener wrote:
    > I wonder if it makes sense to wrap
    > get_range_query (cfun)->range_of_expr (r, @0, gimple_match_ctx (@4))
    > into sth like gimple_match_range_of_expr (r, @0, @4)?

    It does make sense, so the following patch implements that.
    Note, gimple-match.h is a bad location for that helper, because
    lots of users use it without having value-range.h included and
    it is for APIs to use the gimple folders, not for match.pd helpers
    themselves, so I've moved there gimple_match_ctx as well.

    2025-11-27  Jakub Jelinek  <[email protected]>

            PR tree-optimization/119683
            * gimple-match.h (gimple_match_ctx): Move to ...
            * gimple-match-head.cc (gimple_match_ctx): ... here.  Make static.
            (gimple_match_range_of_expr): New static inline.
            * match.pd ((mult (plus:s (mult:s @0 @1) @2) @3)): Use
            gimple_match_range_of_expr.
            ((plus (mult:s (plus:s @0 @1) @2) @3)): Likewise.
            ((t * u) / u -> t): Likewise.
            ((t * u) / v -> t * (u / v)): Likewise.
            ((X + M*N) / N -> X / N + M): Likewise.
            ((X - M*N) / N -> X / N - M): Likewise.
            ((X + C) / N -> X / N + C / N): Likewise.
            (((T)(A)) + CST -> (T)(A + CST)): Likewise
            (x_5 == cstN ? cst4 : cst3): Likewise.  Do r.set_varying
            even when gimple_match_range_of_expr failed.

Reply via email to