[llvm] [SPIR-V] Add NonSemantic.AuxData emission (-spirv-preserve-auxdata) and preserve available_externally linkage (PR #200002)

Dmitry Sidorov via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 2 04:13:15 PDT 2026


================
@@ -1217,6 +1217,11 @@ getSpirvLinkageTypeFor(const SPIRVSubtarget &ST, const GlobalValue &GV) {
   if (GV.hasLocalLinkage())
     return std::nullopt;
 
+  // Preserved via NonSemantic.AuxData; skip LinkageAttributes.
+  if (const auto *F = dyn_cast<Function>(&GV))
+    if (F->hasFnAttribute(SPIRV_WAS_AVAILABLE_EXTERNALLY_ATTR))
+      return std::nullopt;
+
----------------
MrSidims wrote:

I would let it through with export linkage regardless if the extension is enabled or not. The only difference should be that when the `flag` (not even extension!) is turned on - then the `AuxData` instruction must be generated.

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


More information about the llvm-commits mailing list