public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "aldyh at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug tree-optimization/106422] [13 Regression] ice in duplicate_block, at cfghooks.cc:1115
Date: Thu, 28 Jul 2022 14:44:26 +0000	[thread overview]
Message-ID: <bug-106422-4-cuOQ9X3KBf@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-106422-4@http.gcc.gnu.org/bugzilla/>

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

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

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

--- Comment #13 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
(In reply to Alexander Monakov from comment #12)
> Aldy, could you please have a look? Forward jump threading calls
> duplicate_block without checking can_duplicate_block_p — was that supposed
> to work?

[Big caveat here: This is beyond my expertise as I've been careful not to touch
anything dealing with the block copiers in either the backward or the forward
threaders.]

There are two block copiers in tree-ssa-threadupdate.cc
(*_jt_path_registry::update_cfg), one for each of the threader implementations.

It seems the backward one is doing the right thing, because it calls
duplicate_thread_path() which calls can_duplicate_block_p downstream.

For that matter, the ethread pass (backward threader) finds this exact path,
registers it, but then silently drops it because of the checks in
duplicate_thread_path():

  [1] Registering jump thread: (2, 5) incoming edge;  (5, 7) nocopy; 

The forward threader seems to have more ad-hoc ways of determining
threadability, like potentially_threadable_block(), but AFAICT it never checks
can_duplicate_block_p.  I suppose one could just add a can_duplicate_block_p
check to potentially_threadable_block.

But a better approach would be to drop these problematic paths at registration.
 We already have a gate for precisely these things (cancel_invalid_paths), and
it would be shared between both threaders.  Furthermore, it would add a nice
message in the log as to why the path was dropped.

I don't have the cycles to fix this, but I can provide of a proof of concept
that may be enough.

  parent reply	other threads:[~2022-07-28 14:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-23 21:50 [Bug c/106422] New: " dcb314 at hotmail dot com
2022-07-23 22:01 ` [Bug tree-optimization/106422] [13 Regression] " pinskia at gcc dot gnu.org
2022-07-23 22:07 ` pinskia at gcc dot gnu.org
2022-07-24  6:09 ` dcb314 at hotmail dot com
2022-07-24 11:05 ` amonakov at gcc dot gnu.org
2022-07-24 11:09 ` amonakov at gcc dot gnu.org
2022-07-25  7:06 ` marxin at gcc dot gnu.org
2022-07-25  9:30 ` rguenth at gcc dot gnu.org
2022-07-25 14:00 ` amonakov at gcc dot gnu.org
2022-07-25 14:06 ` amonakov at gcc dot gnu.org
2022-07-25 14:46 ` rguenth at gcc dot gnu.org
2022-07-25 17:28 ` amonakov at gcc dot gnu.org
2022-07-25 17:40 ` amonakov at gcc dot gnu.org
2022-07-28  7:53 ` amonakov at gcc dot gnu.org
2022-07-28 14:44 ` aldyh at gcc dot gnu.org [this message]
2022-07-28 14:48 ` aldyh at gcc dot gnu.org
2022-07-29  6:14 ` rguenth at gcc dot gnu.org
2022-07-29  8:48 ` cvs-commit at gcc dot gnu.org
2022-07-29  8:48 ` 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-106422-4-cuOQ9X3KBf@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).