Index: lib/Target/AArch64/AArch64TargetTransformInfo.cpp =================================================================== --- lib/Target/AArch64/AArch64TargetTransformInfo.cpp +++ lib/Target/AArch64/AArch64TargetTransformInfo.cpp @@ -490,6 +490,10 @@ // Disable partial & runtime unrolling on -Os. UP.PartialOptSizeThreshold = 0; + + // the benefits of unrolling often outweigh the cost of a division to compute + // the trip count. + UP.AllowExpensiveTripCount = true; } Value *AArch64TTIImpl::getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst,