[llvm] [NVPTX][InferAS] assume alloca instructions are in local AS (PR #121710)
Alex MacLean via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 14 07:19:53 PST 2025
================
@@ -562,4 +563,11 @@ Value *NVPTXTTIImpl::rewriteIntrinsicWithAddressSpace(IntrinsicInst *II,
}
}
return nullptr;
-}
\ No newline at end of file
+}
+
+unsigned NVPTXTTIImpl::getAssumedAddrSpace(const Value *V) const {
+ if (isa<AllocaInst>(V))
+ return ADDRESS_SPACE_LOCAL;
+
----------------
AlexMaclean wrote:
While I tend to agree that converting all allocas to local addrspace would be a good idea, it's also a deep can of worms. As @Artem-B points out here https://github.com/llvm/llvm-project/pull/106127#discussion_r1742460454, optimizations may not handle allocas in specific AS as well, and supporting local allocas would likely require changes in the backend and datalayout.
I do hope to pursue this in the future, but in the meantime this change is both simple and correct. Even if we were to address the above it still seems preferable to handle generic allocas here in case InferAS happens to encounter one in the IR.
https://github.com/llvm/llvm-project/pull/121710
More information about the llvm-commits
mailing list