From patchwork Mon Nov 8 17:50:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 47226 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 9FFAC3858016 for ; Mon, 8 Nov 2021 17:51:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9FFAC3858016 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1636393862; bh=aETLpyfqrqw7w+EDy0OnGOtgnQwZty7DPL2ln1bWqNE=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=jD8gSIBktXmpjk7wnoBQwq9NDFD6u6nCr5QthESRENT/4mCxq43DQ87qcnlS5ybii 8M6UZT3JpcHsMUMLoAEaB4kbmoQGWkYsYC7qFVxSy4F4hGrNOszybVhvcVjhcDLPEa g2GDya9gghSzIoIkbw2Z01Oimda29yPcEs9L7Ov4= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from nikam.ms.mff.cuni.cz (nikam.ms.mff.cuni.cz [195.113.20.16]) by sourceware.org (Postfix) with ESMTPS id 39F683858000 for ; Mon, 8 Nov 2021 17:50:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 39F683858000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 0C5E4280874; Mon, 8 Nov 2021 18:50:12 +0100 (CET) Date: Mon, 8 Nov 2021 18:50:12 +0100 To: gcc-patches@gcc.gnu.org Subject: Move uncprop after modref pass Message-ID: <20211108175011.GA21089@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jan Hubicka via Gcc-patches From: Jan Hubicka Reply-To: Jan Hubicka Errors-To: gcc-patches-bounces+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" Hi, this patch moves uncprop after modref and pure/const pass and adds a comment that this pass should alwasy be last since it is only supposed to help PHI lowering. The pass replaces constant by SSA names that are known to be constant at the place which hardly helps other passes. Modref now allows easily to compare ipa solutions with local solutions done at compile time. The local solutions should be monotonously better ideally they should be the same showing that IPA machinery can do all we can do locally. Neither is quite true. Building cc1plus we get - 1075 parameters whose EAF flags detected late are worse than those from IPA (1384 before the patch) - 5943 parameters whose EAF flags detected late are better than those from IPA (5766 before the patch) - 367 parameters whose RAF flags are changed (some better some worse) (375 before the patch) Out of about 30k params tracked in 32k functions. So not optimal, but still situation is noticeably better than before the patch changing from Alias oracle query stats: refs_may_alias_p: 76514746 disambiguations, 101144061 queries ref_maybe_used_by_call_p: 642091 disambiguations, 77522063 queries call_may_clobber_ref_p: 387354 disambiguations, 390389 queries nonoverlapping_component_refs_p: 0 disambiguations, 26150 queries nonoverlapping_refs_since_match_p: 30138 disambiguations, 65278 must overlaps, 96375 queries aliasing_component_refs_p: 57707 disambiguations, 15412274 queries TBAA oracle: 28146643 disambiguations 104216840 queries 14970479 are in alias set 0 8940210 queries asked about the same object 117 queries asked about the same alias set 0 access volatile 50245719 are dependent in the DAG 1913672 are aritificially in conflict with void * Modref stats: modref use: 25185 disambiguations, 697431 queries modref clobber: 2333371 disambiguations, 22334828 queries 5347614 tbaa queries (0.239429 per modref query) 759061 base compares (0.033986 per modref query) PTA query stats: pt_solution_includes: 13361936 disambiguations, 40666636 queries pt_solutions_intersect: 1589896 disambiguations, 13702105 queries to Alias oracle query stats: refs_may_alias_p: 76706288 disambiguations, 101289627 queries ref_maybe_used_by_call_p: 647660 disambiguations, 77711837 queries call_may_clobber_ref_p: 388155 disambiguations, 391104 queries nonoverlapping_component_refs_p: 0 disambiguations, 26150 queries nonoverlapping_refs_since_match_p: 30138 disambiguations, 65170 must overlaps, 96267 queries aliasing_component_refs_p: 57149 disambiguations, 15405496 queries TBAA oracle: 28122633 disambiguations 104205741 queries 14987347 are in alias set 0 8944156 queries asked about the same object 99 queries asked about the same alias set 0 access volatile 50238319 are dependent in the DAG 1913187 are aritificially in conflict with void * Modref stats: modref use: 25273 disambiguations, 701571 queries modref clobber: 2337545 disambiguations, 22431672 queries 5357026 tbaa queries (0.238815 per modref query) 762911 base compares (0.034010 per modref query) PTA query stats: pt_solution_includes: 13467699 disambiguations, 40734635 queries pt_solutions_intersect: 1681618 disambiguations, 13751306 queries So we got 6% better on pt_soltions_intersect Bootstrapped/regtested x86_64-linux, comitted. gcc/ChangeLog: PR tree-opt/103177 * passes.def: Move uncprop after pure/const and modref. diff --git a/gcc/passes.def b/gcc/passes.def index 0f541454e7f..56dab80a029 100644 --- a/gcc/passes.def +++ b/gcc/passes.def @@ -360,9 +360,11 @@ along with GCC; see the file COPYING3. If not see number of false positives from it. */ NEXT_PASS (pass_split_crit_edges); NEXT_PASS (pass_late_warn_uninitialized); - NEXT_PASS (pass_uncprop); NEXT_PASS (pass_local_pure_const); NEXT_PASS (pass_modref); + /* uncprop replaces constants by SSA names. This makes analysis harder + and thus it should be run last. */ + NEXT_PASS (pass_uncprop); POP_INSERT_PASSES () NEXT_PASS (pass_all_optimizations_g); PUSH_INSERT_PASSES_WITHIN (pass_all_optimizations_g) @@ -393,9 +395,11 @@ along with GCC; see the file COPYING3. If not see number of false positives from it. */ NEXT_PASS (pass_split_crit_edges); NEXT_PASS (pass_late_warn_uninitialized); - NEXT_PASS (pass_uncprop); NEXT_PASS (pass_local_pure_const); NEXT_PASS (pass_modref); + /* uncprop replaces constants by SSA names. This makes analysis harder + and thus it should be run last. */ + NEXT_PASS (pass_uncprop); POP_INSERT_PASSES () NEXT_PASS (pass_tm_init); PUSH_INSERT_PASSES_WITHIN (pass_tm_init)