Closed
Description
Description
When feature simd128
is on, the following code crashes the WebAssembly backend (both wasm32
and wasm64
) with error Cannot select: v16i8 = BUILD_VECTOR
。
Minimal Reproduction
https://godbolt.org/z/o71M96j4P
Code
define <4 x i8> @f(<4 x i8> %0) {
BB:
%V1 = or <4 x i8> <i8 255, i8 255, i8 255, i8 255>, %0
%V2 = insertelement <4 x i8> %V1, i8 17, i32 1
ret <4 x i8> %V2
}
Stack Trace
LLVM ERROR: Cannot select: t27: v16i8 = BUILD_VECTOR Constant:i32<255>, Constant:i32<17>, Constant:i32<255>, Constant:i32<255>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>, Constant:i32<0>
t25: i32 = Constant<255>
t22: i32 = Constant<17>
t25: i32 = Constant<255>
t25: i32 = Constant<255>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
t26: i32 = Constant<0>
In function: f
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -mtriple=wasm64 -mattr=+simd128 <source>
1. Running pass 'Function Pass Manager' on module '<source>'.
2. Running pass 'WebAssembly Instruction Selection' on function '@f'
#0 0x000055f974a9115f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x354b15f)
#1 0x000055f974a8e8b4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007f5bd0016420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
#3 0x00007f5bcfae300b raise (/lib/x86_64-linux-gnu/libc.so.6+0x4300b)
#4 0x00007f5bcfac2859 abort (/lib/x86_64-linux-gnu/libc.so.6+0x22859)
#5 0x000055f971d20a66 llvm::RISCVISAInfo::updateImplication() (.cold) RISCVISAInfo.cpp:0:0
#6 0x000055f97484e02d llvm::SelectionDAGISel::CannotYetSelect(llvm::SDNode*) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x330802d)
#7 0x000055f97484ff6a llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3309f6a)
#8 0x000055f9730b8b1f (anonymous namespace)::WebAssemblyDAGToDAGISel::Select(llvm::SDNode*) WebAssemblyISelDAGToDAG.cpp:0:0
#9 0x000055f97484a630 llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3304630)
#10 0x000055f974857e44 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3311e44)
#11 0x000055f97485b4c8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x33154c8)
#12 0x000055f97485d192 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#13 0x000055f973d306ce llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x000055f9742ca7f1 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d847f1)
#15 0x000055f9742caa39 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d84a39)
#16 0x000055f9742cb2b2 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x2d852b2)
#17 0x000055f971ddd634 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x000055f971d25f06 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7dff06)
#19 0x00007f5bcfac4083 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x24083)
#20 0x000055f971dd3a1e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x88da1e)
Program terminated with signal: SIGSEGV
Compiler returned: 139