Skip to content

Commit

Permalink
[LV] Mark some methods as const (NFC).
Browse files Browse the repository at this point in the history
Mark a few methods as const, as they do not modify any state.
  • Loading branch information
fhahn committed Mar 27, 2021
1 parent 3001d08 commit 2f9d68c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ class LoopVectorizationCostModel {
/// Return the cost model decision for the given instruction \p I and vector
/// width \p VF. Return CM_Unknown if this instruction did not pass
/// through the cost modeling.
InstWidening getWideningDecision(Instruction *I, ElementCount VF) {
InstWidening getWideningDecision(Instruction *I, ElementCount VF) const {
assert(VF.isVector() && "Expected VF to be a vector VF");
// Cost model is not run in the VPlan-native path - return conservative
// result until this changes.
Expand Down Expand Up @@ -1581,15 +1581,15 @@ class LoopVectorizationCostModel {
/// Estimate cost of an intrinsic call instruction CI if it were vectorized
/// with factor VF. Return the cost of the instruction, including
/// scalarization overhead if it's needed.
InstructionCost getVectorIntrinsicCost(CallInst *CI, ElementCount VF);
InstructionCost getVectorIntrinsicCost(CallInst *CI, ElementCount VF) const;

/// Estimate cost of a call instruction CI if it were vectorized with factor
/// VF. Return the cost of the instruction, including scalarization overhead
/// if it's needed. The flag NeedToScalarize shows if the call needs to be
/// scalarized -
/// i.e. either vector version isn't available, or is too expensive.
InstructionCost getVectorCallCost(CallInst *CI, ElementCount VF,
bool &NeedToScalarize);
bool &NeedToScalarize) const;

/// Invalidates decisions already taken by the cost model.
void invalidateCostModelingDecisions() {
Expand Down Expand Up @@ -1661,7 +1661,7 @@ class LoopVectorizationCostModel {

/// Estimate the overhead of scalarizing an instruction. This is a
/// convenience wrapper for the type-based getScalarizationOverhead API.
InstructionCost getScalarizationOverhead(Instruction *I, ElementCount VF);
InstructionCost getScalarizationOverhead(Instruction *I, ElementCount VF) const;

/// Returns whether the instruction is a load or store and will be a emitted
/// as a vector operation.
Expand Down Expand Up @@ -1779,7 +1779,7 @@ class LoopVectorizationCostModel {

/// Returns a range containing only operands needing to be extracted.
SmallVector<Value *, 4> filterExtractingOperands(Instruction::op_range Ops,
ElementCount VF) {
ElementCount VF) const {
return SmallVector<Value *, 4>(make_filter_range(
Ops, [this, VF](Value *V) { return this->needsExtract(V, VF); }));
}
Expand Down Expand Up @@ -3747,7 +3747,7 @@ static void cse(BasicBlock *BB) {

InstructionCost
LoopVectorizationCostModel::getVectorCallCost(CallInst *CI, ElementCount VF,
bool &NeedToScalarize) {
bool &NeedToScalarize) const {
Function *F = CI->getCalledFunction();
Type *ScalarRetTy = CI->getType();
SmallVector<Type *, 4> Tys, ScalarTys;
Expand Down Expand Up @@ -3802,7 +3802,7 @@ static Type *MaybeVectorizeType(Type *Elt, ElementCount VF) {

InstructionCost
LoopVectorizationCostModel::getVectorIntrinsicCost(CallInst *CI,
ElementCount VF) {
ElementCount VF) const {
Intrinsic::ID ID = getVectorIntrinsicIDForCall(CI, TLI);
assert(ID && "Expected intrinsic call!");
Type *RetTy = MaybeVectorizeType(CI->getType(), VF);
Expand Down Expand Up @@ -7056,7 +7056,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,

InstructionCost
LoopVectorizationCostModel::getScalarizationOverhead(Instruction *I,
ElementCount VF) {
ElementCount VF) const {

if (VF.isScalable())
return InstructionCost::getInvalid();
Expand Down

0 comments on commit 2f9d68c

Please sign in to comment.