public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/110199] [12/13/14 Regression] Missing VRP transformation with MIN_EXPR and known relation
Date: Sun, 10 Mar 2024 18:05:04 +0000	[thread overview]
Message-ID: <bug-110199-4-EkA9oglqVf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-110199-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:

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

commit r14-9419-g8fe27ed193d60f6cd8b34761858a720c95eabbdb
Author: jlaw <jeffreyalaw@gmail.com>
Date:   Sun Mar 10 11:58:00 2024 -0600

    [committed] [PR tree-optimization/110199] Simplify MIN/MAX more often

    So as I mentioned in the BZ, the case of

    t = MIN_EXPR (A, B)

    where we know something about the relationship between A and B can be
trivially
    handled by some existing code in DOM.  That existing code would simplify
when A
    == B.  But by testing GE and LE instead of EQ we can cover more cases with
    minimal effort.  When applicable the MIN/MAX turns into a simple copy.

    I made one other change.  We have other binary operations that we simplify
when
    we know something about the relationship between the operands.  That code
was
    not canonicalizing the order of operands when building the expression to
lookup
    in the hash tables to discover that relationship.  Since those paths are
only
    testing for equality, we can trivially reverse them and not have to worry
about
    changing codes or anything like that.  So extremely safe and avoids having
to
    come back and fix that code to match the MIN_EXPR/MAX_EXPR case later.

    Bootstrapped on x86 and also tested on the crosses.  I briefly thought
there
    was an sh regression, but that was actually the recent fwprop changes
twiddling
    code generation for one test.

            PR tree-optimization/110199
    gcc/
            * tree-ssa-scopedtables.cc
            (avail_exprs_stack::simplify_binary_operation): Generalize handling
            of MIN_EXPR/MAX_EXPR to allow additional simplifications. 
Canonicalize
            comparison operands for other cases.

    gcc/testsuite

            * gcc.dg/tree-ssa/minmax-27.c: New test.
            * gcc.dg/tree-ssa/minmax-28.c: New test.

      parent reply	other threads:[~2024-03-10 18:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-09 22:28 [Bug tree-optimization/110199] New: " pinskia at gcc dot gnu.org
2023-06-09 22:28 ` [Bug tree-optimization/110199] " pinskia at gcc dot gnu.org
2023-06-09 22:29 ` pinskia at gcc dot gnu.org
2023-06-12  8:11 ` rguenth at gcc dot gnu.org
2023-08-11 23:57 ` pinskia at gcc dot gnu.org
2023-12-12 21:59 ` amacleod at redhat dot com
2024-03-06 16:13 ` jakub at gcc dot gnu.org
2024-03-06 16:47 ` amacleod at redhat dot com
2024-03-07 13:34 ` law at gcc dot gnu.org
2024-03-10 18:05 ` cvs-commit at gcc dot gnu.org [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-110199-4-EkA9oglqVf@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).