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

Alex MacLean via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 21 11:40:12 PDT 2025


================
@@ -48,8 +48,8 @@ void NVPTXFrameLowering::emitPrologue(MachineFunction &MF,
     //   mov %SPL, %depot;
     //   cvta.local %SP, %SPL;
     // for local address accesses in MF.
-    bool Is64Bit =
-        static_cast<const NVPTXTargetMachine &>(MF.getTarget()).is64Bit();
+    bool Is64Bit = static_cast<const NVPTXTargetMachine &>(MF.getTarget())
+                       .getPointerSize(NVPTXAS::ADDRESS_SPACE_LOCAL) == 8;
----------------
AlexMaclean wrote:

This has the same problem as above, it assumes that the size of a local pointer will also be the size of a generic pointer. We need to check both these values and insert a `cvt.u64.u32` as needed. 

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


More information about the llvm-commits mailing list