[llvm] [SPIRV] Add support for non-interposable function aliases (PR #172730)

Manuel Carrasco via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 22 02:42:17 PST 2025


================
@@ -77,12 +80,53 @@ bool tryExtendDynamicLDSGlobal(GlobalVariable &GV) {
   return true;
 }
 
+// The backend does not support GlobalAlias. Replace aliases with their aliasees
+// when possible and remove them from the module.
+bool tryReplaceAliasWithAliasee(GlobalAlias &GA) {
+  // According to the lang ref, aliases cannot be replaced if either the alias
+  // or the aliasee are interposable. We only replace in the case that both
+  // are not interposable.
+  if (GA.isInterposable()) {
+    LLVM_DEBUG(dbgs() << "Skipping interposable alias: " << GA.getName()
+                      << "\n");
+    return false;
+  }
+
+  auto *AO = dyn_cast<GlobalObject>(GA.getAliasee());
----------------
mgcarrasco wrote:

Ty. Added a test case for an alias to a gep (unsupported), and another one for a regular global variable (supported). 

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


More information about the llvm-commits mailing list