From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 89B68384AB58; Thu, 2 May 2024 21:54:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 89B68384AB58 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1714686856; bh=RVJygxRhiv1+lgTzC78ModSPNScIYqeFuap0/RJpM4c=; h=From:To:Subject:Date:In-Reply-To:References:From; b=uoSOBdkTW4OiAqTExln8/+xnGACbmx3ePO6gCIS7Dg0XOFJYMK/Ed/tBx4je7UXHB YNyRy0+1XHnmwk1cC8qF286tZL7B0bQ27tE3FGqvM4ivfe9QlzjINBTKEcdCUo7DJ9 gIjNbbuAbyQ58M+aPunI1YCLDsWHWdB/OetEqfkU= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/25290] PHI-OPT could be rewritten so that is uses match Date: Thu, 02 May 2024 21:54:13 +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.2.0 X-Bugzilla-Keywords: missed-optimization X-Bugzilla-Severity: enhancement X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: pinskia 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=3D25290 --- Comment #34 from Andrew Pinski --- (In reply to Andrew Pinski from comment #22) > Without load/store handling, here are the following optimizations that > either can move to match.pd already or need some extra work to do it: >=20 > * value_replacement: need to handle !single_non_singleton_phi_for_edges c= ase > and more than one feeder statement (2 max according to the current > definition) There is a secondary part to value_replacement which requires more work than just working on the phi. I have to think of how to handle that. > * cond_removal_in_popcount_clz_ctz_pattern: need 2 feeder statements and > builtin call handling for feeder statements >=20 >=20 > * two_value_replacement: recored as PR 100958, it can move already Handled. > * abs_replacement: needs PROP_gimple_lswitch so we don't change if > statements early enough > ** I think majority of the abs handling is already in match.pd. This is handled. > * minmax_replacement: has some handling of comparisions which might not be > in the match.pd patterns already. needs PROP_gimple_lswitch also. > ** The handling of: > if (a <=3D u) > b =3D MAX (a, d); > x =3D PHI > needs to moved too. >=20 >=20 > For the ones which cannot move There is a new part of minmax which I have a patch for but there is one part missing still (recorded in PR 101024) > * factor_out_conditional_conversion: will never move, though it needs > improvement and moved already (PR 56223 and PR 13563) I have an implementation which moves this over to using gimple_match_op (wh= ich I need to a few testcases for it). Though some of this maybe should move ov= er to match ... > * spaceship_replacement: cannot move to match.pd depends on use afterwards > which is not hard to deal with in a match pattern. I have to look at what is done for spaceship and maybe merge it in with wha= t is done for value_replacement (comparison after the phi) since they implement a similar optimization.=