From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DCA5E385B526; Sat, 18 Feb 2023 11:41:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DCA5E385B526 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1676720481; bh=aSaqfee/K1v6l/gS1KU/eUn6DwKdtdDe6RtX1Lxhg/g=; h=From:To:Subject:Date:In-Reply-To:References:From; b=kFouCrBkzniRtvIxExOrS4yUKIiQ8RR9Fa2CMs1XSOTtyKiJKRBKism+YMstN5I7w hIcrNVtKnhnYuw8lmjkfx+kW4B3XAlbpGwZKYOA6Jy7gHJFn6LTVFi4AYbJODVUEEB vXs2IH3rPBD6IEUAlFpscteC7VJ5h/JSndv3C7ww= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/108832] [13 Regression] ICE in replace_rtx, at rtlanal.cc:3358 Date: Sat, 18 Feb 2023 11:41:19 +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: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: jakub 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 #6 from CVS Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:3c135697fd5f79db0954a79a48dcbba657e93f2e commit r13-6131-g3c135697fd5f79db0954a79a48dcbba657e93f2e Author: Jakub Jelinek Date: Sat Feb 18 12:40:04 2023 +0100 i386: Fix up replacement of registers in certain peephole2s [PR108832] As mentioned in the PR, replace_rtx has 2 modes, one that only replaces x =3D=3D from with to, the other which i386.md uses which also replaces REGNO (x) =3D=3D REGNO (from) with to if both are REGs, but assert they= have the same mode. This is reasonable behavior if one replaces from with some other expression, say constant etc., but ICEs whenever the register appears in a different mode, which happens e.g. on the following testca= se, where from/to has DImode but inside of the operands we have SImode of the from register. replace_rtx also does some limited simplifications (though far less than simplify_replace_fn_rtx), which is needed if from a REG is replaced say with CONST_INT, but the peephole2s that use this only replace one REG with another one. The following patch introduces a new backend function for this, avoids doing any simplifications and just replaces the REGs, for safety on a copy of the expression if any changes will be needed. 2023-02-18 Jakub Jelinek PR target/108832 * config/i386/i386-protos.h (ix86_replace_reg_with_reg): Declar= e. * config/i386/i386-expand.cc (ix86_replace_reg_with_reg): New function. * config/i386/i386.md: Replace replace_rtx calls in all peephol= e2s with ix86_replace_reg_with_reg. * gcc.target/i386/pr108832.c: New test.=