From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E31523858C42; Mon, 8 Jan 2024 10:18:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E31523858C42 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704709093; bh=F6HhzUUaDvGUjs9PV5j8cJAaubd3lxzjpmmoBxd3aRc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=PYUBcaOl2VruOTgvl8aEcLhYhE8MJH54xBfU5tsgCVRtWaycJol1cR3jT3i3nOdOG p0vyARqP65jqUQbzeLjxUZ94wfigur3x1sjqKghbgIfbs0hlUVRspBcZjwS8Mce1UV IsI/4X6b3i7EPXai6dx3M+uZZpLEpaDlmw0GzWqE= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113210] [14 Regression] ICE: tree check: expected integer_cst, have cond_expr in get_len, at tree.h:6481 Date: Mon, 08 Jan 2024 10:18:11 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.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=3D113210 --- Comment #13 from Richard Biener --- (In reply to Richard Biener from comment #12) > (In reply to Jakub Jelinek from comment #11) > > (In reply to Richard Biener from comment #9) > > > That is, another fix might be to adjust NITERSM1 to NITERS - 1 when > > > NITERS went constant ... (btw, I want to get rid of _NITERS and only > >=20 > > Or we could only use fold_build2 for the PLUS_EXPR 1 computation if NIT= ERSM1 > > is INTEGER_CST, otherwise use build2... >=20 > I think we should see where the original expression is built but not fold= ed. Hmm, probably in estimate_numbers_of_iterations, if (TREE_CODE (niter_desc.may_be_zero) !=3D INTEGER_CST) niter =3D build3 (COND_EXPR, type, niter_desc.may_be_zero, build_int_cst (type, 0), niter); I vaguely remember code trying to pattern match the COND_EXPR created by this (though it should instead use number_of_iterations_exit). It should be safe to replace the above with fold_build3.=