Skip to content

[Hexagon] Cannot select truncate for i1 vectors #59685

Closed
@HazyFish

Description

@HazyFish

Description

Truncating a vector into a i1 vector will crash backend with error Cannot select: t5: v8i1 = truncate t2 when targeting hexagon.

Minimal Reproduction

https://godbolt.org/z/7bhMxzcdP

Code

define void @f(<8 x i8> %0, ptr %1) {
BB:
  %C = trunc <8 x i8> %0 to <8 x i1>
  store <8 x i1> %C, ptr %1
  ret void
}

Stack Trace

LLVM ERROR: Cannot select: t5: v8i1 = truncate t2
  t2: v8i8,ch = CopyFromReg t0, Register:v8i8 %0
    t1: v8i8 = Register %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: ./llvm-project-latest/build-debug/bin/llc -mtriple=hexagon ./crash-reports/dagisel-hexagon/6.ll
1.	Running pass 'Function Pass Manager' on module './crash-reports/dagisel-hexagon/6.ll'.
2.	Running pass 'Hexagon DAG->DAG Pattern Instruction Selection' on function '@f'
 #0 0x00007fc53da76f8a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/Support/Unix/Signals.inc:567:11
 #1 0x00007fc53da7713b PrintStackTraceSignalHandler(void*) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/Support/Unix/Signals.inc:641:1
 #2 0x00007fc53da757b6 llvm::sys::RunSignalHandlers() /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/Support/Signals.cpp:104:5
 #3 0x00007fc53da77865 SignalHandler(int) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/Support/Unix/Signals.inc:412:1
 #4 0x00007fc53bfe7980 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x12980)
 #5 0x00007fc53b2e3e87 raise /build/glibc-CVJwZb/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #6 0x00007fc53b2e57f1 abort /build/glibc-CVJwZb/glibc-2.27/stdlib/abort.c:81:0
 #7 0x00007fc53d9129c4 llvm::report_fatal_error(llvm::Twine const&, bool) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/Support/ErrorHandling.cpp:125:5
 #8 0x00007fc53e26dccb /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:3817:3
 #9 0x00007fc53e26b262 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:3719:9
#10 0x00007fc54da67fd9 llvm::HexagonDAGToDAGISel::SelectCode(llvm::SDNode*) /home/henry/aflplusplus-isel/llvm-project-latest/build-debug/lib/Target/Hexagon/HexagonGenDAGISel.inc:90997:1
#11 0x00007fc54da77c41 llvm::HexagonDAGToDAGISel::Select(llvm::SDNode*) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp:956:1
#12 0x00007fc53e25f009 llvm::SelectionDAGISel::DoInstructionSelection() /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1178:5
#13 0x00007fc53e25e05a llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:949:3
#14 0x00007fc53e25ca2d llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, llvm::ilist_iterator<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void>, false, true>, bool&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:701:1
#15 0x00007fc53e25c4bd llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1641:11
#16 0x00007fc53e259997 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:480:3
#17 0x00007fc54da8541e llvm::HexagonDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/Target/Hexagon/HexagonISelDAGToDAG.h:48:23
#18 0x00007fc54128cf55 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/CodeGen/MachineFunctionPass.cpp:91:8
#19 0x00007fc5403c5606 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/IR/LegacyPassManager.cpp:1430:23
#20 0x00007fc5403ca432 llvm::FPPassManager::runOnModule(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/IR/LegacyPassManager.cpp:1476:16
#21 0x00007fc5403c5ed9 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/IR/LegacyPassManager.cpp:1545:23
#22 0x00007fc5403c5a4d llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/IR/LegacyPassManager.cpp:535:16
#23 0x00007fc5403ca711 llvm::legacy::PassManager::run(llvm::Module&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/lib/IR/LegacyPassManager.cpp:1672:3
#24 0x0000000000419bc6 compileModule(char**, llvm::LLVMContext&) /home/henry/aflplusplus-isel/llvm-project-latest/llvm/tools/llc/llc.cpp:739:41
#25 0x0000000000417f65 main /home/henry/aflplusplus-isel/llvm-project-latest/llvm/tools/llc/llc.cpp:420:13
#26 0x00007fc53b2c6c87 __libc_start_main /build/glibc-CVJwZb/glibc-2.27/csu/../csu/libc-start.c:344:0
#27 0x000000000041773a _start (./llvm-project-latest/build-debug/bin/llc+0x41773a)

Metadata

Metadata

Assignees

Labels

backend:HexagoncrashPrefer [crash-on-valid] or [crash-on-invalid]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions