From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9AA1C3858C1F; Fri, 4 Aug 2023 18:37:42 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9AA1C3858C1F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691174262; bh=lsbyBDGPR75WC3PXil6Q+6MaKkfTu6uRN0Pnnw11siA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=M553VCqaY3vEVAcXoBoQOzJB1a/vs2aaYhqxXK5+R+gMX+iA6CWTfwESuPs30pa+i 5MzZy3bB1brhgQf0kpRZ4bOSy+iIKUCdCGyx7PJqVOpJvPXN0LQSP3Jv65VWdhe3Yl yP5wmFYEsFyZ7yI9GVQXABRnCk2JXMUBPk4VksZ8= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110903] [12/13/14 Regression] Dead Code Elimination Regression Date: Fri, 04 Aug 2023 18:37:42 +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, needs-bisection X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 12.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cf_reconfirmed_on bug_status target_milestone everconfirmed keywords short_desc 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=3D110903 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed| |2023-08-04 Status|UNCONFIRMED |NEW Target Milestone|--- |12.4 Ever confirmed|0 |1 Keywords| |needs-bisection Summary|[14 Regression] Dead Code |[12/13/14 Regression] Dead |Elimination Regression |Code Elimination Regression |since r14-1597-g64d90d06d2d | --- Comment #2 from Andrew Pinski --- Confirmed. before r14-1597, there was a jump threading happening with respe= ct to: if (j_32 <=3D 0) goto ; [50.00%] else goto ; [50.00%] [local count: 238907556]: [local count: 477815112]: # iftmp.10_37 =3D PHI <_11(7), 0(8)> But after, we change that into iftmp.10_37 =3D _11 & (j_32 <=3D 0); It just happens we depend on that due to: _43 =3D l_22 | _25; _39 =3D j_32 <=3D 0; _12 =3D ~_43; _44 =3D _12 & _39; If we change the code to be: ``` void foo(void); static signed char b, c; static short e, f; static int g =3D 41317; static int(a)(int h, int i) { return h + i; } static int(d)(int h, int i) { return i & h;}//i ? h : 0; } short t =3D 10; int main() { { signed char j; short k =3D t; for (; g >=3D 10; g =3D (short)g) { _Bool l =3D 1; int m =3D 0; j =3D 8 * k; k =3D j <=3D 0; f =3D c + 3; for (; c < 2; c =3D f) { signed char n =3D 4073709551615; if (!(((m) >=3D 0) && ((m) <=3D 0))) { __builtin_unreachable(); } if (g) ; else { if ((m =3D k, (b =3D a(d(l, k), e) && n) || l) < k) foo= (); e =3D l =3D 0; } } } } } ``` GCC 11 is able to remove the call to foo but GCC 12 cannot. the IR for the part where the phiopt2 changes on the trunk is similar enoug= h. So this is instead a regression from GCC 11.=