public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ubizjak at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug target/108832] [13 Regression] ICE in replace_rtx, at rtlanal.cc:3358
Date: Fri, 17 Feb 2023 13:16:06 +0000	[thread overview]
Message-ID: <bug-108832-4-ZRV7DVA2hk@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-108832-4@http.gcc.gnu.org/bugzilla/>

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

--- Comment #4 from Uroš Bizjak <ubizjak at gmail dot com> ---
(In reply to Jakub Jelinek from comment #1)

> and so ICEs if we see the same REGNO as from in a different mode.
> I think we actually don't need most of what replace_rtx is doing, we don't
> need to simplify anything etc. because we are just changing one register to
> another and can do it in place.
> So, I think we need a different function for what the backend wants.
> It can avoid all the simplify stuff because replace_rtx was destructive, so
> could be implemented say using FOR_EACH_SUBRTX_PTR.  When seeing *loc ==
> from, it obviously
> should set *loc = to, if it sees REG_P (*loc) && REGNO (*loc) == REGNO
> (from), then
> if the mode is the same, it can also just *loc = to, but if it is a
> different mode,
> I'd say for narrower mode it should *loc = gen_rtx_REG (GET_MODE (*loc),
> REGNO (to));
> and for wider mode (especially if say a multi-register reg) punt.
> Not sure if such a case can occur though, but the punting would be hard if
> we have made some changes already...

There are no multi-registers in flags-setting integer instructions, we only
have instructions with implicit ZERO_EXTEND from SI to DImode in case of x86_64
target.

So, a FOR_EACH_RTX loop that blindly changes REGNOs of the RTX should do the
trick. Perhaps do it on a copied RTX, to avoid nasty surprises.

  parent reply	other threads:[~2023-02-17 13:16 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-17 10:28 [Bug target/108832] New: " asolokha at gmx dot com
2023-02-17 11:40 ` [Bug target/108832] " jakub at gcc dot gnu.org
2023-02-17 11:51 ` rguenth at gcc dot gnu.org
2023-02-17 11:57 ` jakub at gcc dot gnu.org
2023-02-17 13:16 ` ubizjak at gmail dot com [this message]
2023-02-17 13:21 ` jakub at gcc dot gnu.org
2023-02-17 13:45 ` jakub at gcc dot gnu.org
2023-02-18 11:41 ` cvs-commit at gcc dot gnu.org
2023-02-18 11:41 ` 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-108832-4-ZRV7DVA2hk@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).