Skip to content

Commit bab7209

Browse files
committed
format
1 parent aa2e68b commit bab7209

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

llvm/lib/Transforms/Scalar/SROA.cpp

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5194,8 +5194,10 @@ AllocaInst *SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS,
51945194
const DataLayout &DL = AI.getDataLayout();
51955195
auto ComputePartitionTy = [&]() -> std::tuple<Type *, bool, VectorType *> {
51965196
// First check if the partition is viable for vetor promotion. If it is
5197-
// via a floating-point vector, we are done because we would never prefer integer widening.
5198-
VectorType *VecTy = isVectorPromotionViable(P, DL, AI.getFunction()->getVScaleValue());
5197+
// via a floating-point vector, we are done because we would never prefer
5198+
// integer widening.
5199+
VectorType *VecTy =
5200+
isVectorPromotionViable(P, DL, AI.getFunction()->getVScaleValue());
51995201
if (VecTy) {
52005202
if (VecTy->getElementType()->isFloatingPointTy()) {
52015203
return {VecTy, false, VecTy};
@@ -5213,26 +5215,34 @@ AllocaInst *SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS,
52135215

52145216
if (VecTy)
52155217
return {VecTy, false, VecTy};
5216-
return {CommonUseTy.first, isIntegerWideningViable(P, CommonUseTy.first, DL), nullptr};
5218+
return {CommonUseTy.first,
5219+
isIntegerWideningViable(P, CommonUseTy.first, DL), nullptr};
52175220
}
52185221
}
52195222

5220-
// If not, can we find an appropriate subtype in the original allocated type?
5221-
if (Type *TypePartitionTy = getTypePartition(DL, AI.getAllocatedType(), P.beginOffset(), P.size())) {
5222-
if (TypePartitionTy->isArrayTy() && TypePartitionTy->getArrayElementType()->isIntegerTy() && DL.isLegalInteger(P.size() * 8))
5223+
// If not, can we find an appropriate subtype in the original allocated
5224+
// type?
5225+
if (Type *TypePartitionTy = getTypePartition(DL, AI.getAllocatedType(),
5226+
P.beginOffset(), P.size())) {
5227+
if (TypePartitionTy->isArrayTy() &&
5228+
TypePartitionTy->getArrayElementType()->isIntegerTy() &&
5229+
DL.isLegalInteger(P.size() * 8))
52235230
TypePartitionTy = Type::getIntNTy(*C, P.size() * 8);
5224-
5231+
52255232
if (isIntegerWideningViable(P, TypePartitionTy, DL))
52265233
return {TypePartitionTy, true, nullptr};
52275234
if (VecTy)
52285235
return {VecTy, false, VecTy};
5229-
if (CommonUseTy.second && DL.getTypeAllocSize(CommonUseTy.second).getFixedValue() >= P.size() && isIntegerWideningViable(P, CommonUseTy.second, DL))
5236+
if (CommonUseTy.second &&
5237+
DL.getTypeAllocSize(CommonUseTy.second).getFixedValue() >= P.size() &&
5238+
isIntegerWideningViable(P, CommonUseTy.second, DL))
52305239
return {CommonUseTy.second, true, nullptr};
52315240
return {TypePartitionTy, false, nullptr};
52325241
}
52335242

52345243
// If still not, can we use the largest bitwidth integer type used?
5235-
if (CommonUseTy.second && DL.getTypeAllocSize(CommonUseTy.second).getFixedValue() >= P.size())
5244+
if (CommonUseTy.second &&
5245+
DL.getTypeAllocSize(CommonUseTy.second).getFixedValue() >= P.size())
52365246
return {CommonUseTy.second, false, nullptr};
52375247

52385248
if (DL.isLegalInteger(P.size() * 8))

0 commit comments

Comments
 (0)