public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug debug/108573] [13 Regression] '-fcompare-debug' failure (length) at -O2
Date: Tue, 31 Jan 2023 17:05:52 +0000	[thread overview]
Message-ID: <bug-108573-4-2SRPx2OxJp@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108573-4@http.gcc.gnu.org/bugzilla/>

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

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

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

--- Comment #2 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
So, I believe this has been caused by the r7-4871-g4da41abf84cc6796aa8b
PR78437 change.
      /* On RISC machines we must make sure that changing the mode of SRC_REG
         as destination register will not affect its reaching uses, which may
         read its value in a larger mode because DEF_INSN implicitly sets it
         in word mode.  */
      poly_int64 prec
        = GET_MODE_PRECISION (GET_MODE (SET_DEST (*dest_sub_rtx)));
      if (WORD_REGISTER_OPERATIONS && known_lt (prec, BITS_PER_WORD))
        {
          struct df_link *uses = get_uses (def_insn, src_reg);
          if (!uses)
            return false;

          for (df_link *use = uses; use; use = use->next)
            if (paradoxical_subreg_p (GET_MODE (*DF_REF_LOC (use->ref)),
                                      GET_MODE (SET_DEST (*dest_sub_rtx))))
              return false;
        }
The problem is that without -g, there are just 2 uses:
(insn 10029 10027 10052 2 (set (reg:SI 10 a0 [167])
        (minus:SI (reg:SI 10 a0 [160])
            (reg:SI 9 s1 [165]))) "pr108573.c":12:5 12 {subsi3}
     (nil))
and
(insn 10023 9 10027 2 (set (reg:DI 15 a5 [orig:139 _6 ] [139])
        (sign_extend:DI (reg:SI 10 a0 [160]))) "pr108573.c":11:5 116
{extendsidi2}
     (nil))
but with -g there another one:
(debug_insn 8 7 9 2 (var_location:HI s (minus:HI (subreg:HI (and:DI (reg:DI 10
a0 [160])
                (const_int 1 [0x1])) 0)
        (subreg:HI (ashiftrt:DI (reg/v:DI 9 s1 [orig:151 l ] [151])
                (debug_expr:SI D#1)) 0))) "pr108573.c":12:5 -1
     (nil))
Now, because it uses DImode for a0 rather than SImode like the others, without
-g
we don't return false but with -g we do.

Code generation decisions shouldn't be based on the DEBUG_INSN uses.
So, at least in this decision we should ignore debug uses, we can then do
something with the DEBUG_INSNs, reset them, adjust, whatever (I think at least
the above one clearly doesn't care about the upper bits).

  parent reply	other threads:[~2023-01-31 17:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-27 16:38 [Bug debug/108573] New: " zsojka at seznam dot cz
2023-01-30  7:58 ` [Bug debug/108573] " rguenth at gcc dot gnu.org
2023-01-31 16:38 ` jakub at gcc dot gnu.org
2023-01-31 17:05 ` jakub at gcc dot gnu.org [this message]
2023-01-31 17:46 ` jakub at gcc dot gnu.org
2023-02-01 11:53 ` cvs-commit at gcc dot gnu.org
2023-02-01 11:54 ` jakub at gcc dot gnu.org
2023-02-10 17:46 ` cvs-commit at gcc dot gnu.org
2023-05-02 20:14 ` cvs-commit at gcc dot gnu.org
2023-05-03 15:21 ` cvs-commit 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-108573-4-2SRPx2OxJp@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).