public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pan Li <panli@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r14-8418] RISC-V: Remove redundant full available computation [NFC]
Date: Thu, 25 Jan 2024 08:32:33 +0000 (GMT)	[thread overview]
Message-ID: <20240125083233.3170D3858C52@sourceware.org> (raw)

https://gcc.gnu.org/g:5ee45f5e2838caf9180af1702349daa017a032f5

commit r14-8418-g5ee45f5e2838caf9180af1702349daa017a032f5
Author: Juzhe-Zhong <juzhe.zhong@rivai.ai>
Date:   Thu Jan 25 16:24:26 2024 +0800

    RISC-V: Remove redundant full available computation [NFC]
    
    Notice full available is computed evey round of earliest fusion which is redundant.
    Actually we only need to compute it once in phase 3.
    
    It's NFC patch and tested no regression. Committed.
    
    gcc/ChangeLog:
    
            * config/riscv/riscv-vsetvl.cc (pre_vsetvl::compute_vsetvl_def_data): Remove
            redundant full available computation.
            (pre_vsetvl::pre_global_vsetvl_info): Ditto.

Diff:
---
 gcc/config/riscv/riscv-vsetvl.cc | 57 ++++++++++++++++------------------------
 1 file changed, 23 insertions(+), 34 deletions(-)

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 53d954e1dff..72c5a127d9e 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -1256,9 +1256,7 @@ public:
   vsetvl_info global_info;
   bb_info *bb;
 
-  bool full_available;
-
-  vsetvl_block_info () : bb (nullptr), full_available (false)
+  vsetvl_block_info () : bb (nullptr)
   {
     local_infos.safe_grow_cleared (0);
     global_info.set_empty ();
@@ -2489,34 +2487,6 @@ pre_vsetvl::compute_vsetvl_def_data ()
 	}
     }
 
-  for (const bb_info *bb : crtl->ssa->bbs ())
-    {
-      vsetvl_block_info &block_info = get_block_info (bb);
-      if (block_info.empty_p ())
-	continue;
-      vsetvl_info &curr_info = block_info.get_entry_info ();
-      if (!curr_info.valid_p ())
-	continue;
-
-      unsigned int expr_index;
-      sbitmap_iterator sbi;
-      gcc_assert (
-	!bitmap_empty_p (m_vsetvl_def_in[curr_info.get_bb ()->index ()]));
-      bool full_available = true;
-      EXECUTE_IF_SET_IN_BITMAP (m_vsetvl_def_in[bb->index ()], 0, expr_index,
-				sbi)
-	{
-	  vsetvl_info &prev_info = *m_vsetvl_def_exprs[expr_index];
-	  if (!prev_info.valid_p ()
-	      || !m_dem.available_p (prev_info, curr_info))
-	    {
-	      full_available = false;
-	      break;
-	    }
-	}
-      block_info.full_available = full_available;
-    }
-
   sbitmap_vector_free (def_loc);
   sbitmap_vector_free (m_kill);
 }
@@ -3178,11 +3148,30 @@ pre_vsetvl::pre_global_vsetvl_info ()
   for (const bb_info *bb : crtl->ssa->bbs ())
     {
       vsetvl_block_info &block_info = get_block_info (bb);
-      if (block_info.empty_p () || !block_info.full_available)
+      if (block_info.empty_p ())
+	continue;
+      vsetvl_info &curr_info = block_info.get_entry_info ();
+      if (!curr_info.valid_p ())
 	continue;
 
-      vsetvl_info &info = block_info.get_entry_info ();
-      info.set_delete ();
+      unsigned int expr_index;
+      sbitmap_iterator sbi;
+      gcc_assert (
+	!bitmap_empty_p (m_vsetvl_def_in[curr_info.get_bb ()->index ()]));
+      bool full_available = true;
+      EXECUTE_IF_SET_IN_BITMAP (m_vsetvl_def_in[bb->index ()], 0, expr_index,
+				sbi)
+	{
+	  vsetvl_info &prev_info = *m_vsetvl_def_exprs[expr_index];
+	  if (!prev_info.valid_p ()
+	      || !m_dem.available_p (prev_info, curr_info))
+	    {
+	      full_available = false;
+	      break;
+	    }
+	}
+      if (full_available)
+	curr_info.set_delete ();
     }
 
   for (const bb_info *bb : crtl->ssa->bbs ())

                 reply	other threads:[~2024-01-25  8:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240125083233.3170D3858C52@sourceware.org \
    --to=panli@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).