From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1AE933858D33; Tue, 8 Aug 2023 09:36:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1AE933858D33 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691487400; bh=ktKX49vf4lfY5bT4zYHfKLX5x7jaRaglfD3+hxMGCNM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=bIZ1Bk5yuI2aSeranYRGU3gt0IpmDj95xcGVY0vX6Y3JaFgu1TSjKjHiXR0lovfng oOoXvQwWrLxpy4pQB2s9HsIdjVjWvzZXSC9YfEL0i3bRG71frshFruSalcyp25/n+Y F04tbBRd6dAiqJH6J+BmuuDjabSWc5TzTTVRKtWw= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110924] [14 Regression] ICE on valid code at -O{s,2,3} on x86_64-linux-gnu: verify_ssa failed Date: Tue, 08 Aug 2023 09:36:38 +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: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: 14.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc 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=3D110924 Richard Biener changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #9 from Richard Biener --- Hm, OK. So I actually thought of this issue. It's basically a hole in the requirement of all function "exits" having a virtual use and thus virtual PHIs being created along the paths to it. I was aware of GIMPLE_RESX and thought about const noreturn (but that attribute combination is rejected). IPA pure-const detects func_15 as looping 'const' and noreturn: Function is locally const. Function found to be noreturn: func_15 Function found to be looping const: func_15/2 Declaration updated to be looping const: func_15/2 so there's two ways to "fix" this, one - drop the assumption we have PHIs on the paths to function exit (including in not returning regions). That makes virtual_operand_live::get_live_in (basic_block bb) { ... /* Since we don't have a virtual PHI we can now pick any of the incoming edges liveout value. All returns from the function have a virtual use forcing generation of virtual PHIs. */ edge_iterator ei; edge e; FOR_EACH_EDGE (e, ei, bb->preds) if (liveout[e->src->index]) { if (EDGE_PRED (bb, 0) !=3D e) liveout[EDGE_PRED (bb, 0)->src->index] =3D liveout[e->src->index]; return liveout[e->src->index]; } instead required to check each edge and we can't simply take the value from the immediate dominator as fallback. When we discover divergence we need to return NULL (unknown - nobody created the actually live VOP). The other alternative is to make sure we _do_ have the virtual operand. Either by making sure the "invalid" combination of const + noreturn isn't detected or by creating a virtual use in that case anyway (and fixup code because of that inconsistency).=