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/100817] ICE with -O2: in compute_antic, at tree-ssa-pre.c:2513
Date: Mon, 31 May 2021 08:35:56 +0000	[thread overview]
Message-ID: <bug-100817-4-DV3onxxUwf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-100817-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
The number of iterations grows linear with loop depth, starting with 6 for

for (; a;)
 for (; a >= 0;)
  for (; a;)
   for (; a; a += 2)
    ;

adding 2 for every

 for (; a;)
  for (; a >= 0;)

added.  The issue is that the postorder on the inverted graph chosen for
iteration is "worst" in how it iterates over the loop nest.  Adding an
exit to the innermost loop makes antic iteration iterate two times independent
on loop depth.  For anti iteration it's important to minimize the number of
blocks that are visited before all sucessors are visited, but here the whole
loop nest is only backwards reachable via backedges but there walking the
nest outer-to-inner producing N such blocks.

Now, doing reverse program order iteration after the initial postorder
traversal would fix this, so I'm going to explore this idea.

  parent reply	other threads:[~2021-05-31  8:35 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-28 17:24 [Bug c/100817] New: " cnsun at uwaterloo dot ca
2021-05-28 19:24 ` [Bug tree-optimization/100817] " pinskia at gcc dot gnu.org
2021-05-31  6:53 ` rguenth at gcc dot gnu.org
2021-05-31  8:35 ` rguenth at gcc dot gnu.org [this message]
2021-05-31  9:32 ` rguenth at gcc dot gnu.org
2021-06-01  6:34 ` rguenth 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-100817-4-DV3onxxUwf@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).