public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Aldy Hernandez <aldyh@redhat.com>
Cc: Jeff Law <jeffreyalaw@gmail.com>,
	 Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Improve jump threading dump output.
Date: Wed, 29 Sep 2021 10:53:35 +0200	[thread overview]
Message-ID: <CAFiYyc1YQ8SLF19Wy3WmMm-hKRadCaKuwyjYj57kR-2ddSv4BQ@mail.gmail.com> (raw)
In-Reply-To: <5a5b6455-15f6-aa15-45f9-f8943ac0ecfd@redhat.com>

On Tue, Sep 28, 2021 at 6:13 PM Aldy Hernandez <aldyh@redhat.com> wrote:
>
>
>
> On 9/28/21 6:05 PM, Richard Biener wrote:
> > On September 28, 2021 5:45:52 PM GMT+02:00, Jeff Law via Gcc-patches <gcc-patches@gcc.gnu.org> wrote:
> >>
> >>
> >> On 9/28/2021 7:53 AM, Aldy Hernandez wrote:
> >>>
> >>>
> >>> On 9/28/21 3:47 PM, Jeff Law wrote:
> >>>>
> >>>>
> >>>> On 9/28/2021 3:45 AM, Aldy Hernandez wrote:
> >>>>> In analyzing PR102511, it has become abundantly clear that we need
> >>>>> better debugging aids for the jump threader solver.  Currently
> >>>>> debugging these issues is a nightmare if you're not intimately
> >>>>> familiar with the code.  This patch attempts to improve this.
> >>>>>
> >>>>> First, I'm enabling path solver dumps with TDF_THREADING. None of the
> >>>>> available TDF_* flags are a good match, and using TDF_DETAILS would
> >>>>> blow
> >>>>> up the dump file, since both threaders continually call the solver to
> >>>>> try out candidates.  This will allow dumping path solver details
> >>>>> without
> >>>>> having to resort to hacking the source.
> >>>>>
> >>>>> I am also dumping the current registered_jump_thread dbg counter used
> >>>>> by the registry, in the solver.  That way narrowing down a problematic
> >>>>> thread can then be examined by -fdump-*-threading and looking at the
> >>>>> solver details surrounding the appropriate counter (which the dbgcnt
> >>>>> also dumps to the dump file).
> >>>>>
> >>>>> You still need knowledge of the solver to debug these issues, but at
> >>>>> least now it's not entirely opaque.
> >>>>>
> >>>>> OK?
> >>>>>
> >>>>> gcc/ChangeLog:
> >>>>>
> >>>>>      * dbgcnt.c (dbg_cnt_counter): New.
> >>>>>      * dbgcnt.h (dbg_cnt_counter): New.
> >>>>>      * dumpfile.c (dump_options): Add entry for TDF_THREADING.
> >>>>>      * dumpfile.h (enum dump_flag): Add TDF_THREADING.
> >>>>>      * gimple-range-path.cc (DEBUG_SOLVER): Use TDF_THREADING.
> >>>>>      * tree-ssa-threadupdate.c (dump_jump_thread_path): Dump out
> >>>>>      debug counter.
> >>>> OK.
> >>>>
> >>>> Note we've got massive failures in the tester starting sometime
> >>>> yesterday and I suspect all the threader work.    So I'm going to
> >>>> slow down on reviews of that code as we stabilize stuff.
> >>>
> >>> Fair enough.  Let's knock those out then.
> >> So several are failing gcc.dg/loop-unswitch-3.c.
> >>
> >> This test appears to be verifying that we unswitch a test in one of the
> >> loops, which is no longer happening after the change to replace the VRP
> >> threader with the hybrid forward threader.
> >>
> >> So both the old VRP threader and the new style identify and realize a
> >> single jump thread.
> >>
> >> In the old VRP threader realization of the jump thread ends up creating
> >> nested loops.  In the new implementation we end up creating a single
> >> loop with two back edges to the header.
> >>
> >> ie, the (partial) graphs look like this
> >>
> >> OLD
> >>
> >>         1<--+
> >>         |      |
> >> +->  2     |
> >> |    /   \   |
> >> |  3     4  |
> >> +- +     +-+
> >>
> >> NEW
> >>
> >>
> >> +->  2 <-+
> >> |    /   \   |
> >> |  3     4  |
> >> +- +     +-+
> >>
> >>
> >> I wonder if we're not doing proper loop fixups or something similar
> >> after that change.  IIRC we have/had bits in the copier and CFG update
> >> code to mark the loops that need re-analysis and fixing up.
> >>
> >> Anyway, you should be able to trigger and analyze with a cross compiler.
> >>
> >> I've got to switch to my day job, but I'll pass along more as I get a
> >> chance to look at them.
> >
> > If you're stuck I'm also happy to help. Note that relying on loop fixup is almost never good because we easily lose track of loop association of info like OMP simd loops and all loop pragmas.
>
> I could absolutely use the help here.  Care to take a look?

Any hint on which target FAILs gcc.dg/loop-unswitch-3.c?

Richard.

> Aldy
>

  reply	other threads:[~2021-09-29  8:53 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-28  9:45 Aldy Hernandez
2021-09-28 13:47 ` Jeff Law
2021-09-28 13:53   ` Aldy Hernandez
2021-09-28 13:56     ` Jeff Law
2021-09-28 15:45     ` Jeff Law
2021-09-28 16:05       ` Richard Biener
2021-09-28 16:13         ` Aldy Hernandez
2021-09-29  8:53           ` Richard Biener [this message]
2021-09-30  0:49             ` Jeff Law
2021-09-28 16:05       ` Richard Biener
2021-09-30 18:26     ` Jeff Law
2021-10-04 12:05       ` Aldy Hernandez
2021-10-04 13:29         ` Jeff Law

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=CAFiYyc1YQ8SLF19Wy3WmMm-hKRadCaKuwyjYj57kR-2ddSv4BQ@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=aldyh@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    /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).