[llvm] [AMDGPU] Handle lowering addrspace casts from LDS to FLAT address in amdgpu-sw-lower-lds. (PR #121214)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 22:00:44 PST 2025


================
@@ -668,22 +668,18 @@ Value *AMDGPUSwLowerLDS::getTranslatedGlobalMemoryPtrOfLDS(Value *LoadMallocPtr,
                                                            Value *LDSPtr) {
   assert(LDSPtr && "Invalid LDS pointer operand");
   Type *LDSPtrType = LDSPtr->getType();
-
-  if (LDSPtrType->isVectorTy()) {
+  auto &Ctx = M.getContext();
+  const auto &DL = M.getDataLayout();
+  auto *IntPtrTy = DL.getIntPtrType(Ctx, AMDGPUAS::LOCAL_ADDRESS);
----------------
arsenm wrote:

```suggestion
  LLVMContext &Ctx = M.getContext();
  const DataLayout &DL = M.getDataLayout();
  Type *IntPtrTy = DL.getIntPtrType(Ctx, AMDGPUAS::LOCAL_ADDRESS);
```

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


More information about the llvm-commits mailing list