Skip to content

Commit e190397

Browse files
committed
!fixup addres comments, thanks
1 parent f9c873f commit e190397

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

llvm/lib/Transforms/Vectorize/LoopVectorize.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,6 @@ class InnerLoopVectorizer {
599599
/// vector elements.
600600
ElementCount VF;
601601

602-
public:
603602
ElementCount MinProfitableTripCount;
604603

605604
/// The vectorization unroll factor to use. Each scalar is vectorized to this

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3283,8 +3283,10 @@ void VPlanTransforms::materializeVectorTripCount(VPlan &Plan,
32833283
bool TailByMasking,
32843284
bool RequiresScalarEpilogue) {
32853285
VPValue &VectorTC = Plan.getVectorTripCount();
3286-
if (VectorTC.getNumUsers() == 0 ||
3287-
(VectorTC.isLiveIn() && VectorTC.getLiveInIRValue()))
3286+
assert(VectorTC.isLiveIn() && "vector-trip-count must be a live-in");
3287+
// There's nothing to do if there are no users of the vector trip count or its
3288+
// IR value has already been set.
3289+
if (VectorTC.getNumUsers() == 0 || VectorTC.getLiveInIRValue())
32883290
return;
32893291
VPValue *TC = Plan.getTripCount();
32903292
Type *TCTy = VPTypeAnalysis(Plan).inferScalarType(TC);
@@ -3306,16 +3308,17 @@ void VPlanTransforms::materializeVectorTripCount(VPlan &Plan,
33063308
{TC, Builder.createNaryOp(
33073309
Instruction::Sub,
33083310
{Step, Plan.getOrAddLiveIn(ConstantInt::get(TCTy, 1))})},
3309-
DebugLoc::getUnknown(), "n.rnd.up");
3311+
DebugLoc::getCompilerGenerated(), "n.rnd.up");
33103312
}
33113313

33123314
// Now we need to generate the expression for the part of the loop that the
33133315
// vectorized body will execute. This is equal to N - (N % Step) if scalar
33143316
// iterations are not required for correctness, or N - Step, otherwise. Step
33153317
// is equal to the vectorization factor (number of SIMD elements) times the
33163318
// unroll factor (number of SIMD instructions).
3317-
VPValue *R = Builder.createNaryOp(Instruction::URem, {TC, Step},
3318-
DebugLoc::getUnknown(), "n.mod.vf");
3319+
VPValue *R =
3320+
Builder.createNaryOp(Instruction::URem, {TC, Step},
3321+
DebugLoc::getCompilerGenerated(), "n.mod.vf");
33193322

33203323
// There are cases where we *must* run at least one iteration in the remainder
33213324
// loop. See the cost model for when this can happen. If the step evenly
@@ -3330,7 +3333,7 @@ void VPlanTransforms::materializeVectorTripCount(VPlan &Plan,
33303333
}
33313334

33323335
auto Res = Builder.createNaryOp(Instruction::Sub, {TC, R},
3333-
DebugLoc::getUnknown(), "n.vec");
3336+
DebugLoc::getCompilerGenerated(), "n.vec");
33343337
Plan.getVectorTripCount().replaceAllUsesWith(Res);
33353338
}
33363339

0 commit comments

Comments
 (0)