aboutsummaryrefslogtreecommitdiff
path: root/gcc/dse.cc
diff options
context:
space:
mode:
authorPan Li <pan2.li@intel.com>2024-04-30 09:42:39 +0800
committerPan Li <pan2.li@intel.com>2024-05-20 09:05:04 +0800
commit88b3f83238087cbe2aa2c51c6054796856f2fb94 (patch)
treeda22d38bfca00871ea951ccc23528b2df7478ab1 /gcc/dse.cc
parentf22afbe0e084f478ef7a5594a00b8eb232958a7f (diff)
downloadgcc-88b3f83238087cbe2aa2c51c6054796856f2fb94.zip
gcc-88b3f83238087cbe2aa2c51c6054796856f2fb94.tar.gz
gcc-88b3f83238087cbe2aa2c51c6054796856f2fb94.tar.bz2
DSE: Fix ICE after allow vector type in get_stored_val
We allowed vector type for get_stored_val when read is less than or equal to store in previous. Unfortunately, the valididate_subreg treats the vector type's size is less than vector register as invalid. Then we will have ICE here. This patch would like to fix it by filter-out the invalid type size, and make sure the subreg is valid for both the read_mode and store_mode before perform the real gen_lowpart. The below test suites are passed for this patch: * The x86 bootstrap test. * The x86 regression test. * The riscv rv64gcv regression test. * The riscv rv64gc regression test. * The aarch64 regression test. gcc/ChangeLog: * dse.cc (get_stored_val): Make sure read_mode/write_mode is valid subreg before gen_lowpart. gcc/testsuite/ChangeLog: * gcc.target/riscv/rvv/base/bug-6.c: New test. Signed-off-by: Pan Li <pan2.li@intel.com>
Diffstat (limited to 'gcc/dse.cc')
-rw-r--r--gcc/dse.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/dse.cc b/gcc/dse.cc
index edc7a1d..1596da9 100644
--- a/gcc/dse.cc
+++ b/gcc/dse.cc
@@ -1946,7 +1946,9 @@ get_stored_val (store_info *store_info, machine_mode read_mode,
copy_rtx (store_info->const_rhs));
else if (VECTOR_MODE_P (read_mode) && VECTOR_MODE_P (store_mode)
&& known_le (GET_MODE_BITSIZE (read_mode), GET_MODE_BITSIZE (store_mode))
- && targetm.modes_tieable_p (read_mode, store_mode))
+ && targetm.modes_tieable_p (read_mode, store_mode)
+ && validate_subreg (read_mode, store_mode, copy_rtx (store_info->rhs),
+ subreg_lowpart_offset (read_mode, store_mode)))
read_reg = gen_lowpart (read_mode, copy_rtx (store_info->rhs));
else
read_reg = extract_low_bits (read_mode, store_mode,