]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Fix ICE of RTL CHECK on VSETVL PASS[PR111947]
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Tue, 24 Oct 2023 02:12:49 +0000 (10:12 +0800)
committerLehua Ding <lehua.ding@rivai.ai>
Tue, 24 Oct 2023 02:25:53 +0000 (10:25 +0800)
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
gcc/testsuite/gcc.target/riscv/rvv/vsetvl/pr111947.c [new file with mode: 0644]

index ef5efe002b722a6154d35e3d3a74d9ab7b4002d5..e9dd669de98e295f395f127a77fec27ad44e70b9 100644 (file)
@@ -2687,13 +2687,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 (file)
index 0000000..cea19b7
--- /dev/null
@@ -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 (;;)
+      ;
+}