Skip to content

Commit 3ced2d8

Browse files
committed
!fixup address comments, thanks
1 parent 96b818a commit 3ced2d8

File tree

3 files changed

+95
-109
lines changed

3 files changed

+95
-109
lines changed

llvm/lib/Transforms/Vectorize/VPlanTransforms.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3288,10 +3288,10 @@ void VPlanTransforms::materializeVectorTripCount(VPlan &Plan,
32883288
// IR value has already been set.
32893289
if (VectorTC.getNumUsers() == 0 || VectorTC.getLiveInIRValue())
32903290
return;
3291+
32913292
VPValue *TC = Plan.getTripCount();
32923293
Type *TCTy = VPTypeAnalysis(Plan).inferScalarType(TC);
32933294
VPBuilder Builder(VectorPHVPBB, VectorPHVPBB->begin());
3294-
32953295
VPValue *Step = &Plan.getVFxUF();
32963296

32973297
// If the tail is to be folded by masking, round the number of iterations N
@@ -3327,14 +3327,14 @@ void VPlanTransforms::materializeVectorTripCount(VPlan &Plan,
33273327
// since there will already be scalar iterations. Note that the minimum
33283328
// iterations check ensures that N >= Step.
33293329
if (RequiresScalarEpilogue) {
3330-
auto *IsZero = Builder.createICmp(
3330+
VPValue *IsZero = Builder.createICmp(
33313331
CmpInst::ICMP_EQ, R, Plan.getOrAddLiveIn(ConstantInt::get(TCTy, 0)));
33323332
R = Builder.createSelect(IsZero, Step, R);
33333333
}
33343334

3335-
auto Res = Builder.createNaryOp(Instruction::Sub, {TC, R},
3336-
DebugLoc::getCompilerGenerated(), "n.vec");
3337-
Plan.getVectorTripCount().replaceAllUsesWith(Res);
3335+
VPValue *Res = Builder.createNaryOp(
3336+
Instruction::Sub, {TC, R}, DebugLoc::getCompilerGenerated(), "n.vec");
3337+
VectorTC.replaceAllUsesWith(Res);
33383338
}
33393339

33403340
/// Returns true if \p V is VPWidenLoadRecipe or VPInterleaveRecipe that can be

llvm/test/Transforms/LoopVectorize/AArch64/sve-low-trip-count.ll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@ define void @trip7_i64(ptr noalias nocapture noundef %dst, ptr noalias nocapture
99
; CHECK-NEXT: [[ENTRY:.*:]]
1010
; CHECK-NEXT: br i1 false, label %[[SCALAR_PH:.*]], label %[[VECTOR_PH:.*]]
1111
; CHECK: [[VECTOR_PH]]:
12-
; CHECK-NEXT: [[TMP0:%.*]] = call i64 @llvm.vscale.i64()
13-
; CHECK-NEXT: [[TMP1:%.*]] = mul nuw i64 [[TMP0]], 2
14-
; CHECK-NEXT: [[TMP2:%.*]] = sub i64 [[TMP1]], 1
15-
; CHECK-NEXT: [[N_RND_UP:%.*]] = add i64 7, [[TMP2]]
16-
; CHECK-NEXT: [[N_MOD_VF:%.*]] = urem i64 [[N_RND_UP]], [[TMP1]]
17-
; CHECK-NEXT: [[N_VEC:%.*]] = sub i64 [[N_RND_UP]], [[N_MOD_VF]]
1812
; CHECK-NEXT: [[TMP3:%.*]] = call i64 @llvm.vscale.i64()
1913
; CHECK-NEXT: [[TMP4:%.*]] = mul nuw i64 [[TMP3]], 2
2014
; CHECK-NEXT: [[ACTIVE_LANE_MASK_ENTRY:%.*]] = call <vscale x 2 x i1> @llvm.get.active.lane.mask.nxv2i1.i64(i64 0, i64 7)

0 commit comments

Comments
 (0)