public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
To: apinski@marvell.com,
	apinski--- via Gcc-patches <gcc-patches@gcc.gnu.org>,
	gcc-patches@gcc.gnu.org
Cc: Andrew Pinski <apinski@marvell.com>
Subject: Re: [PATCH 3/4] Try inverted comparison for match_simplify in phiopt
Date: Mon, 28 Jun 2021 07:28:57 +0200	[thread overview]
Message-ID: <5A4B805B-BEA7-4EF3-94CE-1E42758D8200@gmail.com> (raw)
In-Reply-To: <1624836300-23553-4-git-send-email-apinski@marvell.com>

On 28 June 2021 01:24:59 CEST, apinski--- via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
>From: Andrew Pinski <apinski@marvell.com>
>
>Since match and simplify does not have all of the inverted
>comparison patterns, it make sense to just have
>phi-opt try to do the inversion and try match and simplify again.
>
>OK? Bootstrapped and tested on x86_64-linux-gnu.
>
>Thanks,
>Andrew Pinski
>
>gcc/ChangeLog:
>
>	* tree-ssa-phiopt.c (gimple_simplify_phiopt):
>	If "A ? B : C" fails to simplify, try "(!A) ? C : B".
>---
> gcc/tree-ssa-phiopt.c | 27 ++++++++++++++++++++++++++-
> 1 file changed, 26 insertions(+), 1 deletion(-)
>
>diff --git a/gcc/tree-ssa-phiopt.c b/gcc/tree-ssa-phiopt.c
>index 17bc597851b..9bda1b2a397 100644
>--- a/gcc/tree-ssa-phiopt.c
>+++ b/gcc/tree-ssa-phiopt.c
>@@ -836,7 +836,8 @@ phiopt_early_allow (enum tree_code code)
>with parts pushed if EARLY_P was true. Also rejects non allowed tree
>code
>    if EARLY_P is set.
>Takes the comparison from COMP_STMT and two args, ARG0 and ARG1 and
>tries
>-   to simplify CMP ? ARG0 : ARG1.  */
>+   to simplify CMP ? ARG0 : ARG1.
>+   Also try to simplify (!CMP) ? ARG0 : ARG1 if the non-inverse
>failed.  */

I think you need to swap the args above?

thanks,

  reply	other threads:[~2021-06-28  5:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-27 23:24 [PATCH 0/4] v4 PHI-OPT move abs_replacement to match.pd apinski
2021-06-27 23:24 ` [PATCH 1/4] Duplicate the range information of the phi onto the new ssa_name apinski
2021-06-28  8:39   ` Richard Biener
2021-06-29 19:02   ` Martin Sebor
2021-06-27 23:24 ` [PATCH 2/4] Allow match-and-simplified phiopt to run in early phiopt apinski
2021-06-28  8:40   ` Richard Biener
2021-06-29 19:11   ` Martin Sebor
2021-06-29 19:54     ` Andrew Pinski
2021-06-27 23:24 ` [PATCH 3/4] Try inverted comparison for match_simplify in phiopt apinski
2021-06-28  5:28   ` Bernhard Reutner-Fischer [this message]
2021-06-28  8:44   ` Richard Biener
2021-06-27 23:25 ` [PATCH 4/4] Port most of the A CMP 0 ? A : -A to match apinski
2021-06-28  9:26   ` Richard Biener

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=5A4B805B-BEA7-4EF3-94CE-1E42758D8200@gmail.com \
    --to=rep.dot.nop@gmail.com \
    --cc=apinski@marvell.com \
    --cc=gcc-patches@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).