From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 22D4F3860740; Fri, 17 Feb 2023 13:16:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 22D4F3860740 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676639767; bh=Gez6iVnwn4PoWI1cvGsVj3IaZRaQfstb0TF6tzv0d2U=; h=From:To:Subject:Date:In-Reply-To:References:From; b=AJxuJ8E5AZ5JyncIK+JOhGssrURxWn+ImpxN5djBLIlLneozz7gyp0R6k4Q9Md7J2 aO4MIdGZFxI4AB/QaVgQ9B8iYsJRnh5kdcLAGPU/B9LZU9geJgdr6KexQNXujH2dW3 eXw2/CEzBm3mKW/QZglIaD0qxPNbn9apXCnNX+4s= From: "ubizjak at gmail dot com" 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 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: ubizjak at gmail dot com X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D108832 --- Comment #4 from Uro=C5=A1 Bizjak --- (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 =3D= =3D > from, it obviously > should set *loc =3D to, if it sees REG_P (*loc) && REGNO (*loc) =3D=3D RE= GNO > (from), then > if the mode is the same, it can also just *loc =3D to, but if it is a > different mode, > I'd say for narrower mode it should *loc =3D 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 x8= 6_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.=