public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/96729] [11 Regression] slow compile with `-g -O3` since r11-39-gf9e1ea10e657af9f
Date: Wed, 16 Sep 2020 19:23:14 +0000	[thread overview]
Message-ID: <bug-96729-4-5RDjZFAgFm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-96729-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jakub Jelinek
<jakub@gcc.gnu.org>:

https://gcc.gnu.org/g:ace10c37de7c2f9f2d419337dc1f173c01f7ec7d

commit r9-8911-gace10c37de7c2f9f2d419337dc1f173c01f7ec7d
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Wed Aug 26 10:30:15 2020 +0200

    dwarf2out: Fix up dwarf2out_next_real_insn caching [PR96729]

    The addition of NOTE_INSN_BEGIN_STMT and NOTE_INSN_INLINE_ENTRY notes
    reintroduced quadratic behavior into dwarf2out_var_location.
    This function needs to know the next real instruction to which the var
    location note applies, but the way final_scan_insn is called outside of
    final.c main loop doesn't make it easy to look up the next real insn in
    there (and for non-dwarf it is even useless).  Usually next real insn is
    only a few notes away, but we can have hundreds of thousands of consecutive
    notes only followed by a real insn.  dwarf2out_var_location to avoid the
    quadratic behavior contains a cache, it remembers the next note and when it
    is called again on that loc_note, it can use the previously computed
    dwarf2out_next_real_insn result, rather than walking the insn chain once
    again.  But, for NOTE_INSN_{BEGIN_STMT,INLINE_ENTRY} dwarf2out_var_location
    is not called while the code puts into the cache those notes, which means
if
    we have e.g. in the worst case NOTE_INSN_VAR_LOCATION and
    NOTE_INSN_BEGIN_STMT notes alternating, the cache is not really used.

    The following patch fixes it by looking up the next NOTE_INSN_VAR_LOCATION
    if any.  While the lookup could be perhaps done together with looking for
    the next real insn once (e.g. in dwarf2out_next_real_insn or its copy),
    there are other dwarf2out_next_real_insn callers which don't need/want that
    behavior and if there are more than two NOTE_INSN_VAR_LOCATION notes
    followed by the same real insn, we need to do that "find next
    NOTE_INSN_VAR_LOCATION" walk anyway.

    On the testcase from the PR this patch speeds it 2.8times, from 0m0.674s
    to 0m0.236s (why it takes for the reporter more than 60s is unknown).

    2020-08-26  Jakub Jelinek  <jakub@redhat.com>

            PR debug/96729
            * dwarf2out.c (dwarf2out_next_real_insn): Adjust function comment.
            (dwarf2out_var_location): Look for next_note only if next_real is
            non-NULL, in that case look for the first non-deleted
            NOTE_INSN_VAR_LOCATION between loc_note and next_real, if any.

    (cherry picked from commit ca1afa261d03c9343dff1208325f87d9ba69ec7a)

  parent reply	other threads:[~2020-09-16 19:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-21  2:01 [Bug c/96729] New: hang on x86_64-linux-gnu with `-g -O3` cnsun at uwaterloo dot ca
2020-08-24  8:16 ` [Bug tree-optimization/96729] [11 Regression] hang on x86_64-linux-gnu with `-g -O3` since r11-39-gf9e1ea10e657af9f marxin at gcc dot gnu.org
2020-08-25 11:19 ` rguenth at gcc dot gnu.org
2020-08-25 12:37 ` rguenth at gcc dot gnu.org
2020-08-25 12:41 ` rguenth at gcc dot gnu.org
2020-08-25 19:12 ` [Bug tree-optimization/96729] [11 Regression] slow compile " jakub at gcc dot gnu.org
2020-08-25 19:59 ` [Bug debug/96729] " jakub at gcc dot gnu.org
2020-08-26  8:11 ` rguenth at gcc dot gnu.org
2020-08-26  8:31 ` cvs-commit at gcc dot gnu.org
2020-09-11  7:47 ` cvs-commit at gcc dot gnu.org
2020-09-16 19:23 ` cvs-commit at gcc dot gnu.org [this message]
2020-09-17 17:59 ` jakub 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-96729-4-5RDjZFAgFm@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).