[PowerPC] Assertion `TypeByteSize > 0 && "Vector element type too small for stack store!"` failed with `<16 x i16>` operations on `pwr10`
- Dominant language
- LLVM
- Stars
- 40.5k
- Forks
- 18.7k
- PR merge metrics
- PR metrics pending
Description
This is another blocker for getting Zig's `std.http` code working on POWER10+.
```llvm
; ModuleID = 'reduced.bc'
target datalayout = "e-m:e-Fn32-i64:64-i128:128-n32:64-S128-v256:256:256-v512:512:512"
target triple = "powerpc64le-unknown-linux5.10.0-unknown"
define fastcc <16 x i16> @crypto.Certificate.rsa.PKCS1v1_5Signature.concatVerify__anon_141461(<16 x i1> %0) #0 {
Entry:
%1 = bitcast <16 x i1> %0 to i16
%2 = insertelement <16 x i16> poison, i16 %1, i64 0
ret <16 x i16> %2
}
attributes #0 = { "target-cpu"="pwr10" }
```
```console
❯ llc --version | head -n2
LLVM (http://llvm.org/):
LLVM version 22.1.4
❯ llc reduced.ll
llc: /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1595: llvm::SDValue {anonymous}::SelectionDAGLegalize::ExpandVectorBuildThroughStack(llvm::SDNode*): Assertion `TypeByteSize > 0 && "Vector element type too small for stack store!"' 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: llc repro.opt.bc
1. Running pass 'Function Pass Manager' on module 'repro.opt.bc'.
2. Running pass 'PowerPC DAG->DAG Pattern Instruction Selection' on function '@crypto.Certificate.rsa.PKCS1v1_5Signature.concatVerify__anon_141461'
#0 0x00007a435c2221ed llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/alexrp/Sources/llvm/llvm/lib/Support/Unix/Signals.inc:846:3
#1 0x00007a435c21f324 llvm::sys::RunSignalHandlers() /home/alexrp/Sources/llvm/llvm/lib/Support/Signals.cpp:108:20
#2 0x00007a435c21fb3c SignalHandler(int, siginfo_t*, void*) /home/alexrp/Sources/llvm/llvm/lib/Support/Unix/Signals.inc:429:14
#3 0x00007a435aa45f60 (/lib/x86_64-linux-gnu/libc.so.6+0x45f60)
#4 0x00007a435aaa5fed __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#5 0x00007a435aaa5fed __pthread_kill_internal ./nptl/pthread_kill.c:89:10
#6 0x00007a435aaa5fed pthread_kill ./nptl/pthread_kill.c:100:10
#7 0x00007a435aa45e2e raise ./signal/../sysdeps/posix/raise.c:27:6
#8 0x00007a435aa28888 internal_signal_block_all ./stdlib/../sysdeps/unix/sysv/linux/internal-signals.h:81:3
#9 0x00007a435aa28888 __abort_lock_wrlock ./stdlib/abort.c:62:3
#10 0x00007a435aa28888 abort ./stdlib/abort.c:85:3
#11 0x00007a435aa287f0 __assert_perror_fail ./assert/assert-perr.c:31:1
#12 0x00007a435bb66137 llvm::isa_impl_cl::doit(llvm::SDNode const*) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1595:3
#13 0x00007a435bb66137 llvm::isa_impl_wrap::doit(llvm::SDNode const* const&) /home/alexrp/Sources/llvm/llvm/include/llvm/Support/Casting.h:137:41
#14 0x00007a435bb66137 llvm::isa_impl_wrap::doit(llvm::SDNode const* const&) /home/alexrp/Sources/llvm/llvm/include/llvm/Support/Casting.h:129:13
#15 0x00007a435bb66137 llvm::CastIsPossible::isPossible(llvm::SDNode const* const&) /home/alexrp/Sources/llvm/llvm/include/llvm/Support/Casting.h:257:62
#16 0x00007a435bb66137 llvm::CastInfo::isPossible(llvm::SDNode* const&) /home/alexrp/Sources/llvm/llvm/include/llvm/Support/Casting.h:509:38
#17 0x00007a435bb66137 bool llvm::isa(llvm::SDNode* const&) /home/alexrp/Sources/llvm/llvm/include/llvm/Support/Casting.h:548:47
#18 0x00007a435bb66137 decltype(auto) llvm::cast(llvm::SDNode*) /home/alexrp/Sources/llvm/llvm/include/llvm/Support/Casting.h:572:3
#19 0x00007a435bb66137 (anonymous namespace)::SelectionDAGLegalize::ExpandVectorBuildThroughStack(llvm::SDNode*) (.cold) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1588:61
#20 0x00007a435cc8f8f9 (anonymous namespace)::SelectionDAGLegalize::ExpandBUILD_VECTOR(llvm::SDNode*) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:2113:39
#21 0x00007a435cca69b4 (anonymous namespace)::SelectionDAGLegalize::ExpandNode(llvm::SDNode*) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:4516:22
#22 0x00007a435cc9e9d0 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1381:7
#23 0x00007a435cca1820 llvm::SelectionDAG::Legalize() /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:6262:28
#24 0x00007a435ce86f08 llvm::TimeRegion::~TimeRegion() /home/alexrp/Sources/llvm/llvm/include/llvm/Support/Timer.h:167:9
#25 0x00007a435ce86f08 llvm::NamedRegionTimer::~NamedRegionTimer() /home/alexrp/Sources/llvm/llvm/include/llvm/Support/Timer.h:175:8
#26 0x00007a435ce86f08 llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1098:3
#27 0x00007a435ce8ae63 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1937:33
#28 0x00007a435ce8c203 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:635:22
#29 0x00007a43602ba7bc (anonymous namespace)::PPCDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Sources/llvm/llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp:173:5
#30 0x00007a435ce77df1 llvm::OptLevelChanger::~OptLevelChanger() /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:285:11
#31 0x00007a435ce77df1 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:402:1
#32 0x00007a435ce77df1 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:374:6
#33 0x00007a435c7ab02a llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) /home/alexrp/Sources/llvm/llvm/lib/CodeGen/MachineFunctionPass.cpp:108:30
#34 0x00007a435c3ddb2a llvm::FPPassManager::runOnFunction(llvm::Function&) /home/alexrp/Sources/llvm/llvm/lib/IR/LegacyPassManager.cpp:1398:40
#35 0x00007a435c3ddd35 llvm::ilist_detail::node_base_prevnext, true>::getNext() const /home/alexrp/Sources/llvm/llvm/include/llvm/ADT/ilist_node_base.h:42:38
#36 0x00007a435c3ddd35 llvm::ilist_node_impl>::getNext() /home/alexrp/Sources/llvm/llvm/include/llvm/ADT/ilist_node.h:108:66
#37 0x00007a435c3ddd35 llvm::ilist_iterator, false, false>::operator++() /home/alexrp/Sources/llvm/llvm/include/llvm/ADT/ilist_iterator.h:187:25
#38 0x00007a435c3ddd35 llvm::FPPassManager::runOnModule(llvm::Module&) /home/alexrp/Sources/llvm/llvm/lib/IR/LegacyPassManager.cpp:1443:22
#39 0x00007a435c3de5cf runOnModule /home/alexrp/Sources/llvm/llvm/lib/IR/LegacyPassManager.cpp:1513:38
#40 0x00007a435c3de5cf llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/alexrp/Sources/llvm/llvm/lib/IR/LegacyPassManager.cpp:531:55
#41 0x00005ca8d0bb79f5 compileModule(char**, llvm::SmallVectorImpl&, llvm::LLVMContext&, std::__cxx11::basic_string, std::allocator>&) /home/alexrp/Sources/llvm/llvm/tools/llc/llc.cpp:874:34
#42 0x00005ca8d0baaf5c main /home/alexrp/Sources/llvm/llvm/tools/llc/llc.cpp:462:35
#43 0x00007a435aa2a575 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#44 0x00007a435aa2a628 call_init ./csu/../csu/libc-start.c:128:20
#45 0x00007a435aa2a628 __libc_start_main ./csu/../csu/libc-start.c:347:5
#46 0x00005ca8d0babce5 _start (/opt/llvm-22/bin/llc+0x15ce5)
```
Contributor guide
Assessment
This issue has not been assessed yet.