From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 239AA3858D33; Tue, 7 Feb 2023 18:30:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 239AA3858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1675794625; bh=zYo2l0RRO+nX2o3Qt0zzC91jRY4nb7zqSl/aap1FZj8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=LGlUS+FSaCYsCyj6EH6TN9NLaTaB7NGYzbuvPUUe9tk18uD2IW43fLNOi/iYQeiqC D2v4MKlAP4o3laBcJ0eo/Gx/LklnFyPVghpbTCGCMk8U4ghNmG1PzmP0AwrCZWysdS Bvw/7CwNq6gnX8a4dRPg2xx0aUkYAYm8h1bqm0RI= From: "amacleod at redhat dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/108684] [13 Regression] ICE: verify_ssa failed Date: Tue, 07 Feb 2023 18:30:24 +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: 13.0 X-Bugzilla-Keywords: ice-on-valid-code, inline-asm X-Bugzilla-Severity: normal X-Bugzilla-Who: amacleod at redhat dot com 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: 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=3D108684 --- Comment #3 from Andrew Macleod --- OK, its been a while. Why is there a VUSE on the return? this is the IL right from into-ssa: int f (int a) { int _4; : # .MEM_2 =3D VDEF <.MEM_1(D)> __asm__(" " : "=3DX" a_3 : : "memory"); if (a_3 !=3D 0) goto ; [INV] else goto ; [INV] : _4 =3D 0; // predicted unlikely by early return (on trees) predictor. # VUSE <.MEM_2> return _4; : __builtin_unreachable (); } The problem is that in VRP, we change a_3's global range to be ~[0,0], rewr= ite the condition to remove the block with the builtin_unreachable... which the= re leaves the IL something like: [local count: 1073741824]: # .MEM_2 =3D VDEF <.MEM_1(D)> __asm__(" " : "=3DX" a_3 : : "memory"); [local count: 1073741824]: # VUSE <.MEM_2> return 0; and since there are no more uses of a_3, the asm is considered dead and rem= oved by simple_dce_from_worklist. BUt it does not adjust the vdefs at all.. so we when its deleted, we are st= ill eft with: [local count: 1073741824]: # VUSE <.MEM_2> return 0; but now there is no longer a definition of MEM_2 and verify_ssa fails. I can fix it by not trying to dce any defs that have VDEFS on them... but t= hat doesnt seem like the correct long term solution... Why is there a VUSE on = that return anyway? to keep it from being hoisted above the asm? Whats the correct thing to do here? Im surprised that somewhere in the st= mt deletion process, it doesnt rewrite all uses of MEM_2 to MEM_1 before delit= ing it. Or is that a manual step?=