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 rtl-optimization/104459] [9/10/11/12 Regression] '-fcompare-debug' failure w/ -O2 -funswitch-loops -fno-tree-dce
Date: Fri, 11 Feb 2022 10:24:14 +0000	[thread overview]
Message-ID: <bug-104459-4-gezMvKL46e@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-104459-4@http.gcc.gnu.org/bugzilla/>

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

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

https://gcc.gnu.org/g:18c8086d65f3d539e065ea7c97e3de6f3bbdf684

commit r12-7194-g18c8086d65f3d539e065ea7c97e3de6f3bbdf684
Author: Jakub Jelinek <jakub@redhat.com>
Date:   Fri Feb 11 11:21:24 2022 +0100

    df: Don't set bbs dirty because of debug insn moves [PR104459]

    As mentioned in the PR, we get -fcompare-debug failure, which is caused by
    cfg_layout_merge_blocks successfully merging two bbs where both bbs
    contained just CODE_LABEL, NOTE_INSN_BASIC_BLOCK and in the -g case both
    some debug insns at the end.  cfg_layout_merge_blocks calls
    update_bb_for_insn_chain which for the post-label insns in the second block
    (except for BARRIERs) calls df_insn_change_bb.  This function changes
    the bb of the insns and for notes just punts, but for other insns calls
    df_set_bb_dirty.  Now the problem is that because there were only debug
    insns and notes in the second block, df_set_bb_dirty is called on both
    only in the -g case and not with -g0.  df_set_bb_dirty these days
    sets both the BB_MODIFIED flag and marks the bb as dirty, and the former
    is what 6 spots in cfgcleanup.cc use in code-generation decisions,
    in this case
              may_thread |= (target->flags & BB_MODIFIED) != 0;
    in particular.  So, with -g may_thread is true while with -g0 it is not
    and we diverge from that point onwards.
    I've thought about introducing df_set_bb_dirty_nondebug that wouldn't
    set BB_MODIFIED but would mark the bb dirty, but then I went through
    history and found changes like:
    https://gcc.gnu.org/legacy-ml/gcc-patches/2010-10/msg00059.html
    so I've also tried just not calling df_set_bb_dirty for debug insns
    at all and it passed x86_64-linux and i686-linux
    --enable-checking=yes,rtl,extra,df bootstraps/regtests, so perhaps
    that works too.
    Now that I look at it again, if we don't need those from %d to %d messages
    for debug insns in the dump files, another way to fix it would be just to
    change the very first line in the hunk from
      if (!INSN_P (insn))
    to
      if (!DEBUG_INSN_P (insn))
    Though, df_set_bb_dirty_nondebug which will do everything but
    set bb->flags |= BB_MODIFIED is yet another option I can test.
    Perhaps even that PR42889 was solely about those 6 decisions in cfgcleanup
    (at that point it used df_get_bb_dirty) and not about actually the
    recomputation of some of the problems causing different code generations.

    2022-02-11  Jakub Jelinek  <jakub@redhat.com>

            PR rtl-optimization/104459
            * df-scan.cc (df_insn_change_bb): Don't call df_set_bb_dirty when
            moving DEBUG_INSNs between bbs.

            * gcc.dg/pr104459.c: New test.

  parent reply	other threads:[~2022-02-11 10:24 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-09 11:43 [Bug debug/104459] New: " asolokha at gmx dot com
2022-02-09 12:03 ` [Bug rtl-optimization/104459] " rguenth at gcc dot gnu.org
2022-02-09 18:56 ` jakub at gcc dot gnu.org
2022-02-09 19:07 ` jakub at gcc dot gnu.org
2022-02-09 19:13 ` jakub at gcc dot gnu.org
2022-02-11 10:24 ` cvs-commit at gcc dot gnu.org [this message]
2022-02-11 11:00 ` [Bug rtl-optimization/104459] [9/10/11 " jakub at gcc dot gnu.org
2022-05-27  9:47 ` [Bug rtl-optimization/104459] [10/11 " rguenth at gcc dot gnu.org
2022-06-28 10:48 ` jakub at gcc dot gnu.org
2023-07-07 10:42 ` [Bug rtl-optimization/104459] [11 " 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-104459-4-gezMvKL46e@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).