[llvm] 971fc42 - TargetTransformInfo: Add missing consts to a couple of methods (#128492)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Feb 24 04:08:25 PST 2025
Author: Matt Arsenault
Date: 2025-02-24T19:08:22+07:00
New Revision: 971fc42254706b7a0cdeaf8183478d1e2a9aee51
URL: https://github.com/llvm/llvm-project/commit/971fc42254706b7a0cdeaf8183478d1e2a9aee51
DIFF: https://github.com/llvm/llvm-project/commit/971fc42254706b7a0cdeaf8183478d1e2a9aee51.diff
LOG: TargetTransformInfo: Add missing consts to a couple of methods (#128492)
Added:
Modified:
llvm/include/llvm/Analysis/TargetTransformInfo.h
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/Analysis/TargetTransformInfo.h b/llvm/include/llvm/Analysis/TargetTransformInfo.h
index 9048481b49189..e1bebb01372e0 100644
--- a/llvm/include/llvm/Analysis/TargetTransformInfo.h
+++ b/llvm/include/llvm/Analysis/TargetTransformInfo.h
@@ -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;
@@ -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 {
diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
index 032c7d7b5159e..bf6bfaca44a06 100644
--- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h
@@ -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);
}
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
index 39a35b0550f98..50662a00732da 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp
@@ -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();
diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
index 5389e9bc4a8fe..134a7333b9b06 100644
--- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
+++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h
@@ -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;
More information about the llvm-commits
mailing list