Skip to content

Commit 24a133e

Browse files
rickyzfhahn
authored andcommitted
[LV] Rename CountRoundDown to VectorTripCount (NFC)
The name CountRoundDown is potentially misleading, as the number of iterations can be rounded up when folding the tail. Reviewed By: fhahn Differential Revision: https://reviews.llvm.org/D119681
1 parent 982cbed commit 24a133e

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

+9-10
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ class InnerLoopVectorizer {
566566

567567
/// Set up the values of the IVs correctly when exiting the vector loop.
568568
void fixupIVUsers(PHINode *OrigPhi, const InductionDescriptor &II,
569-
Value *CountRoundDown, Value *EndValue,
569+
Value *VectorTripCount, Value *EndValue,
570570
BasicBlock *MiddleBlock, BasicBlock *VectorHeader);
571571

572572
/// Handle all cross-iteration phis in the header.
@@ -3153,10 +3153,10 @@ void InnerLoopVectorizer::createInductionResumeValues(
31533153
Type *StepType = II.getStep()->getType();
31543154
Instruction::CastOps CastOp =
31553155
CastInst::getCastOpcode(VectorTripCount, true, StepType, true);
3156-
Value *CRD = B.CreateCast(CastOp, VectorTripCount, StepType, "cast.crd");
3156+
Value *VTC = B.CreateCast(CastOp, VectorTripCount, StepType, "cast.vtc");
31573157
Value *Step =
31583158
CreateStepValue(II.getStep(), *PSE.getSE(), &*B.GetInsertPoint());
3159-
EndValue = emitTransformedIndex(B, CRD, II.getStartValue(), Step, II);
3159+
EndValue = emitTransformedIndex(B, VTC, II.getStartValue(), Step, II);
31603160
EndValue->setName("ind.end");
31613161

31623162
// Compute the end value for the additional bypass (if applicable).
@@ -3166,10 +3166,10 @@ void InnerLoopVectorizer::createInductionResumeValues(
31663166
StepType, true);
31673167
Value *Step =
31683168
CreateStepValue(II.getStep(), *PSE.getSE(), &*B.GetInsertPoint());
3169-
CRD =
3170-
B.CreateCast(CastOp, AdditionalBypass.second, StepType, "cast.crd");
3169+
VTC =
3170+
B.CreateCast(CastOp, AdditionalBypass.second, StepType, "cast.vtc");
31713171
EndValueFromAdditionalBypass =
3172-
emitTransformedIndex(B, CRD, II.getStartValue(), Step, II);
3172+
emitTransformedIndex(B, VTC, II.getStartValue(), Step, II);
31733173
EndValueFromAdditionalBypass->setName("ind.end");
31743174
}
31753175
}
@@ -3304,7 +3304,7 @@ InnerLoopVectorizer::createVectorizedLoopSkeleton() {
33043304
// value for the IV when arriving directly from the middle block.
33053305
void InnerLoopVectorizer::fixupIVUsers(PHINode *OrigPhi,
33063306
const InductionDescriptor &II,
3307-
Value *CountRoundDown, Value *EndValue,
3307+
Value *VectorTripCount, Value *EndValue,
33083308
BasicBlock *MiddleBlock,
33093309
BasicBlock *VectorHeader) {
33103310
// There are two kinds of external IV usages - those that use the value
@@ -3342,7 +3342,7 @@ void InnerLoopVectorizer::fixupIVUsers(PHINode *OrigPhi,
33423342
B.setFastMathFlags(II.getInductionBinOp()->getFastMathFlags());
33433343

33443344
Value *CountMinusOne = B.CreateSub(
3345-
CountRoundDown, ConstantInt::get(CountRoundDown->getType(), 1));
3345+
VectorTripCount, ConstantInt::get(VectorTripCount->getType(), 1));
33463346
Value *CMO =
33473347
!II.getStep()->getType()->isIntegerTy()
33483348
? B.CreateCast(Instruction::SIToFP, CountMinusOne,
@@ -7759,8 +7759,7 @@ EpilogueVectorizerMainLoop::createEpilogueVectorizedLoopSkeleton() {
77597759
emitMinimumIterationCountCheck(LoopScalarPreHeader, false);
77607760

77617761
// Generate the induction variable.
7762-
Value *CountRoundDown = getOrCreateVectorTripCount(LoopVectorPreHeader);
7763-
EPI.VectorTripCount = CountRoundDown;
7762+
EPI.VectorTripCount = getOrCreateVectorTripCount(LoopVectorPreHeader);
77647763

77657764
// Skip induction resume value creation here because they will be created in
77667765
// the second pass. If we created them here, they wouldn't be used anyway,

0 commit comments

Comments
 (0)