public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r12-3344] Do not assume loop header threading in backward threader.
@ 2021-09-03 15:23 Aldy Hernandez
  0 siblings, 0 replies; only message in thread
From: Aldy Hernandez @ 2021-09-03 15:23 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:01005550377ff17716e6ad57c62df726877ab79f

commit r12-3344-g01005550377ff17716e6ad57c62df726877ab79f
Author: Aldy Hernandez <aldyh@redhat.com>
Date:   Fri Sep 3 12:07:49 2021 +0200

    Do not assume loop header threading in backward threader.
    
    The registry's thread_through_all_blocks() has a may_peel_loop_headers
    argument.  When refactoring the backward threader code, I removed this
    argument for the local passthru method because it was always TRUE.  This
    may not necessarily be true in the future, if the backward threader is
    called from another context.  This patch removes the default definition,
    in favor of an argument that is exactly the same as the identically
    named function in tree-ssa-threadupdate.c.  I think this also makes it
    less confusing when looking at both methods across the source base.
    
    Tested on x86-64 Linux.
    
    gcc/ChangeLog:
    
            * tree-ssa-threadbackward.c (back_threader::thread_through_all_blocks):
            Add may_peel_loop_headers.
            (back_threader_registry::thread_through_all_blocks): Same.
            (try_thread_blocks): Pass may_peel_loop_headers argument.
            (pass_early_thread_jumps::execute): Same.

Diff:
---
 gcc/tree-ssa-threadbackward.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/gcc/tree-ssa-threadbackward.c b/gcc/tree-ssa-threadbackward.c
index b9a0d9a60ad..2fa22f8e328 100644
--- a/gcc/tree-ssa-threadbackward.c
+++ b/gcc/tree-ssa-threadbackward.c
@@ -53,7 +53,7 @@ class back_threader_registry
 public:
   back_threader_registry (int max_allowable_paths);
   bool register_path (const vec<basic_block> &, edge taken);
-  bool thread_through_all_blocks ();
+  bool thread_through_all_blocks (bool may_peel_loop_headers);
 private:
   jump_thread_path_registry m_lowlevel_registry;
   const int m_max_allowable_paths;
@@ -80,7 +80,7 @@ public:
   back_threader (bool speed_p);
   ~back_threader ();
   void maybe_thread_block (basic_block bb);
-  bool thread_through_all_blocks ();
+  bool thread_through_all_blocks (bool may_peel_loop_headers);
 private:
   void find_paths (basic_block bb, tree name);
   void maybe_register_path (edge taken_edge);
@@ -497,9 +497,9 @@ back_threader::maybe_thread_block (basic_block bb)
 // Perform the actual jump threading for the all queued paths.
 
 bool
-back_threader::thread_through_all_blocks ()
+back_threader::thread_through_all_blocks (bool may_peel_loop_headers)
 {
-  return m_registry.thread_through_all_blocks ();
+  return m_registry.thread_through_all_blocks (may_peel_loop_headers);
 }
 
 // Dump a sequence of BBs through the CFG.
@@ -553,9 +553,9 @@ back_threader_registry::back_threader_registry (int max_allowable_paths)
 }
 
 bool
-back_threader_registry::thread_through_all_blocks ()
+back_threader_registry::thread_through_all_blocks (bool may_peel_loop_headers)
 {
-  return m_lowlevel_registry.thread_through_all_blocks (true);
+  return m_lowlevel_registry.thread_through_all_blocks (may_peel_loop_headers);
 }
 
 /* Examine jump threading path PATH and return TRUE if it is profitable to
@@ -947,7 +947,7 @@ try_thread_blocks (function *fun)
       if (EDGE_COUNT (bb->succs) > 1)
 	threader.maybe_thread_block (bb);
     }
-  return threader.thread_through_all_blocks ();
+  return threader.thread_through_all_blocks (/*peel_loop_headers=*/true);
 }
 
 unsigned int
@@ -1016,7 +1016,7 @@ pass_early_thread_jumps::execute (function *fun)
       if (EDGE_COUNT (bb->succs) > 1)
 	threader.maybe_thread_block (bb);
     }
-  threader.thread_through_all_blocks ();
+  threader.thread_through_all_blocks (/*peel_loop_headers=*/true);
 
   loop_optimizer_finalize ();
   return 0;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-09-03 15:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-03 15:23 [gcc r12-3344] Do not assume loop header threading in backward threader Aldy Hernandez

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).