public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Juzhe-Zhong <juzhe.zhong@rivai.ai>
To: gcc-patches@gcc.gnu.org
Cc: kito.cheng@gmail.com, kito.cheng@sifive.com,
	jeffreyalaw@gmail.com, rdapp.gcc@gmail.com,
	Juzhe-Zhong <juzhe.zhong@rivai.ai>
Subject: [Committed] RISC-V: Fix ICE of RTL CHECK on VSETVL PASS[PR111947]
Date: Tue, 24 Oct 2023 10:21:39 +0800	[thread overview]
Message-ID: <20231024022139.218915-1-juzhe.zhong@rivai.ai> (raw)

ICE on vsetvli a5, 8 instruction demand info.

The AVL is const_int 8 which ICE on RENGO caller.

Committed as it is obvious fix.

	PR target/111947

gcc/ChangeLog:

	* config/riscv/riscv-vsetvl.cc (pre_vsetvl::compute_lcm_local_properties): Add REGNO check.

gcc/testsuite/ChangeLog:

	* gcc.target/riscv/rvv/vsetvl/pr111947.c: New test.

---
 gcc/config/riscv/riscv-vsetvl.cc                  | 15 +++++++++------
 .../gcc.target/riscv/rvv/vsetvl/pr111947.c        | 13 +++++++++++++
 2 files changed, 22 insertions(+), 6 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111947.c

diff --git a/gcc/config/riscv/riscv-vsetvl.cc b/gcc/config/riscv/riscv-vsetvl.cc
index 5ef0f726e4a..f2f19e423bf 100644
--- a/gcc/config/riscv/riscv-vsetvl.cc
+++ b/gcc/config/riscv/riscv-vsetvl.cc
@@ -2633,13 +2633,16 @@ pre_vsetvl::compute_lcm_local_properties ()
 	      if (!info.has_nonvlmax_reg_avl () && !info.has_vl ())
 		continue;
 
-	      unsigned int regno;
-	      sbitmap_iterator sbi;
-	      EXECUTE_IF_SET_IN_BITMAP (m_reg_def_loc[bb->index ()], 0, regno,
-					sbi)
+	      if (info.has_nonvlmax_reg_avl ())
 		{
-		  if (regno == REGNO (info.get_avl ()))
-		    bitmap_clear_bit (m_transp[bb->index ()], i);
+		  unsigned int regno;
+		  sbitmap_iterator sbi;
+		  EXECUTE_IF_SET_IN_BITMAP (m_reg_def_loc[bb->index ()], 0,
+					    regno, sbi)
+		    {
+		      if (regno == REGNO (info.get_avl ()))
+			bitmap_clear_bit (m_transp[bb->index ()], i);
+		    }
 		}
 
 	      for (const insn_info *insn : bb->real_nondebug_insns ())
diff --git a/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111947.c b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111947.c
new file mode 100644
index 00000000000..cea19b70e20
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111947.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64gcv -mabi=lp64d -O2 -Wno-implicit-int" } */
+
+char *a;
+b() {
+  int c[2];
+  int d = 0;
+  for (; d < 16; d += 2)
+    c[d / 2] = a[d | 1];
+  if (c[0])
+    for (;;)
+      ;
+}
-- 
2.36.3


                 reply	other threads:[~2023-10-24  2:21 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=20231024022139.218915-1-juzhe.zhong@rivai.ai \
    --to=juzhe.zhong@rivai.ai \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jeffreyalaw@gmail.com \
    --cc=kito.cheng@gmail.com \
    --cc=kito.cheng@sifive.com \
    --cc=rdapp.gcc@gmail.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).