@@ -341,7 +341,7 @@ class TargetTransformInfoImplBase {
341
341
}
342
342
343
343
bool isLegalInterleavedAccessType (VectorType *VTy, unsigned Factor,
344
- Align Alignment, unsigned AddrSpace) {
344
+ Align Alignment, unsigned AddrSpace) const {
345
345
return false ;
346
346
}
347
347
@@ -440,7 +440,7 @@ class TargetTransformInfoImplBase {
440
440
441
441
bool enableSelectOptimize () const { return true ; }
442
442
443
- bool shouldTreatInstructionLikeSelect (const Instruction *I) {
443
+ bool shouldTreatInstructionLikeSelect (const Instruction *I) const {
444
444
// A select with two constant operands will usually be better left as a
445
445
// select.
446
446
using namespace llvm ::PatternMatch;
@@ -747,7 +747,7 @@ class TargetTransformInfoImplBase {
747
747
748
748
unsigned getReplicationShuffleCost (Type *EltTy, int ReplicationFactor, int VF,
749
749
const APInt &DemandedDstElts,
750
- TTI::TargetCostKind CostKind) {
750
+ TTI::TargetCostKind CostKind) const {
751
751
return 1 ;
752
752
}
753
753
@@ -1170,7 +1170,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
1170
1170
1171
1171
InstructionCost getGEPCost (Type *PointeeType, const Value *Ptr ,
1172
1172
ArrayRef<const Value *> Operands, Type *AccessType,
1173
- TTI::TargetCostKind CostKind) {
1173
+ TTI::TargetCostKind CostKind) const {
1174
1174
assert (PointeeType && Ptr && " can't get GEPCost of nullptr" );
1175
1175
auto *BaseGV = dyn_cast<GlobalValue>(Ptr ->stripPointerCasts ());
1176
1176
bool HasBaseReg = (BaseGV == nullptr );
@@ -1234,7 +1234,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
1234
1234
1235
1235
// If the final address of the GEP is a legal addressing mode for the given
1236
1236
// access type, then we can fold it into its users.
1237
- if (static_cast <T *>(this )->isLegalAddressingMode (
1237
+ if (static_cast <const T *>(this )->isLegalAddressingMode (
1238
1238
AccessType, const_cast <GlobalValue *>(BaseGV),
1239
1239
BaseOffset.sextOrTrunc (64 ).getSExtValue (), HasBaseReg, Scale,
1240
1240
Ptr ->getType ()->getPointerAddressSpace ()))
@@ -1250,7 +1250,7 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
1250
1250
const Value *Base,
1251
1251
const TTI::PointersChainInfo &Info,
1252
1252
Type *AccessTy,
1253
- TTI::TargetCostKind CostKind) {
1253
+ TTI::TargetCostKind CostKind) const {
1254
1254
InstructionCost Cost = TTI::TCC_Free;
1255
1255
// In the basic model we take into account GEP instructions only
1256
1256
// (although here can come alloca instruction, a value, constants and/or
@@ -1269,26 +1269,26 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
1269
1269
if (Info.isSameBase () && V != Base) {
1270
1270
if (GEP->hasAllConstantIndices ())
1271
1271
continue ;
1272
- Cost += static_cast <T *>(this )->getArithmeticInstrCost (
1272
+ Cost += static_cast <const T *>(this )->getArithmeticInstrCost (
1273
1273
Instruction::Add, GEP->getType (), CostKind,
1274
1274
{TTI::OK_AnyValue, TTI::OP_None}, {TTI::OK_AnyValue, TTI::OP_None},
1275
1275
{});
1276
1276
} else {
1277
1277
SmallVector<const Value *> Indices (GEP->indices ());
1278
- Cost += static_cast <T *>(this )->getGEPCost (GEP-> getSourceElementType (),
1279
- GEP->getPointerOperand (),
1280
- Indices, AccessTy, CostKind);
1278
+ Cost += static_cast <const T *>(this )->getGEPCost (
1279
+ GEP-> getSourceElementType (), GEP->getPointerOperand (), Indices ,
1280
+ AccessTy, CostKind);
1281
1281
}
1282
1282
}
1283
1283
return Cost;
1284
1284
}
1285
1285
1286
1286
InstructionCost getInstructionCost (const User *U,
1287
1287
ArrayRef<const Value *> Operands,
1288
- TTI::TargetCostKind CostKind) {
1288
+ TTI::TargetCostKind CostKind) const {
1289
1289
using namespace llvm ::PatternMatch;
1290
1290
1291
- auto *TargetTTI = static_cast <T *>(this );
1291
+ auto *TargetTTI = static_cast <const T *>(this );
1292
1292
// Handle non-intrinsic calls, invokes, and callbr.
1293
1293
// FIXME: Unlikely to be true for anything but CodeSize.
1294
1294
auto *CB = dyn_cast<CallBase>(U);
@@ -1585,8 +1585,8 @@ class TargetTransformInfoImplCRTPBase : public TargetTransformInfoImplBase {
1585
1585
return CostKind == TTI::TCK_RecipThroughput ? -1 : TTI::TCC_Basic;
1586
1586
}
1587
1587
1588
- bool isExpensiveToSpeculativelyExecute (const Instruction *I) {
1589
- auto *TargetTTI = static_cast <T *>(this );
1588
+ bool isExpensiveToSpeculativelyExecute (const Instruction *I) const {
1589
+ auto *TargetTTI = static_cast <const T *>(this );
1590
1590
SmallVector<const Value *, 4 > Ops (I->operand_values ());
1591
1591
InstructionCost Cost = TargetTTI->getInstructionCost (
1592
1592
I, Ops, TargetTransformInfo::TCK_SizeAndLatency);
0 commit comments