[llvm] f82966d - [LoopVectorizationLegality] NFC: Mark some interfaces as 'const'
Sander de Smalen via llvm-commits
llvm-commits at lists.llvm.org
Fri May 14 03:54:28 PDT 2021
Author: Sander de Smalen
Date: 2021-05-14T11:53:54+01:00
New Revision: f82966d19a8bb8531f71913737fcc751bb6ae3e2
URL: https://github.com/llvm/llvm-project/commit/f82966d19a8bb8531f71913737fcc751bb6ae3e2
DIFF: https://github.com/llvm/llvm-project/commit/f82966d19a8bb8531f71913737fcc751bb6ae3e2.diff
LOG: [LoopVectorizationLegality] NFC: Mark some interfaces as 'const'
This patch marks blockNeedsPredication, isConsecutivePtr, isMaskRequired
and getSymbolicStrides as 'const'.
Added:
Modified:
llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
index d92fec8977c80..bed637e36d8a3 100644
--- a/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
+++ b/llvm/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h
@@ -299,7 +299,7 @@ class LoopVectorizationLegality {
/// Return true if the block BB needs to be predicated in order for the loop
/// to be vectorized.
- bool blockNeedsPredication(BasicBlock *BB);
+ bool blockNeedsPredication(BasicBlock *BB) const;
/// Check if this pointer is consecutive when vectorizing. This happens
/// when the last index of the GEP is the induction variable, or that the
@@ -311,7 +311,7 @@ class LoopVectorizationLegality {
/// -1 - Address is consecutive, and decreasing.
/// NOTE: This method must only be used before modifying the original scalar
/// loop. Do not use after invoking 'createVectorizedLoopSkeleton' (PR34965).
- int isConsecutivePtr(Value *Ptr);
+ int isConsecutivePtr(Value *Ptr) const;
/// Returns true if the value V is uniform within the loop.
bool isUniform(Value *V);
@@ -350,7 +350,9 @@ class LoopVectorizationLegality {
/// Returns true if vector representation of the instruction \p I
/// requires mask.
- bool isMaskRequired(const Instruction *I) { return MaskedOp.contains(I); }
+ bool isMaskRequired(const Instruction *I) const {
+ return MaskedOp.contains(I);
+ }
unsigned getNumStores() const { return LAI->getNumStores(); }
unsigned getNumLoads() const { return LAI->getNumLoads(); }
@@ -429,7 +431,7 @@ class LoopVectorizationLegality {
/// If an access has a symbolic strides, this maps the pointer value to
/// the stride symbol.
- const ValueToValueMap *getSymbolicStrides() {
+ const ValueToValueMap *getSymbolicStrides() const {
// FIXME: Currently, the set of symbolic strides is sometimes queried before
// it's collected. This happens from canVectorizeWithIfConvert, when the
// pointer is checked to reference consecutive elements suitable for a
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
index 2cb4e4f824dd2..69d75548eab18 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp
@@ -376,7 +376,7 @@ static bool hasOutsideLoopUser(const Loop *TheLoop, Instruction *Inst,
return false;
}
-int LoopVectorizationLegality::isConsecutivePtr(Value *Ptr) {
+int LoopVectorizationLegality::isConsecutivePtr(Value *Ptr) const {
const ValueToValueMap &Strides =
getSymbolicStrides() ? *getSymbolicStrides() : ValueToValueMap();
@@ -879,7 +879,7 @@ bool LoopVectorizationLegality::isFirstOrderRecurrence(const PHINode *Phi) {
return FirstOrderRecurrences.count(Phi);
}
-bool LoopVectorizationLegality::blockNeedsPredication(BasicBlock *BB) {
+bool LoopVectorizationLegality::blockNeedsPredication(BasicBlock *BB) const {
return LoopAccessInfo::blockNeedsPredication(BB, TheLoop, DT);
}
More information about the llvm-commits
mailing list