public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Fix potential ICE of global vsetvl elimination
@ 2023-08-23  2:42 Juzhe-Zhong
  0 siblings, 0 replies; only message in thread
From: Juzhe-Zhong @ 2023-08-23  2:42 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, kito.cheng, Juzhe-Zhong

Committed for following VSETVL refactor patch to make V2 patch easier to review.
gcc/ChangeLog:

        * config/riscv/riscv-vsetvl.cc (pass_vsetvl::global_eliminate_vsetvl_insn): Fix potential ICE.

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

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index ec1aaa4b442..f7558cad2e2 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -4383,7 +4383,7 @@ pass_vsetvl::global_eliminate_vsetvl_insn (const bb_info *bb) const
 
   unsigned int bb_index;
   sbitmap_iterator sbi;
-  rtx avl = get_avl (dem.get_insn ()->rtl ());
+  rtx avl = dem.get_avl ();
   hash_set<set_info *> sets
     = get_all_sets (dem.get_avl_source (), true, false, false);
   /* Condition 2: All VL/VTYPE available in are all compatible.  */
@@ -4407,7 +4407,10 @@ pass_vsetvl::global_eliminate_vsetvl_insn (const bb_info *bb) const
     {
       sbitmap avout = m_vector_manager->vector_avout[e->src->index];
       if (e->src == ENTRY_BLOCK_PTR_FOR_FN (cfun)
-	  || e->src == EXIT_BLOCK_PTR_FOR_FN (cfun) || bitmap_empty_p (avout))
+	  || e->src == EXIT_BLOCK_PTR_FOR_FN (cfun)
+	  || (unsigned int) e->src->index
+	       >= m_vector_manager->vector_block_infos.length ()
+	  || bitmap_empty_p (avout))
 	return false;
 
       EXECUTE_IF_SET_IN_BITMAP (avout, 0, bb_index, sbi)
-- 
2.36.3


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

only message in thread, other threads:[~2023-08-23  2:42 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-23  2:42 [PATCH] RISC-V: Fix potential ICE of global vsetvl elimination Juzhe-Zhong

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).