Skip to content

Commit 1cb9bb3

Browse files
committed
Missed a few bits of reviwe feedback
1 parent 04e8c43 commit 1cb9bb3

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

llvm/lib/Target/AMDGPU/AMDGPULowerBufferFatPointers.cpp

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1035,16 +1035,16 @@ std::pair<bool, bool> LegalizeBufferContentTypesVisitor::visitStoreImpl(
10351035
}
10361036
if (auto *AT = dyn_cast<ArrayType>(PartType)) {
10371037
Type *ElemTy = AT->getElementType();
1038-
TypeSize AllocSize = DL.getTypeAllocSize(ElemTy);
1039-
if (!ElemTy->isSingleValueType() ||
1040-
DL.getTypeSizeInBits(ElemTy) != 8 * AllocSize || ElemTy->isVectorTy()) {
1038+
if (!ElemTy->isSingleValueType() || !DL.typeSizeEqualsStoreSize(ElemTy) ||
1039+
ElemTy->isVectorTy()) {
1040+
TypeSize ElemStoreSize = DL.getTypeStoreSize(ElemTy);
10411041
bool Changed = false;
10421042
for (auto I : llvm::iota_range<uint32_t>(0, AT->getNumElements(),
10431043
/*Inclusive=*/false)) {
10441044
AggIdxs.push_back(I);
10451045
Changed |= std::get<0>(visitStoreImpl(
1046-
OrigSI, ElemTy, AggIdxs, AggByteOff + I * AllocSize.getFixedValue(),
1047-
Name + Twine(I)));
1046+
OrigSI, ElemTy, AggIdxs,
1047+
AggByteOff + I * ElemStoreSize.getFixedValue(), Name + Twine(I)));
10481048
AggIdxs.pop_back();
10491049
}
10501050
return std::make_pair(Changed, /*ModifiedInPlace=*/false);
@@ -1081,9 +1081,7 @@ std::pair<bool, bool> LegalizeBufferContentTypesVisitor::visitStoreImpl(
10811081
}
10821082

10831083
Value *OrigPtr = OrigSI.getPointerOperand();
1084-
Type *ElemType = LegalType;
1085-
if (auto *VT = dyn_cast<FixedVectorType>(LegalType))
1086-
ElemType = VT->getElementType();
1084+
Type *ElemType = LegalType->getScalarType();
10871085
if (IsAggPart && Slices.empty())
10881086
Slices.emplace_back(/*Index=*/0, /*Length=*/1);
10891087
unsigned ElemBytes = DL.getTypeStoreSize(ElemType);

0 commit comments

Comments
 (0)