@@ -5203,44 +5203,48 @@ AllocaInst *SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS,
52035203 // First check if the partition is viable for vetor promotion.
52045204 // We prefer vector promotion over integer widening promotion when:
52055205 // - The vector element type is a floating-point type.
5206- // - All the loads/stores to the alloca are vector loads/stores to the entire alloca.
5207- // Otherwise when there is a integer vector with mixed loads/stores we prefer integer widening
5208- // promotion because it's more likely the user is doing bitwise arithmetic and we
5209- // generate better code.
5206+ // - All the loads/stores to the alloca are vector loads/stores to the
5207+ // entire alloca. Otherwise when there is a integer vector with mixed
5208+ // loads/stores we prefer integer widening promotion because it's more
5209+ // likely the user is doing bitwise arithmetic and we generate better code.
52105210 VectorType *VecTy =
52115211 isVectorPromotionViable (P, DL, AI.getFunction ()->getVScaleValue ());
5212- // If the vector element type is a floating-point type, we prefer vector promotion.
5212+ // If the vector element type is a floating-point type, we prefer vector
5213+ // promotion.
52135214 if (VecTy && VecTy->getElementType ()->isFloatingPointTy ())
52145215 return {VecTy, false , VecTy};
52155216
5216- // Check if there is a common type that all slices of the partition use that spans the partition.
5217+ // Check if there is a common type that all slices of the partition use that
5218+ // spans the partition.
52175219 auto [CommonUseTy, LargestIntTy, OnlyIntrinsicUsers] =
52185220 findCommonType (P.begin (), P.end (), P.endOffset ());
52195221 if (CommonUseTy) {
52205222 TypeSize CommonUseSize = DL.getTypeAllocSize (CommonUseTy);
52215223 if (CommonUseSize.isFixed () &&
52225224 CommonUseSize.getFixedValue () >= P.size ()) {
5223- // We prefer vector promotion here because if vector promotion is viable and
5224- // there is a common type used, then it implies the second listed condition for prefering
5225- // vector promotion is true.
5225+ // We prefer vector promotion here because if vector promotion is viable
5226+ // and there is a common type used, then it implies the second listed
5227+ // condition for prefering vector promotion is true.
52265228 if (VecTy)
52275229 return {VecTy, false , VecTy};
52285230 return {CommonUseTy, isIntegerWideningViable (P, CommonUseTy, DL),
52295231 nullptr };
52305232 }
52315233 }
52325234
5233- // If there are only intrinsic users, try to represent as a legal integer type
5234- // because we are probably just copying data around and the integer can be promoted.
5235+ // If there are only intrinsic users, try to represent as a legal integer
5236+ // type because we are probably just copying data around and the integer can
5237+ // be promoted.
52355238 if (OnlyIntrinsicUsers && DL.isLegalInteger (P.size () * 8 ))
52365239 return {Type::getIntNTy (*C, P.size () * 8 ), false , nullptr };
52375240
52385241 // Can we find an appropriate subtype in the original allocated
52395242 // type?
52405243 if (Type *TypePartitionTy = getTypePartition (DL, AI.getAllocatedType (),
52415244 P.beginOffset (), P.size ())) {
5242- // If the partition is an integer array that can be spanned by a legal integer type,
5243- // prefer to represent it as a legal integer type because it's more likely to be promotable.
5245+ // If the partition is an integer array that can be spanned by a legal
5246+ // integer type, prefer to represent it as a legal integer type because
5247+ // it's more likely to be promotable.
52445248 if (TypePartitionTy->isArrayTy () &&
52455249 TypePartitionTy->getArrayElementType ()->isIntegerTy () &&
52465250 DL.isLegalInteger (P.size () * 8 ))
@@ -5250,7 +5254,8 @@ AllocaInst *SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS,
52505254 return {TypePartitionTy, true , nullptr };
52515255 if (VecTy)
52525256 return {VecTy, false , VecTy};
5253- // If we couldn't promotion with TypePartitionTy, try with the largest integer type used.
5257+ // If we couldn't promotion with TypePartitionTy, try with the largest
5258+ // integer type used.
52545259 if (LargestIntTy &&
52555260 DL.getTypeAllocSize (LargestIntTy).getFixedValue () >= P.size () &&
52565261 isIntegerWideningViable (P, LargestIntTy, DL))
0 commit comments