OK.
Which is better for testcase name?

1.      ice-biggestmode.c or

2.      Report a bug and name the testcase with PR id

From: juzhe.zh...@rivai.ai <juzhe.zh...@rivai.ai>
Sent: 2024年3月7日 15:20
To: Demin Han <demin....@starfivetech.com>; gcc-patches 
<gcc-patches@gcc.gnu.org>
Cc: kito.cheng <kito.ch...@gmail.com>; pan2.li <pan2...@intel.com>; jeffreyalaw 
<jeffreya...@gmail.com>
Subject: Re: [PATCH] RISC-V: Fix ICE in riscv vector costs

Could you plz add testcase ? I just noticed you didn't append a testcase (jpeg) 
in this patch.

________________________________
juzhe.zh...@rivai.ai<mailto:juzhe.zh...@rivai.ai>

From: demin.han<mailto:demin....@starfivetech.com>
Date: 2024-03-07 13:54
To: gcc-patches<mailto:gcc-patches@gcc.gnu.org>
CC: juzhe.zhong<mailto:juzhe.zh...@rivai.ai>; 
kito.cheng<mailto:kito.ch...@gmail.com>; pan2.li<mailto:pan2...@intel.com>; 
jeffreyalaw<mailto:jeffreya...@gmail.com>
Subject: [PATCH] RISC-V: Fix ICE in riscv vector costs
The following code can result in ICE:
-march=rv64gcv_zba_zbb --param riscv-autovec-lmul=dynamic -O3

char *jpeg_difference7_input_buf;
void jpeg_difference7(int *diff_buf) {
  unsigned width;
  int samp, Rb;
  while (--width) {
    Rb = samp = *jpeg_difference7_input_buf;
    *diff_buf++ = -(int)(samp + (long)Rb >> 1);
  }
}

One biggest_mode update missed in one branch and trigger assertion fail.
gcc_assert (biggest_size >= mode_size);

Tested On RV64 and no regression.

gcc/ChangeLog:

* config/riscv/riscv-vector-costs.cc: Fix ICE

Signed-off-by: demin.han 
<demin....@starfivetech.com<mailto:demin....@starfivetech.com>>
---
gcc/config/riscv/riscv-vector-costs.cc | 2 ++
1 file changed, 2 insertions(+)

diff --git a/gcc/config/riscv/riscv-vector-costs.cc 
b/gcc/config/riscv/riscv-vector-costs.cc
index 7c9840df4e9..f13a1296b31 100644
--- a/gcc/config/riscv/riscv-vector-costs.cc
+++ b/gcc/config/riscv/riscv-vector-costs.cc
@@ -413,6 +413,8 @@ compute_local_live_ranges (
  auto *r = get_live_range (live_ranges, arg);
  gcc_assert (r);
  (*r).second = MAX (point, (*r).second);
+   biggest_mode = get_biggest_mode (
+     biggest_mode, TYPE_MODE (TREE_TYPE (arg)));
}
    }
  else
--
2.44.0


Reply via email to