Skip to content

Commit 971fc42

Browse files
authored
TargetTransformInfo: Add missing consts to a couple of methods (#128492)
1 parent 1ed359e commit 971fc42

File tree

4 files changed

+8
-8
lines changed

4 files changed

+8
-8
lines changed

llvm/include/llvm/Analysis/TargetTransformInfo.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,8 +2055,8 @@ class TargetTransformInfo::Concept {
20552055
virtual bool isTruncateFree(Type *Ty1, Type *Ty2) = 0;
20562056
virtual bool isProfitableToHoist(Instruction *I) = 0;
20572057
virtual bool useAA() = 0;
2058-
virtual bool isTypeLegal(Type *Ty) = 0;
2059-
virtual unsigned getRegUsageForType(Type *Ty) = 0;
2058+
virtual bool isTypeLegal(Type *Ty) const = 0;
2059+
virtual unsigned getRegUsageForType(Type *Ty) const = 0;
20602060
virtual bool shouldBuildLookupTables() = 0;
20612061
virtual bool shouldBuildLookupTablesForConstant(Constant *C) = 0;
20622062
virtual bool shouldBuildRelLookupTables() = 0;
@@ -2645,8 +2645,8 @@ class TargetTransformInfo::Model final : public TargetTransformInfo::Concept {
26452645
return Impl.isProfitableToHoist(I);
26462646
}
26472647
bool useAA() override { return Impl.useAA(); }
2648-
bool isTypeLegal(Type *Ty) override { return Impl.isTypeLegal(Ty); }
2649-
unsigned getRegUsageForType(Type *Ty) override {
2648+
bool isTypeLegal(Type *Ty) const override { return Impl.isTypeLegal(Ty); }
2649+
unsigned getRegUsageForType(Type *Ty) const override {
26502650
return Impl.getRegUsageForType(Ty);
26512651
}
26522652
bool shouldBuildLookupTables() override {

llvm/include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,12 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
465465

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

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

473-
unsigned getRegUsageForType(Type *Ty) {
473+
unsigned getRegUsageForType(Type *Ty) const {
474474
EVT ETy = getTLI()->getValueType(DL, Ty);
475475
return getTLI()->getNumRegisters(Ty->getContext(), ETy);
476476
}

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2517,7 +2517,7 @@ void RISCVTTIImpl::getPeelingPreferences(Loop *L, ScalarEvolution &SE,
25172517
BaseT::getPeelingPreferences(L, SE, PP);
25182518
}
25192519

2520-
unsigned RISCVTTIImpl::getRegUsageForType(Type *Ty) {
2520+
unsigned RISCVTTIImpl::getRegUsageForType(Type *Ty) const {
25212521
if (Ty->isVectorTy()) {
25222522
// f16 with only zvfhmin and bf16 will be promoted to f32
25232523
Type *EltTy = cast<VectorType>(Ty)->getElementType();

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
115115

116116
TypeSize getRegisterBitWidth(TargetTransformInfo::RegisterKind K) const;
117117

118-
unsigned getRegUsageForType(Type *Ty);
118+
unsigned getRegUsageForType(Type *Ty) const;
119119

120120
unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const;
121121

0 commit comments

Comments
 (0)