Issue 172154
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
Assignees
Reporter XChy
    Reproducer: https://godbolt.org/z/1xnPn9qqq
Testcase:
```llvm
; llc %s
target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n32:64-S128"
target triple = "loongarch64-unknown-linux-musl"

define <4 x i32> @backsmith_pure_2(<4 x i32> %conv22) {
entry:
  %bc.i = bitcast <16 x i8> zeroinitializer to <8 x i16>
  %vecext.i = extractelement <8 x i16> %bc.i, i64 0
  %not.i1 = xor i16 %vecext.i, -1
  %vecinit24 = insertelement <4 x i16> zeroinitializer, i16 %not.i1, i64 0
  %vecinit27 = shufflevector <4 x i16> %vecinit24, <4 x i16> zeroinitializer, <4 x i32> zeroinitializer
  %conv28 = zext <4 x i16> %vecinit27 to <4 x i32>
  %rem = urem <4 x i32> %conv22, %conv28
  ret <4 x i32> %rem
}
```

Dump:
```
llc: /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:985: 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 -O1 <source>
1.	Running pass 'Function Pass Manager' on module '<source>'.
2.	Running pass 'LoongArch DAG->DAG Pattern Instruction Selection' on function '@backsmith_pure_2'
 #0 0x000000000421f998 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x421f998)
 #1 0x000000000421c844 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x000075ac41642520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000075ac416969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000075ac41642476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000075ac416287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000075ac4162871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #7 0x000075ac41639e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #8 0x0000000003e936c7 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) (.part.0) LegalizeDAG.cpp:0:0
 #9 0x0000000003e95c6a llvm::SelectionDAG::LegalizeOp(llvm::SDNode*, llvm::SmallSetVector<llvm::SDNode*, 16u>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3e95c6a)
#10 0x0000000003e47ab6 (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
#11 0x0000000003e4a243 llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::BatchAAResults*, llvm::CodeGenOptLevel) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3e4a243)
#12 0x0000000003fb6165 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fb6165)
#13 0x0000000003fb93e8 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fb93e8)
#14 0x0000000003fbae6c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fbae6c)
#15 0x0000000003fa666f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3fa666f)
#16 0x00000000030f5839 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x0000000003750196 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3750196)
#18 0x0000000003750541 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3750541)
#19 0x0000000003750daf llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x3750daf)
#20 0x00000000008fe184 compileModule(char**, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) llc.cpp:0:0
#21 0x00000000007c86f9 main (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x7c86f9)
#22 0x000075ac41629d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#23 0x000075ac41629e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#24 0x00000000008f3385 _start (/opt/compiler-explorer/clang-assertions-trunk/bin/llc+0x8f3385)
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