[llvm] [SLP]Support LShr as base for copyable elements (PR #153393)
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 14 14:17:43 PDT 2025
asb wrote:
This caused a compile-time crash for zvl512b and zvl1024b RVV configurations (hopefully you got an email notification for failure on clang-riscv-rva23-zvl512b-2stage and clang-riscv-rva23-zvl1024b-2stage ?). I've confirmed this commit is the culprit via bisection.
Here is a reduced test case:
```
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "riscv64-unknown-linux-gnu"
define <8 x i16> @gsm_encode(ptr %s) {
entry:
%0 = load <19 x i16>, ptr %s, align 2
%1 = shufflevector <19 x i16> zeroinitializer, <19 x i16> %0, <9 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 28, i32 31, i32 poison, i32 poison>
%2 = shufflevector <9 x i16> %1, <9 x i16> zeroinitializer, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 15>
ret <8 x i16> %2
}
```
And the error:
```
]$ ./build/rvrel/bin/llc -O3 < reduced.ll -mattr=+rva23u64,+zvl512b
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_f2p2_d2p2_c2p0_b1p0_v1p0_zic64b1p0_zicbom1p0_zicbop1p0_zicboz1p0_ziccamoa1p0_ziccif1p0_zicclsm1p0_ziccrse1p0_zicntr2p0_zicond1p0_zicsr2p0_zihintntl1p0_zihintpause2p0_zihpm2p0_zimop1p0_zmmul1p0_za64rs1p0_zaamo1p0_zalrsc1p0_zawrs1p0_zfa1p0_zfhmin1p0_zca1p0_zcb1p0_zcd1p0_zcmop1p0_zba1p0_zbb1p0_zbs1p0_zkt1p0_zvbb1p0_zve32f1p0_zve32x1p0_zve64d1p0_zve64f1p0_zve64x1p0_zvfhmin1p0_zvkb1p0_zvkt1p0_zvl128b1p0_zvl256b1p0_zvl32b1p0_zvl512b1p0_zvl64b1p0_supm1p0"
.file "<stdin>"
llc: ../../llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:25828: SDValue narrowExtractedVectorLoad(EVT, SDValue, unsigned int, const SDLoc &, SelectionDAG &): Assertion `Index % NumElts == 0 && "The extract subvector index is not a " "multiple of the result's element count"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: ./build/rvrel/bin/llc -O3 -mattr=+rva23u64,+zvl512b
1. Running pass 'Function Pass Manager' on module '<stdin>'.
2. Running pass 'RISC-V DAG->DAG Pattern Instruction Selection' on function '@gsm_encode'
#0 0x00006079cc8cfae6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (./build/rvrel/bin/llc+0x3efeae6)
#1 0x00006079cc8cd085 llvm::sys::RunSignalHandlers() (./build/rvrel/bin/llc+0x3efc085)
#2 0x00006079cc8d0944 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x00007880bce4bcd0 (/usr/lib/libc.so.6+0x3dcd0)
#4 0x00007880bcea5624 (/usr/lib/libc.so.6+0x97624)
#5 0x00007880bce4bba0 raise (/usr/lib/libc.so.6+0x3dba0)
#6 0x00007880bce33582 abort (/usr/lib/libc.so.6+0x25582)
#7 0x00007880bce334eb __assert_perror_fail (/usr/lib/libc.so.6+0x254eb)
#8 0x00006079cc4cd527 (anonymous namespace)::DAGCombiner::visitEXTRACT_SUBVECTOR(llvm::SDNode*) DAGCombiner.cpp:0:0
#9 0x00006079cc47f006 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#10 0x00006079cc47c8b9 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (./build/rvrel/bin/llc+0x3aab8b9)
#11 0x00006079cc69b56c llvm::SelectionDAGISel::CodeGenAndEmitDAG() (./build/rvrel/bin/llc+0x3cca56c)
#12 0x00006079cc69a756 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (./build/rvrel/bin/llc+0x3cc9756)
#13 0x00006079cc6975d1 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (./build/rvrel/bin/llc+0x3cc65d1)
#14 0x00006079cc694f49 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (./build/rvrel/bin/llc+0x3cc3f49)
#15 0x00006079cb842ce3 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (./build/rvrel/bin/llc+0x2e71ce3)
#16 0x00006079cbdece19 llvm::FPPassManager::runOnFunction(llvm::Function&) (./build/rvrel/bin/llc+0x341be19)
#17 0x00006079cbdf54d2 llvm::FPPassManager::runOnModule(llvm::Module&) (./build/rvrel/bin/llc+0x34244d2)
#18 0x00006079cbded8a2 llvm::legacy::PassManagerImpl::run(llvm::Module&) (./build/rvrel/bin/llc+0x341c8a2)
#19 0x00006079cac87418 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#20 0x00006079cac84970 main (./build/rvrel/bin/llc+0x22b3970)
#21 0x00007880bce35488 (/usr/lib/libc.so.6+0x27488)
#22 0x00007880bce3554c __libc_start_main (/usr/lib/libc.so.6+0x2754c)
#23 0x00006079cac808a5 _start (./build/rvrel/bin/llc+0x22af8a5)
Aborted (core dumped)
```
This should be catchable on the faster gauntlet bot but I need to add zvl512b/zvl1024b to its test matrix.
https://github.com/llvm/llvm-project/pull/153393
More information about the llvm-commits
mailing list