Skip to content

[WebAssembly] llc (assertion trunk) crashed at -O0 with -msimd128 enabled #165438

@XChy

Description

@XChy

Reproducer: https://godbolt.org/z/9KvoMqd1f
Testcase:

target datalayout = "e-m:e-p:32:32-p10:8:8-p20:8:8-i64:64-i128:128-n32:64-S128-ni:1:10:20"
target triple = "wasm32-unknown-wasi"

define i8 @func_1(<4 x i32> %0) #0 {
entry:
  %conv = trunc <4 x i32> %0 to <4 x i8>
  br label %cond.true

cond.true:                                        ; preds = %entry
  %vecext = extractelement <4 x i8> %conv, i32 0
  ret i8 %vecext
}

attributes #0 = { "target-features"="+simd128" }

llc output:

llc: /root/llvm-project/llvm/include/llvm/Support/Casting.h:572: decltype(auto) llvm::cast(From*) [with To = llvm::IntegerType; From = const llvm::Type]: Assertion `isa<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-assertions-trunk/bin/llc -o /app/output.s -x86-asm-syntax=intel -O0 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'WebAssembly Instruction Selection' on function '@func_1'
 #0 0x0000000004184888 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4184888)
 #1 0x0000000004181734 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f9875242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f98752969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007f9875242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007f98752287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x00007f987522871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x00007f9875239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x00000000021c163d (anonymous namespace)::WebAssemblyFastISel::fastSelectInstruction(llvm::Instruction const*) WebAssemblyFastISel.cpp:0:0
 #9 0x0000000003db94fb llvm::FastISel::selectInstruction(llvm::Instruction const*) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3db94fb)
#10 0x0000000003f16798 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3f16798)
#11 0x0000000003f18025 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3f18025)
#12 0x0000000003f03a2f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3f03a2f)
#13 0x000000000306a5c9 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x00000000036b8dd6 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36b8dd6)
#15 0x00000000036b9181 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36b9181)
#16 0x00000000036b99ef llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x36b99ef)
#17 0x00000000008f9af3 compileModule(char**, llvm::LLVMContext&) llc.cpp:0:0
#18 0x00000000007c6926 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c6926)
#19 0x00007f9875229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#20 0x00007f9875229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#21 0x00000000008eef35 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8eef35)
Program terminated with signal: SIGSEGV
Compiler returned: 139

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions