public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/115629] Inefficient if-convert of masked conditionals
Date: Tue, 25 Jun 2024 09:41:17 +0000	[thread overview]
Message-ID: <bug-115629-4-oiG0CFfGpJ@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-115629-4@http.gcc.gnu.org/bugzilla/>

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2024-06-25
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
I think the transform is profitable for scalar for all cases as well.

Now, if-conversion records BB predicates and uses those to predicate
stmts/PHIs, I'm not sure how to go optimize it on that level.

It's more a CFG transform of a if (A) x; else { if (B) x; else y; } to
if (A || B) x; else y;  with the downside that in this case evaluating
'B' has side-effects (memory dereference which can trap).

Due to the trapping this needs to be somehow done in if-conversion
where you also need to determine that x == x' (both copies of x
evaluate to the same code).  Some scalar GIMPLE opt could have
de-duplicated the BB with 'x' (tail-merging to the rescue?  it considers
the cands but somehow doesn't merge - I think the PHI node isn't
supported).

  parent reply	other threads:[~2024-06-25  9:41 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-25  5:44 [Bug tree-optimization/115629] New: " tnfchris at gcc dot gnu.org
2024-06-25  5:47 ` [Bug tree-optimization/115629] " pinskia at gcc dot gnu.org
2024-06-25  9:41 ` rguenth at gcc dot gnu.org [this message]
2024-06-26 16:53 ` cvs-commit at gcc dot gnu.org
2024-06-26 16:55 ` rguenth at gcc dot gnu.org
2024-07-01 10:10 ` tnfchris at gcc dot gnu.org
2024-07-01 12:27 ` rguenther at suse dot de
2024-07-01 19:33 ` tnfchris at gcc dot gnu.org
2024-07-02  7:03 ` rguenth at gcc dot gnu.org
2024-07-02 19:33 ` rsandifo at gcc dot gnu.org

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-115629-4-oiG0CFfGpJ@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).