Skip to content

TargetTransformInfo: Add missing consts to a couple of methods #128492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions llvm/include/llvm/Analysis/TargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -2055,8 +2055,8 @@ class TargetTransformInfo::Concept {
virtual bool isTruncateFree(Type *Ty1, Type *Ty2) = 0;
virtual bool isProfitableToHoist(Instruction *I) = 0;
virtual bool useAA() = 0;
virtual bool isTypeLegal(Type *Ty) = 0;
virtual unsigned getRegUsageForType(Type *Ty) = 0;
virtual bool isTypeLegal(Type *Ty) const = 0;
virtual unsigned getRegUsageForType(Type *Ty) const = 0;
virtual bool shouldBuildLookupTables() = 0;
virtual bool shouldBuildLookupTablesForConstant(Constant *C) = 0;
virtual bool shouldBuildRelLookupTables() = 0;
Expand Down Expand Up @@ -2645,8 +2645,8 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
return Impl.isProfitableToHoist(I);
}
bool useAA() override { return Impl.useAA(); }
bool isTypeLegal(Type *Ty) override { return Impl.isTypeLegal(Ty); }
unsigned getRegUsageForType(Type *Ty) override {
bool isTypeLegal(Type *Ty) const override { return Impl.isTypeLegal(Ty); }
unsigned getRegUsageForType(Type *Ty) const override {
return Impl.getRegUsageForType(Ty);
}
bool shouldBuildLookupTables() override {
Expand Down
4 changes: 2 additions & 2 deletions llvm/include/llvm/CodeGen/BasicTTIImpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -465,12 +465,12 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {

bool useAA() const { return getST()->useAA(); }

bool isTypeLegal(Type *Ty) {
bool isTypeLegal(Type *Ty) const {
EVT VT = getTLI()->getValueType(DL, Ty, /*AllowUnknown=*/true);
return getTLI()->isTypeLegal(VT);
}

unsigned getRegUsageForType(Type *Ty) {
unsigned getRegUsageForType(Type *Ty) const {
EVT ETy = getTLI()->getValueType(DL, Ty);
return getTLI()->getNumRegisters(Ty->getContext(), ETy);
}
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2517,7 +2517,7 @@ void RISCVTTIImpl::getPeelingPreferences(Loop *L, ScalarEvolution &SE,
BaseT::getPeelingPreferences(L, SE, PP);
}

unsigned RISCVTTIImpl::getRegUsageForType(Type *Ty) {
unsigned RISCVTTIImpl::getRegUsageForType(Type *Ty) const {
if (Ty->isVectorTy()) {
// f16 with only zvfhmin and bf16 will be promoted to f32
Type *EltTy = cast<VectorType>(Ty)->getElementType();
Expand Down
2 changes: 1 addition & 1 deletion llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {

TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const;

unsigned getRegUsageForType(Type *Ty);
unsigned getRegUsageForType(Type *Ty) const;

unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const;

Expand Down
Loading