[llvm] [WIP][Don't merge] New test for untested SPIRV backend case (PR #185686)

via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 11 02:51:28 PDT 2026


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-backend-spir-v

Author: None (ambergorzynski)

<details>
<summary>Changes</summary>

[This line](https://github.com/ambergorzynski/llvm-project/blob/main/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp#L2362) in the SPIRV backend is uncovered by the existing test suite (checked using coverage, and by asserting that no tests in the existing test suite fails if we insert an abort() at this line).

We propose a test that covers this line. We demonstrate the test by inserting an abort() at that line in commit [#e37e88e](https://github.com/llvm/llvm-project/commit/e37e88e2500bd695d9635322af487c0c40ba3b8a). Running all tests shows that only our proposed test fails in the presence of the abort. We've removed the abort ahead of merging.

This is the only test that fails in the presence of the abort (which includes our new test):

> # 🐧 Linux x64 Test Results
> * 171023 tests passed
> * 3024 tests skipped
> * 1 test failed
> 
> ## Failed Tests
> (click on a test name to see its output)
> 
> ### LLVM
> LLVM.CodeGen/SPIRV/instructions/icmp.ll
> ```
> Exit Code: 2
> 
> Command Output (stdout):
> --
> # RUN: at line 1
> /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/instructions/icmp.ll -o - | /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/instructions/icmp.ll
> # executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/instructions/icmp.ll -o -
> # .---command stderr------------
> # | 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: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc -verify-machineinstrs -O0 -mtriple=spirv32-unknown-unknown /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/instructions/icmp.ll -o -
> # | 1.	Running pass 'Function Pass Manager' on module '/home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/instructions/icmp.ll'.
> # | 2.	Running pass 'InstructionSelect' on function '@<!-- -->test_v16_ne'
> # |  #<!-- -->0 0x000000000853cfc8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:880:13
> # |  #<!-- -->1 0x0000000008539f31 llvm::sys::RunSignalHandlers() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Signals.cpp:109:18
> # |  #<!-- -->2 0x000000000853dde1 SignalHandler(int, siginfo_t*, void*) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Support/Unix/Signals.inc:448:38
> # |  #<!-- -->3 0x00007f3755be2330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
> # |  #<!-- -->4 0x00007f3755c3bb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
> # |  #<!-- -->5 0x00007f3755be227e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
> # |  #<!-- -->6 0x00007f3755bc58ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
> # |  #<!-- -->7 0x00000000063c3f05 getICmpOpcode /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp:2327:3
> # |  #<!-- -->8 0x00000000063c3f05 (anonymous namespace)::SPIRVInstructionSelector::selectICmp(llvm::Register, llvm::SPIRVTypeInst, llvm::MachineInstr&) const /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp:3281:14
> # |  #<!-- -->9 0x00000000063b0bd2 (anonymous namespace)::SPIRVInstructionSelector::spvSelect(llvm::Register, llvm::SPIRVTypeInst, llvm::MachineInstr&) const /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp:1295:5
> # | #<!-- -->10 0x00000000063af4ce (anonymous namespace)::SPIRVInstructionSelector::select(llvm::MachineInstr&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/Target/SPIRV/SPIRVInstructionSelector.cpp:861:7
> # | #<!-- -->11 0x0000000008c85377 llvm::InstructionSelect::selectMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp:0:0
> # | #<!-- -->12 0x0000000008c84bfe operator() /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp:143:53
> # | #<!-- -->13 0x0000000008c84bfe ~scope_exit /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/include/llvm/ADT/ScopeExit.h:43:7
> # | #<!-- -->14 0x0000000008c84bfe llvm::InstructionSelect::runOnMachineFunction(llvm::MachineFunction&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/GlobalISel/InstructionSelect.cpp:155:1
> # | #<!-- -->15 0x00000000071fa2a3 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/CodeGen/MachineFunctionPass.cpp:0:10
> # | #<!-- -->16 0x0000000007768e38 llvm::FPPassManager::runOnFunction(llvm::Function&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:0:27
> # | #<!-- -->17 0x00000000077708e2 llvm::FPPassManager::runOnModule(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1444:13
> # | #<!-- -->18 0x00000000077698ab runOnModule /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:1513:27
> # | #<!-- -->19 0x00000000077698ab llvm::legacy::PassManagerImpl::run(llvm::Module&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/lib/IR/LegacyPassManager.cpp:531:44
> # | #<!-- -->20 0x0000000004f51e7c compileModule(char**, llvm::SmallVectorImpl<llvm::PassPlugin>&, llvm::LLVMContext&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&) /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:871:17
> # | #<!-- -->21 0x0000000004f4f143 main /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/tools/llc/llc.cpp:459:13
> # | #<!-- -->22 0x00007f3755bc71ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
> # | #<!-- -->23 0x00007f3755bc728b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
> # | #<!-- -->24 0x0000000004f4ac65 _start (/home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/llc+0x4f4ac65)
> # `-----------------------------
> # error: command failed with exit status: -6
> # executed command: /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/instructions/icmp.ll
> # .---command stderr------------
> # | FileCheck error: '<stdin>' is empty.
> # | FileCheck command line:  /home/gha/actions-runner/_work/llvm-project/llvm-project/build/bin/FileCheck /home/gha/actions-runner/_work/llvm-project/llvm-project/llvm/test/CodeGen/SPIRV/instructions/icmp.ll
> # `-----------------------------
> # error: command failed with exit status: 2
> 
> --
> ```

---
Full diff: https://github.com/llvm/llvm-project/pull/185686.diff


1 Files Affected:

- (modified) llvm/test/CodeGen/SPIRV/instructions/icmp.ll (+12) 


``````````diff
diff --git a/llvm/test/CodeGen/SPIRV/instructions/icmp.ll b/llvm/test/CodeGen/SPIRV/instructions/icmp.ll
index bbf947f84c09a..157f1064dc07f 100644
--- a/llvm/test/CodeGen/SPIRV/instructions/icmp.ll
+++ b/llvm/test/CodeGen/SPIRV/instructions/icmp.ll
@@ -21,6 +21,7 @@
 ; CHECK-DAG: OpName [[v3SGT:%.*]] "test_v3_sgt"
 ; CHECK-DAG: OpName [[v3UGE:%.*]] "test_v3_uge"
 ; CHECK-DAG: OpName [[v3SGE:%.*]] "test_v3_sge"
+; CHECK-DAG: OpName [[v16NE:%.*]] "test_v16_ne"
 
 ; CHECK:      [[EQ]] = OpFunction
 ; CHECK-NEXT: [[A:%.*]] = OpFunctionParameter
@@ -261,3 +262,14 @@ define <3 x i1> @test_v3_sge(<3 x i32> %a, <3 x i32> %b) {
   %r = icmp sge <3 x i32> %a, %b
   ret <3 x i1> %r
 }
+
+; CHECK:      [[v16NE]] = OpFunction
+; CHECK-NEXT: OpLabel
+; CHECK-NEXT: [[R:%.*]] = OpLogicalNotEqual {{%.+}} {{%.*}} {{%.*}}
+; CHECK-NEXT: OpReturnValue [[R]]
+; CHECK-NEXT: OpFunctionEnd
+
+define spir_func <16 x i1> @test_v16_ne() addrspace(4) {
+  %A = icmp ne <16 x i1> zeroinitializer, zeroinitializer
+  ret <16 x i1> %A
+}

``````````

</details>


https://github.com/llvm/llvm-project/pull/185686


More information about the llvm-commits mailing list