Skip to content
This repository was archived by the owner on Mar 28, 2020. It is now read-only.

Commit 9953432

Browse files
committed
[TTI] Use ConcreteTTI cast in getIntrinsicInstrCost Type variant. NFCI.
Same as we do in the Value variant. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@351554 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent e69eed4 commit 9953432

File tree

1 file changed

+28
-28
lines changed

1 file changed

+28
-28
lines changed

include/llvm/CodeGen/BasicTTIImpl.h

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,6 +1116,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
11161116
unsigned getIntrinsicInstrCost(
11171117
Intrinsic::ID IID, Type *RetTy, ArrayRef<Type *> Tys, FastMathFlags FMF,
11181118
unsigned ScalarizationCostPassed = std::numeric_limits<unsigned>::max()) {
1119+
auto *ConcreteTTI = static_cast<T *>(this);
1120+
11191121
SmallVector<unsigned, 2> ISDs;
11201122
unsigned SingleCallCost = 10; // Library call cost. Make it expensive.
11211123
switch (IID) {
@@ -1144,8 +1146,8 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
11441146
if (ScalarCalls == 1)
11451147
return 1; // Return cost of a scalar intrinsic. Assume it to be cheap.
11461148

1147-
unsigned ScalarCost = static_cast<T *>(this)->getIntrinsicInstrCost(
1148-
IID, ScalarRetTy, ScalarTys, FMF);
1149+
unsigned ScalarCost =
1150+
ConcreteTTI->getIntrinsicInstrCost(IID, ScalarRetTy, ScalarTys, FMF);
11491151

11501152
return ScalarCalls * ScalarCost + ScalarizationCost;
11511153
}
@@ -1227,42 +1229,41 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
12271229
case Intrinsic::sideeffect:
12281230
return 0;
12291231
case Intrinsic::masked_store:
1230-
return static_cast<T *>(this)
1231-
->getMaskedMemoryOpCost(Instruction::Store, Tys[0], 0, 0);
1232+
return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Store, Tys[0], 0,
1233+
0);
12321234
case Intrinsic::masked_load:
1233-
return static_cast<T *>(this)
1234-
->getMaskedMemoryOpCost(Instruction::Load, RetTy, 0, 0);
1235+
return ConcreteTTI->getMaskedMemoryOpCost(Instruction::Load, RetTy, 0, 0);
12351236
case Intrinsic::experimental_vector_reduce_add:
1236-
return static_cast<T *>(this)->getArithmeticReductionCost(
1237-
Instruction::Add, Tys[0], /*IsPairwiseForm=*/false);
1237+
return ConcreteTTI->getArithmeticReductionCost(Instruction::Add, Tys[0],
1238+
/*IsPairwiseForm=*/false);
12381239
case Intrinsic::experimental_vector_reduce_mul:
1239-
return static_cast<T *>(this)->getArithmeticReductionCost(
1240-
Instruction::Mul, Tys[0], /*IsPairwiseForm=*/false);
1240+
return ConcreteTTI->getArithmeticReductionCost(Instruction::Mul, Tys[0],
1241+
/*IsPairwiseForm=*/false);
12411242
case Intrinsic::experimental_vector_reduce_and:
1242-
return static_cast<T *>(this)->getArithmeticReductionCost(
1243-
Instruction::And, Tys[0], /*IsPairwiseForm=*/false);
1243+
return ConcreteTTI->getArithmeticReductionCost(Instruction::And, Tys[0],
1244+
/*IsPairwiseForm=*/false);
12441245
case Intrinsic::experimental_vector_reduce_or:
1245-
return static_cast<T *>(this)->getArithmeticReductionCost(
1246-
Instruction::Or, Tys[0], /*IsPairwiseForm=*/false);
1246+
return ConcreteTTI->getArithmeticReductionCost(Instruction::Or, Tys[0],
1247+
/*IsPairwiseForm=*/false);
12471248
case Intrinsic::experimental_vector_reduce_xor:
1248-
return static_cast<T *>(this)->getArithmeticReductionCost(
1249-
Instruction::Xor, Tys[0], /*IsPairwiseForm=*/false);
1249+
return ConcreteTTI->getArithmeticReductionCost(Instruction::Xor, Tys[0],
1250+
/*IsPairwiseForm=*/false);
12501251
case Intrinsic::experimental_vector_reduce_fadd:
1251-
return static_cast<T *>(this)->getArithmeticReductionCost(
1252-
Instruction::FAdd, Tys[0], /*IsPairwiseForm=*/false);
1252+
return ConcreteTTI->getArithmeticReductionCost(Instruction::FAdd, Tys[0],
1253+
/*IsPairwiseForm=*/false);
12531254
case Intrinsic::experimental_vector_reduce_fmul:
1254-
return static_cast<T *>(this)->getArithmeticReductionCost(
1255-
Instruction::FMul, Tys[0], /*IsPairwiseForm=*/false);
1255+
return ConcreteTTI->getArithmeticReductionCost(Instruction::FMul, Tys[0],
1256+
/*IsPairwiseForm=*/false);
12561257
case Intrinsic::experimental_vector_reduce_smax:
12571258
case Intrinsic::experimental_vector_reduce_smin:
12581259
case Intrinsic::experimental_vector_reduce_fmax:
12591260
case Intrinsic::experimental_vector_reduce_fmin:
1260-
return static_cast<T *>(this)->getMinMaxReductionCost(
1261+
return ConcreteTTI->getMinMaxReductionCost(
12611262
Tys[0], CmpInst::makeCmpResultType(Tys[0]), /*IsPairwiseForm=*/false,
12621263
/*IsSigned=*/true);
12631264
case Intrinsic::experimental_vector_reduce_umax:
12641265
case Intrinsic::experimental_vector_reduce_umin:
1265-
return static_cast<T *>(this)->getMinMaxReductionCost(
1266+
return ConcreteTTI->getMinMaxReductionCost(
12661267
Tys[0], CmpInst::makeCmpResultType(Tys[0]), /*IsPairwiseForm=*/false,
12671268
/*IsSigned=*/false);
12681269
case Intrinsic::ctpop:
@@ -1305,17 +1306,16 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
13051306
if (MinLegalCostI != LegalCost.end())
13061307
return *MinLegalCostI;
13071308

1308-
auto MinCustomCostI = std::min_element(CustomCost.begin(), CustomCost.end());
1309+
auto MinCustomCostI =
1310+
std::min_element(CustomCost.begin(), CustomCost.end());
13091311
if (MinCustomCostI != CustomCost.end())
13101312
return *MinCustomCostI;
13111313

13121314
// If we can't lower fmuladd into an FMA estimate the cost as a floating
13131315
// point mul followed by an add.
13141316
if (IID == Intrinsic::fmuladd)
1315-
return static_cast<T *>(this)
1316-
->getArithmeticInstrCost(BinaryOperator::FMul, RetTy) +
1317-
static_cast<T *>(this)
1318-
->getArithmeticInstrCost(BinaryOperator::FAdd, RetTy);
1317+
return ConcreteTTI->getArithmeticInstrCost(BinaryOperator::FMul, RetTy) +
1318+
ConcreteTTI->getArithmeticInstrCost(BinaryOperator::FAdd, RetTy);
13191319

13201320
// Else, assume that we need to scalarize this intrinsic. For math builtins
13211321
// this will emit a costly libcall, adding call overhead and spills. Make it
@@ -1333,7 +1333,7 @@ class BasicTTIImplBase : public TargetTransformInfoImplCRTPBase<T> {
13331333
Ty = Ty->getScalarType();
13341334
ScalarTys.push_back(Ty);
13351335
}
1336-
unsigned ScalarCost = static_cast<T *>(this)->getIntrinsicInstrCost(
1336+
unsigned ScalarCost = ConcreteTTI->getIntrinsicInstrCost(
13371337
IID, RetTy->getScalarType(), ScalarTys, FMF);
13381338
for (unsigned i = 0, ie = Tys.size(); i != ie; ++i) {
13391339
if (Tys[i]->isVectorTy()) {

0 commit comments

Comments
 (0)