From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DA1AD3858417; Mon, 8 Jan 2024 13:00:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA1AD3858417 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1704718846; bh=85IPfS0TBEA6pob3I7dVQCWYbA7YCiQKV89pJ5DxO2c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=GIQOHXhhR5f/Xb+7am7TzVKvWd3fQgoPkqHFvyO9SPDNYwwLbe1L4Q046UfPaBUBs 77xIvdGYu7r9ZBqWWYqT5l4w2w03o+PcQif68J54jddqaWAJtufRYf38MEljRKwDKr Z7eowQj0cL7HE4q0gQBaWtBvMTSPEQqYJ/QWsw7I= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/113119] ICE: verify_ssa failed: definition in block 18 does not dominate use in block 4 at -O1 with _BitInt Date: Mon, 08 Jan 2024 13:00:45 +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: cvs-commit 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: --- 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=3D113119 --- Comment #4 from GCC Commits --- The master branch has been updated by Jakub Jelinek : https://gcc.gnu.org/g:7590d975ecfdae4f112b5086c017101c08f07e3e commit r14-7000-g7590d975ecfdae4f112b5086c017101c08f07e3e Author: Jakub Jelinek Date: Mon Jan 8 13:57:26 2024 +0100 lower-bitint: Punt .*_OVERFLOW optimization if cast from IMAGPART_EXPR appears before REALPART_EXPR [PR113119] _BitInt lowering for .{ADD,SUB,MUL}_OVERFLOW calls which have both REALPART_EXPR and IMAGPART_EXPR used and have a cast from the IMAGPART_= EXPR to a boolean or normal integral type lowers them at the point of the REALPART_EXPR statement (which is especially needed if the lhs of the call is complex with large/huge _BitInt element type); we emit the stmt to set the lhs of the cast at the same spot as well. Normally, the lowering of __builtin_{add,sub,mul}_overflow arranges the REALPART_EXPR to come before IMAGPART_EXPR, followed by cast from t= hat, but as the testcase shows, a redundant __builtin_*_overflow call and VN can reorder those and we then ICE because the def-stmt of the former ca= st from IMAGPART_EXPR may appear after its uses. We already check that all of REALPART_EXPR, IMAGPART_EXPR and the cast from the latter appear in the same bb as the .{ADD,SUB,MUL}_OVERFLOW ca= ll in the optimization, the following patch just extends it to make sure cast appears after REALPART_EXPR; if not, we punt on the optimization a= nd expand it as a store of a complex _BitInt on the location of the ifn ca= ll. Only the testcase in the testsuite is changed by the patch, all other __builtin_*_overflow* calls in the bitint* tests (and there are quite a few) have REALPART_EXPR first. 2024-01-08 Jakub Jelinek PR tree-optimization/113119 * gimple-lower-bitint.cc (optimizable_arith_overflow): Punt if both REALPART_EXPR and cast from IMAGPART_EXPR appear, but cast is before REALPART_EXPR. * gcc.dg/bitint-61.c: New test.=