<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/92779>92779</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Hitting `Assertion 'N->getNumValues() == 1 && "Expected one result!"' failed` when targeting `neoverse-v2`
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
Saldivarcher
</td>
</tr>
</table>
<pre>
Hitting an assert with this LLVM IR:
```console
$ cat reduced.ll
target datalayout = "e-m:e-i8:8:32-i16:16:32-i64:64-i128:128-n32:64-S128"
target triple = "aarch64-unknown-linux-gnu"
define void @main(ptr %0) {
"file t13_206.f90, line 27, bb4133118":
%1 = bitcast <vscale x 2 x i64> zeroinitializer to <vscale x 4 x i32>
%r2689 = extractelement <vscale x 4 x i32> %1, i64 0
%r2690 = insertelement <2 x i32> zeroinitializer, i32 %r2689, i64 0
%2 = bitcast <vscale x 2 x i64> zeroinitializer to <vscale x 4 x i32>
%r2692 = extractelement <vscale x 4 x i32> %2, i64 2
%r2693 = insertelement <2 x i32> %r2690, i32 %r2692, i64 1
%r2696 = sub <2 x i32> zeroinitializer, %r2693
%r2697 = extractelement <2 x i32> %r2696, i64 0
%r2698 = sext i32 %r2697 to i64
%r2699 = insertelement <vscale x 2 x i64> zeroinitializer, i64 %r2698, i64 0
%r2700 = extractelement <2 x i32> %r2696, i64 1
%r2701 = sext i32 %r2700 to i64
%r2702 = insertelement <vscale x 2 x i64> %r2699, i64 %r2701, i64 0
store <vscale x 2 x i64> %r2702, ptr %0, align 16
ret void
}
$ llc -mcpu=neoverse-v2 reduced.ll
llc: /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:28096: virtual void llvm::AArch64TargetLowering::verifyTargetSDNode(const llvm::SDNode*) const: Assertion `N->getNumValues() == 1 && "Expected one result!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/users/saldivar/workspace/llvm-project.git/build_debug/bin/llc -mcpu=neoverse-v2 reduced.ll
1. Running pass 'Function Pass Manager' on module 'reduced.ll'.
2. Running pass 'AArch64 Instruction Selection' on function '@main'
#0 0x0000000004646b98 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Support/Unix/Signals.inc:723:22
#1 0x0000000004646f2c PrintStackTraceSignalHandler(void*) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Support/Unix/Signals.inc:798:1
#2 0x0000000004644b54 llvm::sys::RunSignalHandlers() /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Support/Signals.cpp:105:20
#3 0x000000000464651c SignalHandler(int) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Support/Unix/Signals.inc:413:1
#4 0x0000ffffae6087cc (linux-vdso.so.1+0x7cc)
#5 0x0000ffffae057500 raise (/lib64/libc.so.6+0x37500)
#6 0x0000ffffae0588a4 abort (/lib64/libc.so.6+0x388a4)
#7 0x0000ffffae0509e8 __assert_fail_base (/lib64/libc.so.6+0x309e8)
#8 0x0000ffffae050a64 (/lib64/libc.so.6+0x30a64)
#9 0x0000000000f9a008 llvm::AArch64TargetLowering::verifyTargetSDNode(llvm::SDNode const*) const /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:28096:0
#10 0x00000000043ce204 VerifySDNode(llvm::SDNode*, llvm::TargetLowering const*) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1121:5
#11 0x00000000043ce6cc llvm::SelectionDAG::InsertNode(llvm::SDNode*) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:1166:27
#12 0x00000000043fb070 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::SDVTList, llvm::ArrayRef<llvm::SDValue>, llvm::SDNodeFlags) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:10181:17
#13 0x00000000043f9eac llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::SDVTList, llvm::ArrayRef<llvm::SDValue>) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:9992:1
#14 0x00000000043fb1b8 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc const&, llvm::SDVTList, llvm::SDValue, llvm::SDValue) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:10201:1
#15 0x0000000000f55af0 llvm::AArch64TargetLowering::LowerBUILD_VECTOR(llvm::SDValue, llvm::SelectionDAG&) const /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:13534:0
#16 0x0000000000f30118 llvm::AArch64TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:6563:0
#17 0x0000000004326a88 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:1305:65
#18 0x0000000004340094 llvm::SelectionDAG::Legalize() /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp:5746:25
#19 0x0000000004436240 llvm::SelectionDAGISel::CodeGenAndEmitDAG() /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:938:61
#20 0x0000000004434fe0 llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true>, false, true>, llvm::ilist_iterator_w_bits<llvm::ilist_detail::node_options<llvm::Instruction, true, false, void, true>, false, true>, bool&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:736:1
#21 0x0000000004439a00 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1754:33
#22 0x0000000004433f3c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:517:7
#23 0x0000000000ed384c (anonymous namespace)::AArch64DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp:57:0
#24 0x000000000333efe4 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/CodeGen/MachineFunctionPass.cpp:93:33
#25 0x0000000003aa6744 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/IR/LegacyPassManager.cpp:1441:40
#26 0x0000000003aa6944 llvm::FPPassManager::runOnModule(llvm::Module&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/IR/LegacyPassManager.cpp:1487:29
#27 0x0000000003aa6d04 (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/IR/LegacyPassManager.cpp:1556:38
#28 0x0000000003aa29b4 llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/IR/LegacyPassManager.cpp:541:55
#29 0x0000000003aa745c llvm::legacy::PassManager::run(llvm::Module&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/lib/IR/LegacyPassManager.cpp:1683:17
#30 0x000000000095678c compileModule(char**, llvm::LLVMContext&) /home/users/saldivar/workspace/llvm-project.git/main/llvm/tools/llc/llc.cpp:741:34
#31 0x0000000000954a2c main /home/users/saldivar/workspace/llvm-project.git/main/llvm/tools/llc/llc.cpp:408:35
#32 0x0000ffffae043fa0 __libc_start_main (/lib64/libc.so.6+0x23fa0)
#33 0x0000000000953978 _start /home/abuild/rpmbuild/BUILD/glibc-2.31/csu/../sysdeps/aarch64/start.S:95:0
fish: Job 1, '~/workspace/llvm-project.git/bu…' terminated by signal SIGABRT (Abort)
```
This is the commit that added the assertion:
```
7089c359a3845323f6f30c44a47dd901f2edfe63 is the first bad commit
commit 7089c359a3845323f6f30c44a47dd901f2edfe63
Author: Paul Walker <paul.walker@arm.com>
Date: Mon Apr 15 13:50:09 2024 +0100
[LLVM][SelectionDAG] Allow verification of target ISD nodes. (#88121)
Patch includes an initial implementation for AArch64 that covers a
handful of nodes where I've observed bogus nodes within the DAG.
llvm/include/llvm/CodeGen/TargetLowering.h | 5 +++
llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp | 6 ++--
llvm/lib/Target/AArch64/AArch64ISelLowering.cpp | 43 +++++++++++++++++++++++++
llvm/lib/Target/AArch64/AArch64ISelLowering.h | 4 +++
4 files changed, 56 insertions(+), 2 deletions(-)
```
The machine opcode that is coming in is `AArch64ISD::UZP1`, here is a bit more information from gdb:
```
(gdb) p (llvm::AArch64ISD::NodeType)N->getOpcode()
$7 = llvm::AArch64ISD::UZP1
(gdb) p N->getNumOperands()
$8 = 2
(gdb) p N->getNumValues()
$9 = 2
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzUWltznLgS_jXyS9dMCYnrgx-wx5P1KSdx2d6cqvMyJUDM6ATQFBK-7MP57ackYLj4mt1s7HU5Dgj0qb9Wq7uRmiklthXnx8g7Qd7qiDV6J-vja1Zk4pbV6Y7XR4nMHo5_E1qLagusAqYUrzXcCb0DvRMKLi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