From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 6BD123858D35 for ; Wed, 29 Sep 2021 09:20:27 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6BD123858D35 Received: by mail-wr1-x42e.google.com with SMTP id d21so3022244wra.12 for ; Wed, 29 Sep 2021 02:20:27 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version; bh=lXfx2LySCXcxZ+sVol5iuxGd4yCSZkiUjh1+S8nfx1A=; b=g20VGbxUsiKR0jqKbbGp4hV9AmaFhadPk7NsIlntal0h5dbQ03t7Si9Nt44oPTVw8x aWloMKm0f8PhY3QWYImKEsmwXMoFaxz0QznywziFga0Q1hBeyFsZTt6CjRQfnmr4XXKW UfA5syq1ktGZWur6yEHW3WCbkzBxi1b6VZIkLCXXfh/HxpV7dPiKqTSi02vkNaLXxtWu Xmjfmi+xoQt1fFBGmeYpUy+NP8SnWfDvgNtE95C1kNUS/45sjy9LQM5UKlNGr6C2F8BS oQZSAqXvi7bNyfXOI2Y7UuAPqMHwo0ACx6rQKOfPmnbTaCqWvOurD69C2FG8fo/bFZtF n8EQ== X-Gm-Message-State: AOAM5338lyHd9DoNt+lCLt0C5OROT/qyL/Jt4aszqGeIJG/HJd9EP47Q +4YTeUQzE6zazel+ZUb3quE= X-Google-Smtp-Source: ABdhPJyf4eHeDGMgV/r8YyGV0K5vgZ62kY2RwmWPARNHV5b82iCq6g8c06TsUszUiI0qfVyZLa9mcQ== X-Received: by 2002:a5d:59a4:: with SMTP id p4mr5285012wrr.332.1632907225767; Wed, 29 Sep 2021 02:20:25 -0700 (PDT) Received: from nbbrfq (91-119-98-250.dsl.dynamic.surfer.at. [91.119.98.250]) by smtp.gmail.com with ESMTPSA id z12sm1715472wrv.31.2021.09.29.02.20.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 Sep 2021 02:20:25 -0700 (PDT) Date: Wed, 29 Sep 2021 11:20:20 +0200 From: Bernhard Reutner-Fischer To: Aldy Hernandez Cc: rep.dot.nop@gmail.com, Jeff Law , gcc-patches Subject: Re: [PATCH] Replace VRP threader with a hybrid forward threader. Message-ID: <20210929112020.2ba6816f@nbbrfq> In-Reply-To: References: <20210924154653.1108992-1-aldyh@redhat.com> <20210925212544.4c599084@nbbrfq> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="MP_/3Hs2RMLKdhoUnOy6c/Wx57G" X-Spam-Status: No, score=-10.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, 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-List-Received-Date: Wed, 29 Sep 2021 09:20:29 -0000 --MP_/3Hs2RMLKdhoUnOy6c/Wx57G Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline On Wed, 29 Sep 2021 10:10:00 +0200 Aldy Hernandez wrote: > Jeff has requested we slow down changes in the threading space while > we chased down regressions. Sure. Take your time. > > That being said, thank you for your suggestion. I am putting the > attached patch in my queue for testing. LGTM but cannot approve it. ~hybrid_threader wouldn't want to free_dominance_info() would it? But you certainly looked for such leaks. thanks, > > Aldy > > On Wed, Sep 29, 2021 at 7:43 AM Bernhard Reutner-Fischer > wrote: > > > > Aldy, ping? > > > > On 25 September 2021 21:25:44 CEST, Bernhard Reutner-Fischer wrote: > > >On Fri, 24 Sep 2021 17:46:53 +0200 > > >Aldy Hernandez via Gcc-patches wrote: > > > > >> +static unsigned int > > >> +execute_vrp_threader (function *fun) > > >> +{ > > >> + hybrid_threader threader; > > >> + threader.thread_jumps (fun); > > >> + threader.thread_through_all_blocks (); > > >> + return 0; > > >> +} > > >> + > > >> +namespace { > > >> + > > >> +const pass_data pass_data_vrp_threader = > > >> +{ > > >> + GIMPLE_PASS, /* type */ > > >> + "vrp-thread", /* name */ > > >> + OPTGROUP_NONE, /* optinfo_flags */ > > >> + TV_TREE_VRP, /* tv_id */ > > >> + PROP_ssa, /* properties_required */ > > >> + 0, /* properties_provided */ > > >> + 0, /* properties_destroyed */ > > >> + 0, /* todo_flags_start */ > > >> + ( TODO_cleanup_cfg | TODO_update_ssa ), /* todo_flags_finish */ > > >> +}; > > > > > >So shouldn't non-jumpy or flat code avoid the cleanup_cfg or > > >update_ssa iff neither the function nor anything else was threaded? > > > > > >thanks, > > --MP_/3Hs2RMLKdhoUnOy6c/Wx57G Content-Type: text/x-patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=0001-Avoid-CFG-updates-in-VRP-threader-if-nothing-changed.patch >From 34877c42f4442653bdc534d135f1f44f63175ce6 Mon Sep 17 00:00:00 2001 From: Aldy Hernandez Date: Wed, 29 Sep 2021 10:02:12 +0200 Subject: [PATCH] Avoid CFG updates in VRP threader if nothing changed. There is no need to update the CFG or SSAs if nothing has changed in VRP threading. gcc/ChangeLog: * tree-vrp.c (thread_through_all_blocks): Return bool. (execute_vrp_threader): Return TODO_* flags. (pass_data_vrp_threader): Set todo_flags_finish to 0. --- gcc/tree-vrp.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c index 5aded5edb11..668267582bb 100644 --- a/gcc/tree-vrp.c +++ b/gcc/tree-vrp.c @@ -4372,9 +4372,9 @@ public: { walk (fun->cfg->x_entry_block_ptr); } - void thread_through_all_blocks () + bool thread_through_all_blocks () { - m_threader->thread_through_all_blocks (false); + return m_threader->thread_through_all_blocks (false); } private: @@ -4438,7 +4438,8 @@ execute_vrp_threader (function *fun) { hybrid_threader threader; threader.thread_jumps (fun); - threader.thread_through_all_blocks (); + if (threader.thread_through_all_blocks ()) + return (TODO_cleanup_cfg | TODO_update_ssa); return 0; } @@ -4454,7 +4455,7 @@ const pass_data pass_data_vrp_threader = 0, /* properties_provided */ 0, /* properties_destroyed */ 0, /* todo_flags_start */ - ( TODO_cleanup_cfg | TODO_update_ssa ), /* todo_flags_finish */ + 0 /* todo_flags_finish */ }; class pass_vrp_threader : public gimple_opt_pass -- 2.31.1 --MP_/3Hs2RMLKdhoUnOy6c/Wx57G--