diff mbox series

RISC-V: Fix infinite compilation of VSETVL PASS

Message ID 20240205231224.308265-1-juzhe.zhong@rivai.ai
State New
Headers show
Series RISC-V: Fix infinite compilation of VSETVL PASS | expand

Commit Message

钟居哲 Feb. 5, 2024, 11:12 p.m. UTC
This patch fixes issue reported by Jeff.

Testing is running. Ok for trunk if I passed the testing with no regression ?

gcc/ChangeLog:

	* config/riscv/riscv-vsetvl.cc (pre_vsetvl::emit_vsetvl): Fix inifinite compilation.
	(pre_vsetvl::remove_vsetvl_pre_insns): Ditto.

---
 gcc/config/riscv/riscv-vsetvl.cc | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

Comments

Robin Dapp Feb. 6, 2024, 12:33 p.m. UTC | #1
> Testing is running. Ok for trunk if I passed the testing with no
> regression ?
OK.

Regards
 Robin
diff mbox series

Patch

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 2c0dcdf18c5..32f262de199 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2281,9 +2281,8 @@  private:
       }
   }
 
-  void remove_vsetvl_insn (const vsetvl_info &info)
+  void remove_vsetvl_insn (rtx_insn *rinsn)
   {
-    rtx_insn *rinsn = info.get_insn ()->rtl ();
     if (dump_file)
       {
 	fprintf (dump_file, "  Eliminate insn %d:\n", INSN_UID (rinsn));
@@ -3231,7 +3230,7 @@  pre_vsetvl::emit_vsetvl ()
 	  if (curr_info.delete_p ())
 	    {
 	      if (vsetvl_insn_p (insn->rtl ()))
-		remove_vsetvl_insn (curr_info);
+		remove_vsetvl_insn (curr_info.get_insn ()->rtl ());
 	      continue;
 	    }
 	  else if (curr_info.valid_p ())
@@ -3269,7 +3268,7 @@  pre_vsetvl::emit_vsetvl ()
   for (const vsetvl_info &item : m_delete_list)
     {
       gcc_assert (vsetvl_insn_p (item.get_insn ()->rtl ()));
-      remove_vsetvl_insn (item);
+      remove_vsetvl_insn (item.get_insn ()->rtl ());
     }
 
   /* Insert vsetvl info that was not deleted after lift up.  */
@@ -3434,7 +3433,7 @@  pre_vsetvl::remove_vsetvl_pre_insns ()
 		       INSN_UID (rinsn));
 	      print_rtl_single (dump_file, rinsn);
 	    }
-	  remove_insn (rinsn);
+	  remove_vsetvl_insn (rinsn);
 	}
 }