From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 7C1413858D3C; Fri, 16 Jun 2023 15:32:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7C1413858D3C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1686929523; bh=vkJDGE5j2NhzejzwQAMLxAilK/LWsUNL8Xt3pgdSTU4=; h=From:To:Subject:Date:In-Reply-To:References:From; b=UQOb464CG1Af9j4KGS32mc8Z2cLfynpAoT2WcXyVDqq7pU5Pwn1xXlOYSJzmYbIAh J+1tEeEWFBNoq1hnRqVkFtY28mzVySOmdptphpW0LwCvzTZC/lLBaL7FDrw67LfNKU 3ZKzhfYCjFX/Xwj5/FmEH+A1DO5/dMaVu89+UzxE= From: "hubicka at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/110289] Phiprop may be good idea in early opts Date: Fri, 16 Jun 2023 15:32:03 +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: 13.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: hubicka at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 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=3D110289 --- Comment #2 from Jan Hubicka --- This patch fixes the problem diff --git a/gcc/passes.def b/gcc/passes.def index c9a8f19747b..faa5208b26b 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -88,6 +88,8 @@ along with GCC; see the file COPYING3. If not see /* pass_build_ealias is a dummy pass that ensures that we execute TODO_rebuild_alias at this point. */ NEXT_PASS (pass_build_ealias); + /* Do phiprop before FRE so we optimize std::min and std::max wel= l.=20 */ + NEXT_PASS (pass_phiprop); NEXT_PASS (pass_fre, true /* may_iterate */); NEXT_PASS (pass_early_vrp); NEXT_PASS (pass_merge_phi); diff --git a/gcc/tree-ssa-phiprop.cc b/gcc/tree-ssa-phiprop.cc index 3cb4900b6be..5dc505df420 100644 --- a/gcc/tree-ssa-phiprop.cc +++ b/gcc/tree-ssa-phiprop.cc @@ -476,6 +476,7 @@ public: {} /* opt_pass methods: */ + opt_pass * clone () final override { return new pass_phiprop (m_ctxt); } bool gate (function *) final override { return flag_tree_phiprop; } unsigned int execute (function *) final override; and helps PR110287=