Skip to content

Commit 86b89a6

Browse files
committed
[VPlan] Mark VPlan argument in isHeaderMask as const (NFC).
isHeaderMask should not modify the VPlan; mark as const to allow easy re-use in the VPlanVerifier.
1 parent 59ab4d4 commit 86b89a6

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

llvm/lib/Transforms/Vectorize/VPlan.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4267,12 +4267,14 @@ class VPlan {
42674267
BackedgeTakenCount = new VPValue();
42684268
return BackedgeTakenCount;
42694269
}
4270+
VPValue *getBackedgeTakenCount() const { return BackedgeTakenCount; }
42704271

42714272
/// The vector trip count.
42724273
VPValue &getVectorTripCount() { return VectorTripCount; }
42734274

42744275
/// Returns the VF of the vector loop region.
42754276
VPValue &getVF() { return VF; };
4277+
const VPValue &getVF() const { return VF; };
42764278

42774279
/// Returns VF * UF of the vector loop region.
42784280
VPValue &getVFxUF() { return VFxUF; }

llvm/lib/Transforms/Vectorize/VPlanUtils.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ VPValue *vputils::getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr) {
5353
return Expanded;
5454
}
5555

56-
bool vputils::isHeaderMask(const VPValue *V, VPlan &Plan) {
56+
bool vputils::isHeaderMask(const VPValue *V, const VPlan &Plan) {
5757
if (isa<VPActiveLaneMaskPHIRecipe>(V))
5858
return true;
5959

@@ -74,7 +74,7 @@ bool vputils::isHeaderMask(const VPValue *V, VPlan &Plan) {
7474
IsWideCanonicalIV(A));
7575

7676
return match(V, m_ICmp(m_VPValue(A), m_VPValue(B))) && IsWideCanonicalIV(A) &&
77-
B == Plan.getOrCreateBackedgeTakenCount();
77+
B == Plan.getBackedgeTakenCount();
7878
}
7979

8080
const SCEV *vputils::getSCEVExprForVPValue(VPValue *V, ScalarEvolution &SE) {

llvm/lib/Transforms/Vectorize/VPlanUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ inline bool isSingleScalar(const VPValue *VPV) {
9090
}
9191

9292
/// Return true if \p V is a header mask in \p Plan.
93-
bool isHeaderMask(const VPValue *V, VPlan &Plan);
93+
bool isHeaderMask(const VPValue *V, const VPlan &Plan);
9494

9595
/// Checks if \p V is uniform across all VF lanes and UF parts. It is considered
9696
/// as such if it is either loop invariant (defined outside the vector region)

0 commit comments

Comments
 (0)