[llvm] 2f9d68c - [LV] Mark some methods as const (NFC).
Florian Hahn via llvm-commits
llvm-commits at lists.llvm.org
Sat Mar 27 14:28:53 PDT 2021
Author: Florian Hahn
Date: 2021-03-27T21:27:53Z
New Revision: 2f9d68c3f12a2eaa7972205dfb3fb4caca06e818
URL: https://github.com/llvm/llvm-project/commit/2f9d68c3f12a2eaa7972205dfb3fb4caca06e818
DIFF: https://github.com/llvm/llvm-project/commit/2f9d68c3f12a2eaa7972205dfb3fb4caca06e818.diff
LOG: [LV] Mark some methods as const (NFC).
Mark a few methods as const, as they do not modify any state.
Added:
Modified:
llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
index 7c90b7231e091..37af529dc8e10 100644
--- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
+++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp
@@ -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.
@@ -1581,7 +1581,7 @@ 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
@@ -1589,7 +1589,7 @@ class LoopVectorizationCostModel {
/// 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() {
@@ -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.
@@ -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); }));
}
@@ -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;
@@ -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);
@@ -7056,7 +7056,7 @@ LoopVectorizationCostModel::getInstructionCost(Instruction *I,
InstructionCost
LoopVectorizationCostModel::getScalarizationOverhead(Instruction *I,
- ElementCount VF) {
+ ElementCount VF) const {
if (VF.isScalable())
return InstructionCost::getInvalid();
More information about the llvm-commits
mailing list