Issue 177155
Summary [LoongArch] Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal type!"' failed.
Labels crash-on-valid, backend:loongarch, generated by fuzzer
Assignees
Reporter XChy
    Reproducer: https://godbolt.org/z/TKK5hhYaP
Testcase:
```llvm
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "loongarch64-unknown-linux-musl"

define i8 @backsmith_pure_1(<2 x i32> %vecinit7) {
entry:
  %0 = tail call <16 x i8> @llvm.loongarch.lsx.vadd.b(<16 x i8> splat (i8 1), <16 x i8> zeroinitializer)
  %shuffle = shufflevector <16 x i8> %0, <16 x i8> zeroinitializer, <2 x i32> <i32 2, i32 0>
  %1 = and <2 x i8> %shuffle, splat (i8 1)
  %and = zext <2 x i8> %1 to <2 x i32>
  %and.i = and <2 x i32> %vecinit7, %and
  %conv.i = zext <2 x i32> %and.i to <2 x i64>
 %sub.i = sub <2 x i64> zeroinitializer, %conv.i
  %2 = bitcast <2 x i64> %sub.i to <16 x i8>
  %conv14 = extractelement <16 x i8> %2, i64 4
  ret i8 %conv14
}

; Function Attrs: nounwind memory(none)
declare <16 x i8> @llvm.loongarch.lsx.vadd.b(<16 x i8>, <16 x i8>) #0

attributes #0 = { nounwind memory(none) }
```

Dump:
```llvm
llc: /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:986: void {anonymous}::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*): Assertion `(TLI.getTypeAction(*DAG.getContext(), Op.getValueType()) == TargetLowering::TypeLegal || Op.getOpcode() == ISD::TargetConstant || Op.getOpcode() == ISD::Register) && "Unexpected illegal 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 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@backsmith_pure_1'
 #0 0x0000000004267098 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x4267098)
 #1 0x0000000004263f74 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000743b51842520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x0000743b518969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x0000743b51842476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x0000743b518287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000743b5182871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x0000743b51839e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000003ed299f (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) (.part.0) LegalizeDAG.cpp:0:0
 #9 0x0000000003ed4ffe llvm::SelectionDAG::Legalize() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3ed4ffe)
#10 0x0000000003ff83a6 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3ff83a6)
#11 0x0000000003ffb278 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3ffb278)
#12 0x0000000003ffcd9c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3ffcd9c)
#13 0x0000000003fe861f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fe861f)
#14 0x000000000312c799 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#15 0x0000000003785216 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3785216)
#16 0x00000000037855c1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x37855c1)
#17 0x0000000003785e2f llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3785e2f)
#18 0x00000000008e9c32 compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#19 0x00000000007c528c main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c528c)
#20 0x0000743b51829d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#21 0x0000743b51829e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#22 0x00000000008decd5 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8decd5)
Program terminated with signal: SIGSEGV
Compiler returned: 139
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to