From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C8C14385E448; Sat, 9 Mar 2024 06:50:29 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C8C14385E448 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1709967029; bh=JXiIl2+lFug4uBeedDbhC7+mnrUjeQcdYpv9CdZSI+I=; h=From:To:Subject:Date:In-Reply-To:References:From; b=QooTm9KNCnGTIBSFGkK+fEEwBCz+tWalDMpdMj9UbMSoSYD3I1WCG00P4rNcXYpZS gTob07MldYKGMpm5VBo9tIdGdn2rFyFhJR7Z6lS2mnj0yXJCDBoZ8CmjOnhgTs++JP ABS3dZcFChswiJ130uPz7LuC+YwtBhTiEOWafZ3w= From: "law at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110931] [14 Regression] Dead Code Elimination Regression since r14-2890-gcc2003cd875 Date: Sat, 09 Mar 2024 06:50:28 +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: missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: law at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned 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=3D110931 --- Comment #5 from Jeffrey A. Law --- One could also look at this as a failure to propagate. l.0_1 =3D l; t_4 =3D (short int) l.0_1; if (t_4 =3D=3D 0) goto ; [50.00%] else goto ; [50.00%] We ought to be able to propagate l.0_1 into the conditional for t_4. If we= do that, then we'll be able to propagate 0 for l.0_1 in this block: ;; basic block 3, loop depth 0, count 536870912 (estimated locally, freq 0.5000) ;; prev block 2, next block 4, flags: (NEW, VISITED) ;; pred: 2 [50.0% (guessed)] count:536870912 (estimated locally, = freq 0.5000) (TRUE_VALUE,EXECUTABLE) b_5 =3D (char) l.0_1; if (b_5 !=3D 1) goto ; [0.00%] else goto ; [100.00%] And once we propagate the value 0 that will make the make bb5 (containing t= he call to foo) unreachable. IIRC we have (had?) some code to do these kinds of propagations through conversions. IIRC it was fairly conservative, perhaps overly so.=