public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Vineet Gupta <vineetg@rivosinc.com>
To: gcc-patches@gcc.gnu.org
Cc: gnu-toolchain@rivosinc.com, Vineet Gupta <vineetg@rivosinc.com>
Subject: [COMITTED 2/2] RISC-V: fix some vsetvl debug info in pass's Phase 2 code [NFC]
Date: Wed, 17 Jan 2024 11:01:32 -0800	[thread overview]
Message-ID: <20240117190132.450071-1-vineetg@rivosinc.com> (raw)
In-Reply-To: <33D9750FAAB8AC40+2024011706320068727626@rivai.ai>

When staring at VSETVL pass for PR/113429, spotted some minor
improvements.

1. For readablity, remove some redundant condition check in Phase 2
   function  earliest_fuse_vsetvl_info ().
2. Add iteration count in debug prints in same function.

gcc/ChangeLog:
	* config/riscv/riscv-vsetvl.cc (earliest_fuse_vsetvl_info):
	Remove redundant checks in else condition for readablity.
	(earliest_fuse_vsetvl_info) Print iteration count in debug
	prints.
	(earliest_fuse_vsetvl_info) Fix misleading vsetvl info
	dump details in certain cases.

Signed-off-by: Vineet Gupta <vineetg@rivosinc.com>
---
 gcc/config/riscv/riscv-vsetvl.cc | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 78a2f7b38faf..41d4b80648f6 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2343,7 +2343,7 @@ public:
   void compute_lcm_local_properties ();
 
   void fuse_local_vsetvl_info ();
-  bool earliest_fuse_vsetvl_info ();
+  bool earliest_fuse_vsetvl_info (int iter);
   void pre_global_vsetvl_info ();
   void emit_vsetvl ();
   void cleaup ();
@@ -2961,7 +2961,7 @@ pre_vsetvl::fuse_local_vsetvl_info ()
 
 
 bool
-pre_vsetvl::earliest_fuse_vsetvl_info ()
+pre_vsetvl::earliest_fuse_vsetvl_info (int iter)
 {
   compute_avl_def_data ();
   compute_vsetvl_def_data ();
@@ -2984,7 +2984,8 @@ pre_vsetvl::earliest_fuse_vsetvl_info ()
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
-      fprintf (dump_file, "\n  Compute LCM earliest insert data:\n\n");
+      fprintf (dump_file, "\n  Compute LCM earliest insert data (lift %d):\n\n",
+	       iter);
       fprintf (dump_file, "    Expression List (%u):\n", num_exprs);
       for (unsigned i = 0; i < num_exprs; i++)
 	{
@@ -3032,7 +3033,7 @@ pre_vsetvl::earliest_fuse_vsetvl_info ()
 
   if (dump_file && (dump_flags & TDF_DETAILS))
     {
-      fprintf (dump_file, "    Fused global info result:\n");
+      fprintf (dump_file, "    Fused global info result (lift %d):\n", iter);
     }
 
   bool changed = false;
@@ -3142,8 +3143,7 @@ pre_vsetvl::earliest_fuse_vsetvl_info ()
 		  if (src_block_info.has_info ())
 		    src_block_info.probability += dest_block_info.probability;
 		}
-	      else if (src_block_info.has_info ()
-		       && !m_dem.compatible_p (prev_info, curr_info))
+	      else
 		{
 		  /* Cancel lift up if probabilities are equal.  */
 		  if (successors_probability_equal_p (eg->src))
@@ -3151,11 +3151,11 @@ pre_vsetvl::earliest_fuse_vsetvl_info ()
 		      if (dump_file && (dump_flags & TDF_DETAILS))
 			{
 			  fprintf (dump_file,
-				   "      Change empty bb %u to from:",
+				   "      Reset bb %u:",
 				   eg->src->index);
 			  prev_info.dump (dump_file, "        ");
 			  fprintf (dump_file,
-				   "        to (higher probability):");
+				   "	due to (same probability):");
 			  curr_info.dump (dump_file, "        ");
 			}
 		      src_block_info.set_empty_info ();
@@ -3170,7 +3170,7 @@ pre_vsetvl::earliest_fuse_vsetvl_info ()
 		      if (dump_file && (dump_flags & TDF_DETAILS))
 			{
 			  fprintf (dump_file,
-				   "      Change empty bb %u to from:",
+				   "      Change bb %u from:",
 				   eg->src->index);
 			  prev_info.dump (dump_file, "        ");
 			  fprintf (dump_file,
@@ -3627,7 +3627,7 @@ pass_vsetvl::lazy_vsetvl ()
     {
       if (dump_file)
 	fprintf (dump_file, "  Try lift up %d.\n\n", fused_count);
-      changed = pre.earliest_fuse_vsetvl_info ();
+      changed = pre.earliest_fuse_vsetvl_info (fused_count);
       fused_count += 1;
   } while (changed);
 
-- 
2.34.1


      reply	other threads:[~2024-01-17 19:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-16 21:41 [PATCH] " Vineet Gupta
2024-01-16 22:32 ` 钟居哲
2024-01-17 19:01   ` Vineet Gupta [this message]

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=20240117190132.450071-1-vineetg@rivosinc.com \
    --to=vineetg@rivosinc.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=gnu-toolchain@rivosinc.com \
    /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).