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 lto/104237] [11 Regression] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute since r11-3126-ga8f9b4c54cc35062
Date: Sat, 19 Feb 2022 08:02:05 +0000	[thread overview]
Message-ID: <bug-104237-4-jTsbwMx8bd@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104237-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:88ff2eb5cc2c1af2ae751c02997d0b5667662782

commit r11-9594-g88ff2eb5cc2c1af2ae751c02997d0b5667662782
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Jan 28 11:48:18 2022 +0100

    cfgrtl: Fix up locus comparison in unique_locus_on_edge_between_p
[PR104237]

    The testcase in the PR (not included for the testsuite because we don't
    have an (easy) way to -fcompare-debug LTO, we'd need 2
compilations/linking,
    one with -g and one with -g0 and -fdump-rtl-final= at the end of lto1
    and compare that) has different code generation for -g vs. -g0.

    The difference appears during expansion, where we have a goto_locus
    that is at -O0 compared to the INSN_LOCATION of the previous and next insn
    across an edge.  With -g0 the locations are equal and so no nop is added.
    With -g the locations aren't equal and so a nop is added holding that
    location.

    The reason for the different location is in the way how we stream in
    locations by lto1.
    We have lto_location_cache::apply_location_cache that is called with some
    set of expanded locations, qsorts them, creates location_t's for those
    and remembers the last expanded location.
    lto_location_cache::input_location_and_block when read in expanded_location
    is equal to the last expanded location just reuses the last location_t
    (or adds/changes/removes LOCATION_BLOCK in it), when it is not queues
    it for next apply_location_cache.  Now, when streaming in -g input, we can
    see extra locations that don't appear with -g0, and if we are unlucky
    enough, those can be sorted last during apply_location_cache and affect
    what locations are used from the single entry cache next.
    In particular, second apply_location_cache with non-empty loc_cache in
    the testcase has 14 locations with -g0 and 16 with -g and those 2 extra
    ones sort both last (they are the same).  The last one from -g0 then
    appears to be input_location_and_block sourced again, for -g0 triggers
    the single entry cache, while for -g it doesn't and so apply_location_cache
    will create for it another location_t with the same content.

    The following patch fixes it by comparing everything we care about the
    location instead (well, better in addition) to a simple location_t ==
    location_t check.  I think we don't care about the sysp flag for debug
    info...

    2022-01-28  Jakub Jelinek  <jakub@redhat.com>

            PR lto/104237
            * cfgrtl.c (loc_equal): New function.
            (unique_locus_on_edge_between_p): Use it.

    (cherry picked from commit 430dca620fa3d03e53f6771a2b61d3f0ebb73756)

  parent reply	other threads:[~2022-02-19  8:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-26  6:06 [Bug lto/104237] New: Emitted binary code changes when -g is enabled at -O1 -flto tlwang at uwaterloo dot ca
2022-01-26  6:13 ` [Bug lto/104237] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute pinskia at gcc dot gnu.org
2022-01-26  8:39 ` [Bug lto/104237] [11/12 Regression] Emitted binary code changes when -g is enabled at -O1 -flto and optimize attribute since r11-3126-ga8f9b4c54cc35062 marxin at gcc dot gnu.org
2022-01-27 14:59 ` jakub at gcc dot gnu.org
2022-01-27 16:26 ` jakub at gcc dot gnu.org
2022-01-27 18:46 ` jakub at gcc dot gnu.org
2022-01-27 18:46 ` jakub at gcc dot gnu.org
2022-01-27 18:58 ` dmalcolm at gcc dot gnu.org
2022-01-28 10:49 ` cvs-commit at gcc dot gnu.org
2022-01-28 10:57 ` [Bug lto/104237] [11 " jakub at gcc dot gnu.org
2022-01-29  6:35 ` cnsun at uwaterloo dot ca
2022-01-29  9:07 ` jakub at gcc dot gnu.org
2022-02-19  8:02 ` cvs-commit at gcc dot gnu.org [this message]
2022-02-19  8:06 ` jakub at gcc dot gnu.org
2022-02-23 16:03 ` cnsun at uwaterloo dot ca
2022-03-08 20:34 ` cnsun at uwaterloo dot ca
2022-03-08 20:48 ` pinskia at gcc dot gnu.org
2022-03-08 20:49 ` jakub at gcc dot gnu.org
2022-03-08 21:07 ` cnsun at uwaterloo dot ca
2022-06-01 15:02 ` cnsun at uwaterloo dot ca
2022-06-01 16:23 ` pinskia at gcc dot gnu.org
2022-06-01 16:42 ` jakub at gcc dot gnu.org
2022-06-01 17:12 ` cnsun at uwaterloo dot ca

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-104237-4-jTsbwMx8bd@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).