[clang] [llvm] [NVPTX] Change the alloca address space in NVPTXLowerAlloca (PR #154814)

Alex MacLean via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 22 09:55:29 PDT 2025


================
@@ -1484,13 +1485,11 @@ void NVPTXAsmPrinter::setAndEmitFunctionVirtualRegisters(
   if (NumBytes) {
     O << "\t.local .align " << MFI.getMaxAlign().value() << " .b8 \t"
       << DEPOTNAME << getFunctionNumber() << "[" << NumBytes << "];\n";
-    if (static_cast<const NVPTXTargetMachine &>(MF.getTarget()).is64Bit()) {
-      O << "\t.reg .b64 \t%SP;\n"
-        << "\t.reg .b64 \t%SPL;\n";
-    } else {
-      O << "\t.reg .b32 \t%SP;\n"
-        << "\t.reg .b32 \t%SPL;\n";
-    }
+    if (static_cast<const NVPTXTargetMachine &>(MF.getTarget())
+            .getPointerSize(ADDRESS_SPACE_LOCAL) == 8)
+      O << "\t.reg .b64 \t%SPL;\n";
+    else
+      O << "\t.reg .b32 \t%SPL;\n";
----------------
AlexMaclean wrote:

Nit: lets just use getPointerSizeInBits and print that value directly. 

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


More information about the cfe-commits mailing list