Skip to content

Commit ba2fb92

Browse files
committed
[AMDGPU] Changes as per review:2
1 parent 27e41c2 commit ba2fb92

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/lib/Target/AMDGPU/AMDGPUSwLowerLDS.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -668,19 +668,16 @@ Value *AMDGPUSwLowerLDS::getTranslatedGlobalMemoryPtrOfLDS(Value *LoadMallocPtr,
668668
Value *LDSPtr) {
669669
assert(LDSPtr && "Invalid LDS pointer operand");
670670
Type *LDSPtrType = LDSPtr->getType();
671-
auto &Ctx = M.getContext();
672-
const auto &DL = M.getDataLayout();
673-
auto *IntPtrTy = DL.getIntPtrType(Ctx, AMDGPUAS::LOCAL_ADDRESS);
671+
LLVMContext &Ctx = M.getContext();
672+
const DataLayout &DL = M.getDataLayout();
673+
Type *IntTy = DL.getIntPtrType(Ctx, AMDGPUAS::LOCAL_ADDRESS);
674674
if (auto *VecPtrTy = dyn_cast<VectorType>(LDSPtrType)) {
675675
// Handle vector of pointers
676676
ElementCount NumElements = VecPtrTy->getElementCount();
677-
Type *IntVecTy = VectorType::get(IntPtrTy, NumElements);
678-
Value *PtrToInt = IRB.CreatePtrToInt(LDSPtr, IntVecTy);
679-
// Create vector of pointers to global address space
680-
return IRB.CreateInBoundsGEP(IRB.getInt8Ty(), LoadMallocPtr, PtrToInt);
677+
IntTy = VectorType::get(IntTy, NumElements);
681678
}
682-
Value *PtrToInt = IRB.CreatePtrToInt(LDSPtr, IntPtrTy);
683-
return IRB.CreateInBoundsGEP(IRB.getInt8Ty(), LoadMallocPtr, {PtrToInt});
679+
Value *GepIndex = IRB.CreatePtrToInt(LDSPtr, IntTy);
680+
return IRB.CreateInBoundsGEP(IRB.getInt8Ty(), LoadMallocPtr, {GepIndex});
684681
}
685682

686683
void AMDGPUSwLowerLDS::translateLDSMemoryOperationsToGlobalMemory(

0 commit comments

Comments
 (0)