From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id EDD113858C2C; Sat, 26 Aug 2023 00:00:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org EDD113858C2C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1693008036; bh=vR2t1mU0FTvahZKG+YM2Up6eQ3DGEAP7YgD1rsM+kKA=; h=From:To:Subject:Date:In-Reply-To:References:From; b=SkjvS/wXw8/cNFVNXZ6tBVRYqUDJGki4S3N8wDWrolEt7cd4BA/hE9khJRQUVDbxO nhcP1T5zEryQSd1w5420lEVWSPFKDRSWk7d8vQUkqVo3hAERiOaOUdUtA7ekun51wv zi6u70NHuqLP2M5oXX1JfYdqY5snmNiDYZI0RVNs= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110891] [14 Regression] Dead Code Elimination Regression since r14-2674-gd0de3bf9175 Date: Sat, 26 Aug 2023 00:00:35 +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: 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: 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=3D110891 --- Comment #3 from Andrew Pinski --- One thing I noticed (I don't know if causes the missed optimization) is tha= t we have before PRE: ``` [local count: 1073531371]: if (a.0_1 !=3D 0) goto ; [50.00%] else goto ; [50.00%] [local count: 536765686]: if (_28 =3D=3D &d) goto ; [30.00%] else goto ; [70.00%] [local count: 536765685]: if (_28 =3D=3D &d) goto ; [30.00%] else goto ; [70.00%] ``` Which obvious should just be `if (_28 =3D=3D &d) goto bb9; else goto bb7;` = and not check `a.0_1` at all. I tried a reduced testcase but PRE optimizes it: ``` int g(); int h(); int j, l; int f(int a, int *b) { if (a =3D=3D 0) { if (b =3D=3D &j) goto L9; else goto L7; } else { if (b =3D=3D &j) goto L9; else goto L7; } L7: return g(); L9: return h(); } ```=