[llvm] [SPIRV] Add assertion to simplify debugging (PR #152139)

Marcos Maronas via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 5 06:49:57 PDT 2025


https://github.com/maarquitos14 created https://github.com/llvm/llvm-project/pull/152139

None

>From b6c4ec7308cc2ad28a6a8bf970e3d6309431049a Mon Sep 17 00:00:00 2001
From: Marcos Maronas <marcos.maronas at intel.com>
Date: Tue, 5 Aug 2025 15:48:10 +0200
Subject: [PATCH] Add assertion to simplify debugging

---
 llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
index 960eb2ef93a9e..f1436d5b3c047 100644
--- a/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
+++ b/llvm/lib/Target/SPIRV/SPIRVGlobalRegistry.cpp
@@ -840,6 +840,8 @@ SPIRVType *SPIRVGlobalRegistry::getOpTypeArray(uint32_t NumElems,
           .addUse(NumElementsVReg);
     });
   } else {
+    assert(ST.isShader() && "Runtime arrays are not allowed in non-shader "
+                            "SPIR-V modules.");
     if (!ST.isShader())
       return nullptr;
     ArrayType = createOpType(MIRBuilder, [&](MachineIRBuilder &MIRBuilder) {



More information about the llvm-commits mailing list