@@ -5235,12 +5235,6 @@ AllocaInst *SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS,
52355235 }
52365236 }
52375237
5238- // If there are only intrinsic users, try to represent as a legal integer
5239- // type because we are probably just copying data around and the integer can
5240- // be promoted.
5241- if (OnlyIntrinsicUsers && DL.isLegalInteger (P.size () * 8 ))
5242- return {Type::getIntNTy (*C, P.size () * 8 ), false , nullptr };
5243-
52445238 // Can we find an appropriate subtype in the original allocated
52455239 // type?
52465240 if (Type *TypePartitionTy = getTypePartition (DL, AI.getAllocatedType (),
@@ -5263,6 +5257,13 @@ AllocaInst *SROA::rewritePartition(AllocaInst &AI, AllocaSlices &AS,
52635257 DL.getTypeAllocSize (LargestIntTy).getFixedValue () >= P.size () &&
52645258 isIntegerWideningViable (P, LargestIntTy, DL))
52655259 return {LargestIntTy, true , nullptr };
5260+
5261+ // If there are only intrinsic users, try to represent as a legal integer
5262+ // type because we are probably just copying data around and the integer can
5263+ // be promoted.
5264+ if (OnlyIntrinsicUsers && DL.isLegalInteger (P.size () * 8 ))
5265+ return {Type::getIntNTy (*C, P.size () * 8 ), isIntegerWideningViable (P, Type::getIntNTy (*C, P.size () * 8 ), DL), nullptr };
5266+
52665267 // Fallback to TypePartitionTy and we probably won't promote.
52675268 return {TypePartitionTy, false , nullptr };
52685269 }
0 commit comments