From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 8424A3858414; Thu, 14 Sep 2023 07:12:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8424A3858414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1694675541; bh=GJlg1EAMnSKAN7uLXsOyG3iiLvGCDNowW+LhykLoDL8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=Dz3ZyFiaNAcGd/d66XhRwnjDUEW3pR8b8XWCHb/CQbbPSFcwBZTxVnpUr6M54pAJI Skksu7TKY58fdFUPqjjBxSDhM0Vefoluho/GJzEo9m5be/AHh0Y0x3ex3VwqC0tzQo MvTZmZ1nJ79VuUkyMo7omJtg5/OSCIpctBRHTpjs= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/111294] [14 Regression] Missed Dead Code Elimination since r14-573-g69f1a8af45d Date: Thu, 14 Sep 2023 07:12:20 +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: 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: 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=3D111294 --- Comment #8 from Richard Biener --- (In reply to Andrew Pinski from comment #7) > Created attachment 55892 [details] > version of using simple_dce_from_worklist in forwprop >=20 > This is a version of using simple_dce_from_worklist in forwprop I had tri= ed > at one point, but I don't remember why I did finish up this patch. That wouldn't catch the case in question. The issue is when we simplify _32 =3D (char) _31; - _4 =3D (unsigned char) _32; + _4 =3D (unsigned char) _31; we don't realize _32 becomes unused. I think it might be enough to add all original SSA uses of a stmt we fold to the DCE worklist if we simplified it (and also before substituting from the fwprop lattice?). I think it doesn't work to look at orig_stmt operands before we do update_stmt on the new stmt. Sth like the attached works though.=