From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 52257398E468; Fri, 9 Apr 2021 14:23:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52257398E468 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/99830] [11 Regression] ICE: in lra_eliminate_regs_1, at lra-eliminations.c:659 with -O2 -fno-expensive-optimizations -fno-split-wide-types -g Date: Fri, 09 Apr 2021 14:23:13 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: ice-on-valid-code, ra X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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: 11.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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 09 Apr 2021 14:23:13 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99830 --- Comment #9 from Jakub Jelinek --- The particular ICE could be fixed also e.g. with: --- gcc/simplify-rtx.c.jj 2021-01-05 10:59:00.279810449 +0100 +++ gcc/simplify-rtx.c 2021-04-09 16:18:24.275668496 +0200 @@ -470,6 +470,30 @@ simplify_replace_fn_rtx (rtx x, const_rt op0 =3D simplify_replace_fn_rtx (SUBREG_REG (x), old_rtx, fn, dat= a); if (op0 =3D=3D SUBREG_REG (x)) return x; + scalar_int_mode outer_mode, inner_mode; + if (known_eq (subreg_lowpart_offset (GET_MODE (x), + GET_MODE (SUBREG_REG (x))), + SUBREG_BYTE (x)) + && is_int_mode (GET_MODE (x), &outer_mode) + && is_int_mode (GET_MODE (SUBREG_REG (x)), &inner_mode)) + { + if (GET_CODE (op0) =3D=3D ASHIFT + && CONST_INT_P (XEXP (op0, 1)) + && UINTVAL (XEXP (op0, 1)) >=3D GET_MODE_BITSIZE (outer_m= ode)) + return const0_rtx; + if (GET_CODE (op0) =3D=3D IOR + && GET_CODE (XEXP (op0, 1)) =3D=3D ASHIFT + && CONST_INT_P (XEXP (XEXP (op0, 1), 1)) + && UINTVAL (XEXP (XEXP (op0, 1), 1)) + >=3D GET_MODE_BITSIZE (outer_mode)) + op0 =3D XEXP (op0, 0); + if (GET_CODE (op0) =3D=3D IOR + && GET_CODE (XEXP (op0, 0)) =3D=3D ASHIFT + && CONST_INT_P (XEXP (XEXP (op0, 0), 1)) + && UINTVAL (XEXP (XEXP (op0, 0), 1)) + >=3D GET_MODE_BITSIZE (outer_mode)) + op0 =3D XEXP (op0, 1); + } op0 =3D simplify_gen_subreg (GET_MODE (x), op0, GET_MODE (SUBREG_REG (x)), SUBREG_BYTE (x)); but that handles just one specific case that appears in the testcase. Perhaps it is a nice optimization for GCC 12, but can't cover anything else= .=