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/84646] Missed optimisation for hoisting conditions outside nested loops
Date: Thu, 10 Nov 2022 15:13:05 +0000	[thread overview]
Message-ID: <bug-84646-4-PN134l9SkI@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-84646-4@http.gcc.gnu.org/bugzilla/>

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fxue at gcc dot gnu.org

--- Comment #11 from Richard Biener <rguenth at gcc dot gnu.org> ---
So with the last patch I have we eliminate the empty loop that's created by
threading but the result is still (or now "again") the imperfect result
mentioned in the original description - we fail to exit the outer loop.

The main thing the patches in this series did is restore the threading
that did the inner loop optimization and the required cleanup.  I don't
think that this particular thread itself can be enhanced to cover exiting
the outer loop.  In particular we ask to thread across the loop exit but
we know nothing about that apart from the code in the remaining iterations
having no side-effect.

I'm not sure which kind of pass/transform would be suited to cover this
in a more general way than jump threading does.  We do have loop splitting
which handles this as part of splitting on a "semi-invariant" condition
but that fails quite early because it's

   if (running)
     {
       if (other)
         running = 0;
     }

and we don't seem to handle the conditional "semi-invariant" condition
case.

  parent reply	other threads:[~2022-11-10 15:13 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <bug-84646-4@http.gcc.gnu.org/bugzilla/>
2022-11-09  8:17 ` rguenth at gcc dot gnu.org
2022-11-09  8:39 ` rguenth at gcc dot gnu.org
2022-11-09  9:01 ` aldyh at gcc dot gnu.org
2022-11-09 12:54 ` rguenth at gcc dot gnu.org
2022-11-10 11:22 ` rguenth at gcc dot gnu.org
2022-11-10 13:13 ` cvs-commit at gcc dot gnu.org
2022-11-10 13:37 ` rguenth at gcc dot gnu.org
2022-11-10 14:19 ` cvs-commit at gcc dot gnu.org
2022-11-10 15:13 ` rguenth at gcc dot gnu.org [this message]
2022-11-11 13:32 ` cvs-commit 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-84646-4-PN134l9SkI@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).