On Wed, 29 Sep 2021 10:10:00 +0200
Aldy Hernandez <al...@redhat.com> 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
> <rep.dot....@gmail.com> wrote:
> >
> > Aldy, ping?
> >
> > On 25 September 2021 21:25:44 CEST, Bernhard Reutner-Fischer 
> > <rep.dot....@gmail.com> wrote:
> > >On Fri, 24 Sep 2021 17:46:53 +0200
> > >Aldy Hernandez via Gcc-patches <gcc-patches@gcc.gnu.org> 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,
> >

>From 34877c42f4442653bdc534d135f1f44f63175ce6 Mon Sep 17 00:00:00 2001
From: Aldy Hernandez <al...@redhat.com>
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

Reply via email to