[llvm] r346859 - [TTI] Pull out repeated 'ConcreteTTI' static_casts. NFCI.
Simon Pilgrim via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 14 05:23:28 PST 2018
Author: rksimon
Date: Wed Nov 14 05:23:28 2018
New Revision: 346859
URL: http://llvm.org/viewvc/llvm-project?rev=346859&view=rev
Log:
[TTI] Pull out repeated 'ConcreteTTI' static_casts. NFCI.
Modified:
llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h
Modified: llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h?rev=346859&r1=346858&r2=346859&view=diff
==============================================================================
--- llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h (original)
+++ llvm/trunk/include/llvm/CodeGen/BasicTTIImpl.h Wed Nov 14 05:23:28 2018
@@ -1008,6 +1008,7 @@ public:
unsigned VF = 1) {
unsigned RetVF = (RetTy->isVectorTy() ? RetTy->getVectorNumElements() : 1);
assert((RetVF == 1 || VF == 1) && "VF > 1 and RetVF is a vector type");
+ auto *ConcreteTTI = static_cast<T *>(this);
switch (IID) {
default: {
@@ -1033,29 +1034,24 @@ public:
ScalarizationCost += getOperandsScalarizationOverhead(Args, VF);
}
- return static_cast<T *>(this)->
- getIntrinsicInstrCost(IID, RetTy, Types, FMF, ScalarizationCost);
+ return ConcreteTTI->getIntrinsicInstrCost(IID, RetTy, Types, FMF,
+ ScalarizationCost);
}
case Intrinsic::masked_scatter: {
assert(VF == 1 && "Can't vectorize types here.");
Value *Mask = Args[3];
bool VarMask = !isa<Constant>(Mask);
unsigned Alignment = cast<ConstantInt>(Args[2])->getZExtValue();
- return
- static_cast<T *>(this)->getGatherScatterOpCost(Instruction::Store,
- Args[0]->getType(),
- Args[1], VarMask,
- Alignment);
+ return ConcreteTTI->getGatherScatterOpCost(
+ Instruction::Store, Args[0]->getType(), Args[1], VarMask, Alignment);
}
case Intrinsic::masked_gather: {
assert(VF == 1 && "Can't vectorize types here.");
Value *Mask = Args[2];
bool VarMask = !isa<Constant>(Mask);
unsigned Alignment = cast<ConstantInt>(Args[1])->getZExtValue();
- return
- static_cast<T *>(this)->getGatherScatterOpCost(Instruction::Load,
- RetTy, Args[0], VarMask,
- Alignment);
+ return ConcreteTTI->getGatherScatterOpCost(Instruction::Load, RetTy,
+ Args[0], VarMask, Alignment);
}
case Intrinsic::experimental_vector_reduce_add:
case Intrinsic::experimental_vector_reduce_mul:
@@ -1085,7 +1081,6 @@ public:
: TTI::OP_None;
// fshl: (X << (Z % BW)) | (Y >> (BW - (Z % BW)))
// fshr: (X << (BW - (Z % BW))) | (Y >> (Z % BW))
- auto *ConcreteTTI = static_cast<T *>(this);
unsigned Cost = 0;
Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::Or, RetTy);
Cost += ConcreteTTI->getArithmeticInstrCost(BinaryOperator::Sub, RetTy);
More information about the llvm-commits
mailing list