From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B52483858D37; Tue, 26 Apr 2022 06:33:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B52483858D37 From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/105374] [12 Regression] ICE in fold_convert_loc, at fold-const.cc:2580 during GIMPLE pass: reassoc since r12-7338-g884f77b4222289510e1df9db2889b60c5df6fcda Date: Tue, 26 Apr 2022 06:33:10 +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: 12.0 X-Bugzilla-Keywords: ice-on-valid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org 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: 12.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: Tue, 26 Apr 2022 06:33:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105374 --- Comment #8 from Richard Biener --- (In reply to Jakub Jelinek from comment #2) > This can (and IMHO should no matter what) be fixed in reassoc by: > --- gcc/tree-ssa-reassoc.cc.jj 2022-04-14 13:46:59.690140053 +0200 > +++ gcc/tree-ssa-reassoc.cc 2022-04-25 15:34:03.811473537 +0200 > @@ -2254,7 +2254,11 @@ eliminate_redundant_comparison (enum tre > BIT_AND_EXPR or BIT_IOR_EXPR was of a wider integer type, > we need to convert. */ > if (!useless_type_conversion_p (TREE_TYPE (curr->op), TREE_TYPE (t= ))) > - t =3D fold_convert (TREE_TYPE (curr->op), t); > + { > + if (!fold_convertible_p (TREE_TYPE (curr->op), t)) > + continue; > + t =3D fold_convert (TREE_TYPE (curr->op), t); > + } Note for vectors the "appropriate" way to make a value from a bool is bool ? -1 : 0 though I guess the question is whether we know if we want a vector true (-1) or a scalar true (1) here ... >=20=20 > if (TREE_CODE (t) !=3D INTEGER_CST > && !operand_equal_p (t, curr->op, 0)) >=20 > But another question is if we shouldn't actually optimize it rather than > punting out. Ideally yes. > The reason why that happens is that while eliminate_redundant_comparison > indirectly passes the V4BImode vector type as TYPE argument, the function > doesn't actually use it and uses truth_type (V4SImode) instead. > truth_type use has been introduced in r0-119133-gae22ac3c62db451bae > but at that point the type argument didn't exist. > That has been only introduced in r10-3154-g5f487a349de62613d7fa429 . > I wonder if we can't just kill the truth_type computation and replace all > uses with type... I guess so - but does that fix anything here?=