[llvm] [NVPTX] Check Before inserting AddrSpaceCastInst in NVPTXLoweringAlloca (PR #106127)

Artem Belevich via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 3 10:57:12 PDT 2024


================
@@ -17,7 +17,21 @@ define void @kernel() {
   ret void
 }
 
+define void @alloc_already_in_addrspace5() {
+; LABEL: @lower_alloca_addrspace5
+; PTX-LABEL: .visible .func alloc_already_in_addrspace5(
+  %A = alloca i32, addrspace(5)
----------------
Artem-B wrote:

Things in non-generic AS tends to get in the way of optimizations, so doing it up-front will likely result in worse code. Perhaps one day everything will handle non-default AS as well as generic AS, but I don't think we're there yet.

So, for now, I do not see any benefit of allocas in explicit AS -- we can easily infer the AS if/when we need to, and our priority is to eliminate as many of allocas as we can as they are a major bad news for performance, so not getting in the way of LLVM optimizations is more important.

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


More information about the llvm-commits mailing list