[llvm] [NVPTX] Implement shouldBuildLookupTablesForConstant (PR #220088)
Antonio Frighetto via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 29 03:25:48 PDT 2026
================
@@ -636,6 +637,31 @@ void NVPTXTTIImpl::collectKernelLaunchBounds(
LB.push_back({"maxntidz", MaxNTID[2]});
}
+// A switch lookup table is materialized as an array with an initializer. PTX
+// only allows a variable's initial value to name a symbol in the .global or
+// .const state space; ptxas rejects anything else with "Variable used as
+// initial value not in .global or .const state space".
+bool NVPTXTTIImpl::shouldBuildLookupTablesForConstant(Constant *C) const {
+ SmallVector<Constant *, 8> WorkList = {C};
+ SmallPtrSet<Constant *, 8> Visited = {C};
----------------
antoniofrighetto wrote:
We could also update the doc-comment above to make this explicit. I understand the concern, but I think, in general, we should avoid introducing complexity unless needed, and I believe it shouldn't be the case here.
https://github.com/llvm/llvm-project/pull/220088
More information about the llvm-commits
mailing list