From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D0ACC3858D35; Thu, 3 Aug 2023 05:12:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D0ACC3858D35 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1691039576; bh=38wNqGaLYVensKNdjNk546OL1iI8mThTnzceNOwAVvc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=A7QtTOXV7Ef/sN8rzMOEiZf28+MsskofgVI8S/i26nt3bsBzXH7Q8G8nZXiqhs7G8 ZgZVdw1QxHp+wvNMECVFE69gsa15N6CxFEcsHCcM85mcf97Zqct576oLjKHu0nVBwm QfrOhqQusBXqSsb4TOYJEDqPegP42N+GbtoMwk9I= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/51049] A regression caused by "Improve handling of conditional-branches on targets with high branch costs" Date: Thu, 03 Aug 2023 05:12:55 +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: 4.7.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: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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=3D51049 --- Comment #2 from Andrew Pinski --- So at -O1 we get what we expect: ``` _1 =3D *i_4(D); _7 =3D j_5(D) !=3D 2; _8 =3D _1 !=3D 0; _9 =3D _7 & _8; if (_9 !=3D 0) goto ; [43.56%] else goto ; [56.44%] [local count: 467721933]: _6 =3D (int) _1; [local count: 1073741824]: # _2 =3D PHI <_6(3), j_5(D)(2)> ``` But at -O2 we get: ``` if (_1 !=3D 0) goto ; [66.00%] else goto ; [34.00%] [local count: 708669599]: if (j_5(D) !=3D 2) goto ; [66.00%] else goto ; [34.00%] [local count: 467721933]: _6 =3D (int) _1; [local count: 1073741824]: # _2 =3D PHI <_6(4), j_5(D)(3), j_5(D)(2)> ``` Because VRP comes along and replaces j_5(D) with 2 along the edge `3->5` and ifcombine does not do handle that as the phi entries are different (but may= be can be proved as the same).=