[llvm] [SPIR-V] Add InferAddrSpaces pass to the backend (PR #137766)

Nathan Gauër via llvm-commits llvm-commits at lists.llvm.org
Tue May 6 07:11:56 PDT 2025


================
@@ -190,6 +191,14 @@ void SPIRVPassConfig::addIRPasses() {
   TargetPassConfig::addIRPasses();
 
   if (TM.getSubtargetImpl()->isVulkanEnv()) {
+    // The frontend has a tendency to quickly addrspacecast pointers to the
+    // default address space, and relies on addrspacecast instructions at the
+    // boundaries. Vulkan does not allow such things, and we must keep the
+    // pointer address space stable.
+    // This pass will determine real address space of a pointer, and patch
+    // instructions removing Addrspacecasts.
+    addPass(createInferAddressSpacesPass(/* AddressSpace= */ 0));
----------------
Keenuts wrote:

I'll mark this as solved 😊
(Replied to your email btw)

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


More information about the llvm-commits mailing list