1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

[LoopVectorizationLegality] NFC: Mark some interfaces as 'const'

This patch marks blockNeedsPredication, isConsecutivePtr, isMaskRequired
and getSymbolicStrides as 'const'.
This commit is contained in:
Sander de Smalen 2021-05-14 10:52:44 +01:00
parent 5ec2c45efb
commit 7a186bd3d7
2 changed files with 8 additions and 6 deletions

View File

@ -299,7 +299,7 @@ public:
/// 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 @@ public:
/// -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 @@ public:
/// 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 @@ private:
/// 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

View File

@ -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);
}