public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeff Law <jeffreyalaw@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>, Richard Biener <rguenther@suse.de>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>,
	"MacLeod, Andrew" <amacleod@redhat.com>
Subject: Re: [PATCH] Support threading of just the exit edge
Date: Mon, 15 Aug 2022 09:22:53 -0600	[thread overview]
Message-ID: <2f2c8baf-e92d-4e5f-0e4c-b8369e406ac6@gmail.com> (raw)
In-Reply-To: <CAGm3qMXTtOQT61bf3h2OfJzQDAbgb8TAAPj-7urD8tnVoLr+EA@mail.gmail.com>



On 8/12/2022 10:03 AM, Aldy Hernandez wrote:
> On Fri, Aug 12, 2022 at 2:01 PM Richard Biener <rguenther@suse.de> wrote:
>> This started with noticing we add ENTRY_BLOCK to our threads
>> just for the sake of simplifying the conditional at the end of
>> the first block in a function.  That's not really threading
>> anything but it ends up duplicating the entry block, and
>> re-writing the result instead of statically fold the jump.
> Hmmm, but threading 2 blocks is not really threading at all??  Unless
> I'm misunderstanding something, this was even documented in the
> backwards threader:
>
> [snip]
>       That's not really a jump threading opportunity, but instead is
>       simple cprop & simplification.  We could handle it here if we
>       wanted by wiring up all the incoming edges.  If we run this
>       early in IPA, that might be worth doing.   For now we just
>       reject that case.  */
>    if (m_path.length () <= 1)
>        return false;
My recollection is that code was supposed to filter out the case where 
the threading path is just a definition block and a use block where the 
definition block dominated the use block.    For that case, threading 
isn't really needed as we can just use const/copy propagation to 
propagate the value from the def to the use which should in turn allow 
the use (the conditional branch) to be simplified away -- all without 
the block copying and associated CFG updates.

What doesn't make sense to me today is how do we know there's a 
dominator relationship between the two blocks?



Jeff

      parent reply	other threads:[~2022-08-15 15:22 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-12 12:01 Richard Biener
2022-08-12 16:03 ` Aldy Hernandez
2022-08-15  9:39   ` Richard Biener
2022-08-15 19:09     ` Aldy Hernandez
2022-08-15 19:24       ` Andrew MacLeod
2022-08-15 19:29         ` Aldy Hernandez
2022-08-16  9:18           ` Richard Biener
2022-08-16 10:06             ` Aldy Hernandez
2022-08-16 11:32               ` Richard Biener
2022-08-16 11:42                 ` Aldy Hernandez
2022-08-16 13:44                 ` Richard Biener
2022-08-16 14:30             ` Andrew MacLeod
2022-08-17  7:42               ` Richard Biener
2022-08-17 14:39                 ` Andrew MacLeod
2022-08-18  7:08                   ` Richard Biener
2022-08-18 13:18                     ` Andrew MacLeod
2022-08-15 15:22   ` Jeff Law [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=2f2c8baf-e92d-4e5f-0e4c-b8369e406ac6@gmail.com \
    --to=jeffreyalaw@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=amacleod@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=rguenther@suse.de \
    /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).