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

Juan Manuel Martinez CaamaƱo via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 7 01:14:02 PDT 2025


================
@@ -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)
----------------
jmmartinez wrote:

It could happen if `-fembed-bitcode=all` was used. In that case the global contains the module as serialized llvm-ir just before the backend passes kick in.

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


More information about the llvm-commits mailing list