[llvm] [SPIRV] Support -fembed-bitcode=marker for non-shader modules (PR #162082)

Marcos Maronas via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 6 09:14:51 PDT 2025


Juan Manuel Martinez =?utf-8?q?CaamaƱo?= <juamarti at amd.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/162082 at github.com>


================
@@ -3007,9 +3009,43 @@ void SPIRVEmitIntrinsics::parseFunDeclarations(Module &M) {
   }
 }
 
+bool SPIRVEmitIntrinsics::promoteEmbddedBitcodeMarker(Module &M) const {
+  const SPIRVSubtarget *STI = TM->getSubtargetImpl();
+  if (STI->isShader())
+    return false;
+
+  GlobalVariable *EmbeddedBitcode = M.getNamedGlobal("llvm.embedded.module");
+  if (!EmbeddedBitcode)
+    return false;
+
+  ArrayType *AT = cast<ArrayType>(EmbeddedBitcode->getValueType());
+  if (AT->getNumElements() != 0)
----------------
maarquitos14 wrote:

Is there any chance it can be different than  0? According to the comment a few lines after, it seems like it's always a [0 x i8] array, so it should always be 0. Should we have an assert instead?

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


More information about the llvm-commits mailing list