1 //===- llvm/Analysis/TargetTransformInfo.cpp ------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #include "llvm/Analysis/TargetTransformInfo.h"
11 #include "llvm/Analysis/TargetTransformInfoImpl.h"
12 #include "llvm/IR/CallSite.h"
13 #include "llvm/IR/DataLayout.h"
14 #include "llvm/IR/Instruction.h"
15 #include "llvm/IR/Instructions.h"
16 #include "llvm/IR/IntrinsicInst.h"
17 #include "llvm/IR/Module.h"
18 #include "llvm/IR/Operator.h"
19 #include "llvm/IR/PatternMatch.h"
20 #include "llvm/Support/CommandLine.h"
21 #include "llvm/Support/ErrorHandling.h"
25 using namespace PatternMatch
;
27 #define DEBUG_TYPE "tti"
29 static cl::opt
<bool> EnableReduxCost("costmodel-reduxcost", cl::init(false),
31 cl::desc("Recognize reduction patterns."));
34 /// No-op implementation of the TTI interface using the utility base
37 /// This is used when no target specific information is available.
38 struct NoTTIImpl
: TargetTransformInfoImplCRTPBase
<NoTTIImpl
> {
39 explicit NoTTIImpl(const DataLayout
&DL
)
40 : TargetTransformInfoImplCRTPBase
<NoTTIImpl
>(DL
) {}
44 TargetTransformInfo::TargetTransformInfo(const DataLayout
&DL
)
45 : TTIImpl(new Model
<NoTTIImpl
>(NoTTIImpl(DL
))) {}
47 TargetTransformInfo::~TargetTransformInfo() {}
49 TargetTransformInfo::TargetTransformInfo(TargetTransformInfo
&&Arg
)
50 : TTIImpl(std::move(Arg
.TTIImpl
)) {}
52 TargetTransformInfo
&TargetTransformInfo::operator=(TargetTransformInfo
&&RHS
) {
53 TTIImpl
= std::move(RHS
.TTIImpl
);
57 int TargetTransformInfo::getOperationCost(unsigned Opcode
, Type
*Ty
,
59 int Cost
= TTIImpl
->getOperationCost(Opcode
, Ty
, OpTy
);
60 assert(Cost
>= 0 && "TTI should not produce negative costs!");
64 int TargetTransformInfo::getCallCost(FunctionType
*FTy
, int NumArgs
) const {
65 int Cost
= TTIImpl
->getCallCost(FTy
, NumArgs
);
66 assert(Cost
>= 0 && "TTI should not produce negative costs!");
70 int TargetTransformInfo::getCallCost(const Function
*F
,
71 ArrayRef
<const Value
*> Arguments
) const {
72 int Cost
= TTIImpl
->getCallCost(F
, Arguments
);
73 assert(Cost
>= 0 && "TTI should not produce negative costs!");
77 unsigned TargetTransformInfo::getInliningThresholdMultiplier() const {
78 return TTIImpl
->getInliningThresholdMultiplier();
81 int TargetTransformInfo::getGEPCost(Type
*PointeeType
, const Value
*Ptr
,
82 ArrayRef
<const Value
*> Operands
) const {
83 return TTIImpl
->getGEPCost(PointeeType
, Ptr
, Operands
);
86 int TargetTransformInfo::getExtCost(const Instruction
*I
,
87 const Value
*Src
) const {
88 return TTIImpl
->getExtCost(I
, Src
);
91 int TargetTransformInfo::getIntrinsicCost(
92 Intrinsic::ID IID
, Type
*RetTy
, ArrayRef
<const Value
*> Arguments
) const {
93 int Cost
= TTIImpl
->getIntrinsicCost(IID
, RetTy
, Arguments
);
94 assert(Cost
>= 0 && "TTI should not produce negative costs!");
99 TargetTransformInfo::getEstimatedNumberOfCaseClusters(const SwitchInst
&SI
,
100 unsigned &JTSize
) const {
101 return TTIImpl
->getEstimatedNumberOfCaseClusters(SI
, JTSize
);
104 int TargetTransformInfo::getUserCost(const User
*U
,
105 ArrayRef
<const Value
*> Operands
) const {
106 int Cost
= TTIImpl
->getUserCost(U
, Operands
);
107 assert(Cost
>= 0 && "TTI should not produce negative costs!");
111 bool TargetTransformInfo::hasBranchDivergence() const {
112 return TTIImpl
->hasBranchDivergence();
115 bool TargetTransformInfo::isSourceOfDivergence(const Value
*V
) const {
116 return TTIImpl
->isSourceOfDivergence(V
);
119 bool llvm::TargetTransformInfo::isAlwaysUniform(const Value
*V
) const {
120 return TTIImpl
->isAlwaysUniform(V
);
123 unsigned TargetTransformInfo::getFlatAddressSpace() const {
124 return TTIImpl
->getFlatAddressSpace();
127 bool TargetTransformInfo::isLoweredToCall(const Function
*F
) const {
128 return TTIImpl
->isLoweredToCall(F
);
131 void TargetTransformInfo::getUnrollingPreferences(
132 Loop
*L
, ScalarEvolution
&SE
, UnrollingPreferences
&UP
) const {
133 return TTIImpl
->getUnrollingPreferences(L
, SE
, UP
);
136 bool TargetTransformInfo::isLegalAddImmediate(int64_t Imm
) const {
137 return TTIImpl
->isLegalAddImmediate(Imm
);
140 bool TargetTransformInfo::isLegalICmpImmediate(int64_t Imm
) const {
141 return TTIImpl
->isLegalICmpImmediate(Imm
);
144 bool TargetTransformInfo::isLegalAddressingMode(Type
*Ty
, GlobalValue
*BaseGV
,
149 Instruction
*I
) const {
150 return TTIImpl
->isLegalAddressingMode(Ty
, BaseGV
, BaseOffset
, HasBaseReg
,
151 Scale
, AddrSpace
, I
);
154 bool TargetTransformInfo::isLSRCostLess(LSRCost
&C1
, LSRCost
&C2
) const {
155 return TTIImpl
->isLSRCostLess(C1
, C2
);
158 bool TargetTransformInfo::canMacroFuseCmp() const {
159 return TTIImpl
->canMacroFuseCmp();
162 bool TargetTransformInfo::shouldFavorPostInc() const {
163 return TTIImpl
->shouldFavorPostInc();
166 bool TargetTransformInfo::isLegalMaskedStore(Type
*DataType
) const {
167 return TTIImpl
->isLegalMaskedStore(DataType
);
170 bool TargetTransformInfo::isLegalMaskedLoad(Type
*DataType
) const {
171 return TTIImpl
->isLegalMaskedLoad(DataType
);
174 bool TargetTransformInfo::isLegalMaskedGather(Type
*DataType
) const {
175 return TTIImpl
->isLegalMaskedGather(DataType
);
178 bool TargetTransformInfo::isLegalMaskedScatter(Type
*DataType
) const {
179 return TTIImpl
->isLegalMaskedScatter(DataType
);
182 bool TargetTransformInfo::hasDivRemOp(Type
*DataType
, bool IsSigned
) const {
183 return TTIImpl
->hasDivRemOp(DataType
, IsSigned
);
186 bool TargetTransformInfo::hasVolatileVariant(Instruction
*I
,
187 unsigned AddrSpace
) const {
188 return TTIImpl
->hasVolatileVariant(I
, AddrSpace
);
191 bool TargetTransformInfo::prefersVectorizedAddressing() const {
192 return TTIImpl
->prefersVectorizedAddressing();
195 int TargetTransformInfo::getScalingFactorCost(Type
*Ty
, GlobalValue
*BaseGV
,
199 unsigned AddrSpace
) const {
200 int Cost
= TTIImpl
->getScalingFactorCost(Ty
, BaseGV
, BaseOffset
, HasBaseReg
,
202 assert(Cost
>= 0 && "TTI should not produce negative costs!");
206 bool TargetTransformInfo::LSRWithInstrQueries() const {
207 return TTIImpl
->LSRWithInstrQueries();
210 bool TargetTransformInfo::isTruncateFree(Type
*Ty1
, Type
*Ty2
) const {
211 return TTIImpl
->isTruncateFree(Ty1
, Ty2
);
214 bool TargetTransformInfo::isProfitableToHoist(Instruction
*I
) const {
215 return TTIImpl
->isProfitableToHoist(I
);
218 bool TargetTransformInfo::useAA() const { return TTIImpl
->useAA(); }
220 bool TargetTransformInfo::isTypeLegal(Type
*Ty
) const {
221 return TTIImpl
->isTypeLegal(Ty
);
224 unsigned TargetTransformInfo::getJumpBufAlignment() const {
225 return TTIImpl
->getJumpBufAlignment();
228 unsigned TargetTransformInfo::getJumpBufSize() const {
229 return TTIImpl
->getJumpBufSize();
232 bool TargetTransformInfo::shouldBuildLookupTables() const {
233 return TTIImpl
->shouldBuildLookupTables();
235 bool TargetTransformInfo::shouldBuildLookupTablesForConstant(Constant
*C
) const {
236 return TTIImpl
->shouldBuildLookupTablesForConstant(C
);
239 bool TargetTransformInfo::useColdCCForColdCall(Function
&F
) const {
240 return TTIImpl
->useColdCCForColdCall(F
);
243 unsigned TargetTransformInfo::
244 getScalarizationOverhead(Type
*Ty
, bool Insert
, bool Extract
) const {
245 return TTIImpl
->getScalarizationOverhead(Ty
, Insert
, Extract
);
248 unsigned TargetTransformInfo::
249 getOperandsScalarizationOverhead(ArrayRef
<const Value
*> Args
,
251 return TTIImpl
->getOperandsScalarizationOverhead(Args
, VF
);
254 bool TargetTransformInfo::supportsEfficientVectorElementLoadStore() const {
255 return TTIImpl
->supportsEfficientVectorElementLoadStore();
258 bool TargetTransformInfo::enableAggressiveInterleaving(bool LoopHasReductions
) const {
259 return TTIImpl
->enableAggressiveInterleaving(LoopHasReductions
);
262 const TargetTransformInfo::MemCmpExpansionOptions
*
263 TargetTransformInfo::enableMemCmpExpansion(bool IsZeroCmp
) const {
264 return TTIImpl
->enableMemCmpExpansion(IsZeroCmp
);
267 bool TargetTransformInfo::enableInterleavedAccessVectorization() const {
268 return TTIImpl
->enableInterleavedAccessVectorization();
271 bool TargetTransformInfo::enableMaskedInterleavedAccessVectorization() const {
272 return TTIImpl
->enableMaskedInterleavedAccessVectorization();
275 bool TargetTransformInfo::isFPVectorizationPotentiallyUnsafe() const {
276 return TTIImpl
->isFPVectorizationPotentiallyUnsafe();
279 bool TargetTransformInfo::allowsMisalignedMemoryAccesses(LLVMContext
&Context
,
281 unsigned AddressSpace
,
284 return TTIImpl
->allowsMisalignedMemoryAccesses(Context
, BitWidth
, AddressSpace
,
288 TargetTransformInfo::PopcntSupportKind
289 TargetTransformInfo::getPopcntSupport(unsigned IntTyWidthInBit
) const {
290 return TTIImpl
->getPopcntSupport(IntTyWidthInBit
);
293 bool TargetTransformInfo::haveFastSqrt(Type
*Ty
) const {
294 return TTIImpl
->haveFastSqrt(Ty
);
297 bool TargetTransformInfo::isFCmpOrdCheaperThanFCmpZero(Type
*Ty
) const {
298 return TTIImpl
->isFCmpOrdCheaperThanFCmpZero(Ty
);
301 int TargetTransformInfo::getFPOpCost(Type
*Ty
) const {
302 int Cost
= TTIImpl
->getFPOpCost(Ty
);
303 assert(Cost
>= 0 && "TTI should not produce negative costs!");
307 int TargetTransformInfo::getIntImmCodeSizeCost(unsigned Opcode
, unsigned Idx
,
310 int Cost
= TTIImpl
->getIntImmCodeSizeCost(Opcode
, Idx
, Imm
, Ty
);
311 assert(Cost
>= 0 && "TTI should not produce negative costs!");
315 int TargetTransformInfo::getIntImmCost(const APInt
&Imm
, Type
*Ty
) const {
316 int Cost
= TTIImpl
->getIntImmCost(Imm
, Ty
);
317 assert(Cost
>= 0 && "TTI should not produce negative costs!");
321 int TargetTransformInfo::getIntImmCost(unsigned Opcode
, unsigned Idx
,
322 const APInt
&Imm
, Type
*Ty
) const {
323 int Cost
= TTIImpl
->getIntImmCost(Opcode
, Idx
, Imm
, Ty
);
324 assert(Cost
>= 0 && "TTI should not produce negative costs!");
328 int TargetTransformInfo::getIntImmCost(Intrinsic::ID IID
, unsigned Idx
,
329 const APInt
&Imm
, Type
*Ty
) const {
330 int Cost
= TTIImpl
->getIntImmCost(IID
, Idx
, Imm
, Ty
);
331 assert(Cost
>= 0 && "TTI should not produce negative costs!");
335 unsigned TargetTransformInfo::getNumberOfRegisters(bool Vector
) const {
336 return TTIImpl
->getNumberOfRegisters(Vector
);
339 unsigned TargetTransformInfo::getRegisterBitWidth(bool Vector
) const {
340 return TTIImpl
->getRegisterBitWidth(Vector
);
343 unsigned TargetTransformInfo::getMinVectorRegisterBitWidth() const {
344 return TTIImpl
->getMinVectorRegisterBitWidth();
347 bool TargetTransformInfo::shouldMaximizeVectorBandwidth(bool OptSize
) const {
348 return TTIImpl
->shouldMaximizeVectorBandwidth(OptSize
);
351 unsigned TargetTransformInfo::getMinimumVF(unsigned ElemWidth
) const {
352 return TTIImpl
->getMinimumVF(ElemWidth
);
355 bool TargetTransformInfo::shouldConsiderAddressTypePromotion(
356 const Instruction
&I
, bool &AllowPromotionWithoutCommonHeader
) const {
357 return TTIImpl
->shouldConsiderAddressTypePromotion(
358 I
, AllowPromotionWithoutCommonHeader
);
361 unsigned TargetTransformInfo::getCacheLineSize() const {
362 return TTIImpl
->getCacheLineSize();
365 llvm::Optional
<unsigned> TargetTransformInfo::getCacheSize(CacheLevel Level
)
367 return TTIImpl
->getCacheSize(Level
);
370 llvm::Optional
<unsigned> TargetTransformInfo::getCacheAssociativity(
371 CacheLevel Level
) const {
372 return TTIImpl
->getCacheAssociativity(Level
);
375 unsigned TargetTransformInfo::getPrefetchDistance() const {
376 return TTIImpl
->getPrefetchDistance();
379 unsigned TargetTransformInfo::getMinPrefetchStride() const {
380 return TTIImpl
->getMinPrefetchStride();
383 unsigned TargetTransformInfo::getMaxPrefetchIterationsAhead() const {
384 return TTIImpl
->getMaxPrefetchIterationsAhead();
387 unsigned TargetTransformInfo::getMaxInterleaveFactor(unsigned VF
) const {
388 return TTIImpl
->getMaxInterleaveFactor(VF
);
391 TargetTransformInfo::OperandValueKind
392 TargetTransformInfo::getOperandInfo(Value
*V
,
393 OperandValueProperties
&OpProps
) const {
394 OperandValueKind OpInfo
= OK_AnyValue
;
397 if (auto *CI
= dyn_cast
<ConstantInt
>(V
)) {
398 if (CI
->getValue().isPowerOf2())
399 OpProps
= OP_PowerOf2
;
400 return OK_UniformConstantValue
;
403 const Value
*Splat
= getSplatValue(V
);
405 // Check for a splat of a constant or for a non uniform vector of constants
406 // and check if the constant(s) are all powers of two.
407 if (isa
<ConstantVector
>(V
) || isa
<ConstantDataVector
>(V
)) {
408 OpInfo
= OK_NonUniformConstantValue
;
410 OpInfo
= OK_UniformConstantValue
;
411 if (auto *CI
= dyn_cast
<ConstantInt
>(Splat
))
412 if (CI
->getValue().isPowerOf2())
413 OpProps
= OP_PowerOf2
;
414 } else if (auto *CDS
= dyn_cast
<ConstantDataSequential
>(V
)) {
415 OpProps
= OP_PowerOf2
;
416 for (unsigned I
= 0, E
= CDS
->getNumElements(); I
!= E
; ++I
) {
417 if (auto *CI
= dyn_cast
<ConstantInt
>(CDS
->getElementAsConstant(I
)))
418 if (CI
->getValue().isPowerOf2())
426 // Check for a splat of a uniform value. This is not loop aware, so return
427 // true only for the obviously uniform cases (argument, globalvalue)
428 if (Splat
&& (isa
<Argument
>(Splat
) || isa
<GlobalValue
>(Splat
)))
429 OpInfo
= OK_UniformValue
;
434 int TargetTransformInfo::getArithmeticInstrCost(
435 unsigned Opcode
, Type
*Ty
, OperandValueKind Opd1Info
,
436 OperandValueKind Opd2Info
, OperandValueProperties Opd1PropInfo
,
437 OperandValueProperties Opd2PropInfo
,
438 ArrayRef
<const Value
*> Args
) const {
439 int Cost
= TTIImpl
->getArithmeticInstrCost(Opcode
, Ty
, Opd1Info
, Opd2Info
,
440 Opd1PropInfo
, Opd2PropInfo
, Args
);
441 assert(Cost
>= 0 && "TTI should not produce negative costs!");
445 int TargetTransformInfo::getShuffleCost(ShuffleKind Kind
, Type
*Ty
, int Index
,
447 int Cost
= TTIImpl
->getShuffleCost(Kind
, Ty
, Index
, SubTp
);
448 assert(Cost
>= 0 && "TTI should not produce negative costs!");
452 int TargetTransformInfo::getCastInstrCost(unsigned Opcode
, Type
*Dst
,
453 Type
*Src
, const Instruction
*I
) const {
454 assert ((I
== nullptr || I
->getOpcode() == Opcode
) &&
455 "Opcode should reflect passed instruction.");
456 int Cost
= TTIImpl
->getCastInstrCost(Opcode
, Dst
, Src
, I
);
457 assert(Cost
>= 0 && "TTI should not produce negative costs!");
461 int TargetTransformInfo::getExtractWithExtendCost(unsigned Opcode
, Type
*Dst
,
463 unsigned Index
) const {
464 int Cost
= TTIImpl
->getExtractWithExtendCost(Opcode
, Dst
, VecTy
, Index
);
465 assert(Cost
>= 0 && "TTI should not produce negative costs!");
469 int TargetTransformInfo::getCFInstrCost(unsigned Opcode
) const {
470 int Cost
= TTIImpl
->getCFInstrCost(Opcode
);
471 assert(Cost
>= 0 && "TTI should not produce negative costs!");
475 int TargetTransformInfo::getCmpSelInstrCost(unsigned Opcode
, Type
*ValTy
,
476 Type
*CondTy
, const Instruction
*I
) const {
477 assert ((I
== nullptr || I
->getOpcode() == Opcode
) &&
478 "Opcode should reflect passed instruction.");
479 int Cost
= TTIImpl
->getCmpSelInstrCost(Opcode
, ValTy
, CondTy
, I
);
480 assert(Cost
>= 0 && "TTI should not produce negative costs!");
484 int TargetTransformInfo::getVectorInstrCost(unsigned Opcode
, Type
*Val
,
485 unsigned Index
) const {
486 int Cost
= TTIImpl
->getVectorInstrCost(Opcode
, Val
, Index
);
487 assert(Cost
>= 0 && "TTI should not produce negative costs!");
491 int TargetTransformInfo::getMemoryOpCost(unsigned Opcode
, Type
*Src
,
493 unsigned AddressSpace
,
494 const Instruction
*I
) const {
495 assert ((I
== nullptr || I
->getOpcode() == Opcode
) &&
496 "Opcode should reflect passed instruction.");
497 int Cost
= TTIImpl
->getMemoryOpCost(Opcode
, Src
, Alignment
, AddressSpace
, I
);
498 assert(Cost
>= 0 && "TTI should not produce negative costs!");
502 int TargetTransformInfo::getMaskedMemoryOpCost(unsigned Opcode
, Type
*Src
,
504 unsigned AddressSpace
) const {
506 TTIImpl
->getMaskedMemoryOpCost(Opcode
, Src
, Alignment
, AddressSpace
);
507 assert(Cost
>= 0 && "TTI should not produce negative costs!");
511 int TargetTransformInfo::getGatherScatterOpCost(unsigned Opcode
, Type
*DataTy
,
512 Value
*Ptr
, bool VariableMask
,
513 unsigned Alignment
) const {
514 int Cost
= TTIImpl
->getGatherScatterOpCost(Opcode
, DataTy
, Ptr
, VariableMask
,
516 assert(Cost
>= 0 && "TTI should not produce negative costs!");
520 int TargetTransformInfo::getInterleavedMemoryOpCost(
521 unsigned Opcode
, Type
*VecTy
, unsigned Factor
, ArrayRef
<unsigned> Indices
,
522 unsigned Alignment
, unsigned AddressSpace
, bool IsMasked
) const {
523 int Cost
= TTIImpl
->getInterleavedMemoryOpCost(
524 Opcode
, VecTy
, Factor
, Indices
, Alignment
, AddressSpace
, IsMasked
);
525 assert(Cost
>= 0 && "TTI should not produce negative costs!");
529 int TargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID
, Type
*RetTy
,
530 ArrayRef
<Type
*> Tys
, FastMathFlags FMF
,
531 unsigned ScalarizationCostPassed
) const {
532 int Cost
= TTIImpl
->getIntrinsicInstrCost(ID
, RetTy
, Tys
, FMF
,
533 ScalarizationCostPassed
);
534 assert(Cost
>= 0 && "TTI should not produce negative costs!");
538 int TargetTransformInfo::getIntrinsicInstrCost(Intrinsic::ID ID
, Type
*RetTy
,
539 ArrayRef
<Value
*> Args
, FastMathFlags FMF
, unsigned VF
) const {
540 int Cost
= TTIImpl
->getIntrinsicInstrCost(ID
, RetTy
, Args
, FMF
, VF
);
541 assert(Cost
>= 0 && "TTI should not produce negative costs!");
545 int TargetTransformInfo::getCallInstrCost(Function
*F
, Type
*RetTy
,
546 ArrayRef
<Type
*> Tys
) const {
547 int Cost
= TTIImpl
->getCallInstrCost(F
, RetTy
, Tys
);
548 assert(Cost
>= 0 && "TTI should not produce negative costs!");
552 unsigned TargetTransformInfo::getNumberOfParts(Type
*Tp
) const {
553 return TTIImpl
->getNumberOfParts(Tp
);
556 int TargetTransformInfo::getAddressComputationCost(Type
*Tp
,
558 const SCEV
*Ptr
) const {
559 int Cost
= TTIImpl
->getAddressComputationCost(Tp
, SE
, Ptr
);
560 assert(Cost
>= 0 && "TTI should not produce negative costs!");
564 int TargetTransformInfo::getArithmeticReductionCost(unsigned Opcode
, Type
*Ty
,
565 bool IsPairwiseForm
) const {
566 int Cost
= TTIImpl
->getArithmeticReductionCost(Opcode
, Ty
, IsPairwiseForm
);
567 assert(Cost
>= 0 && "TTI should not produce negative costs!");
571 int TargetTransformInfo::getMinMaxReductionCost(Type
*Ty
, Type
*CondTy
,
573 bool IsUnsigned
) const {
575 TTIImpl
->getMinMaxReductionCost(Ty
, CondTy
, IsPairwiseForm
, IsUnsigned
);
576 assert(Cost
>= 0 && "TTI should not produce negative costs!");
581 TargetTransformInfo::getCostOfKeepingLiveOverCall(ArrayRef
<Type
*> Tys
) const {
582 return TTIImpl
->getCostOfKeepingLiveOverCall(Tys
);
585 bool TargetTransformInfo::getTgtMemIntrinsic(IntrinsicInst
*Inst
,
586 MemIntrinsicInfo
&Info
) const {
587 return TTIImpl
->getTgtMemIntrinsic(Inst
, Info
);
590 unsigned TargetTransformInfo::getAtomicMemIntrinsicMaxElementSize() const {
591 return TTIImpl
->getAtomicMemIntrinsicMaxElementSize();
594 Value
*TargetTransformInfo::getOrCreateResultFromMemIntrinsic(
595 IntrinsicInst
*Inst
, Type
*ExpectedType
) const {
596 return TTIImpl
->getOrCreateResultFromMemIntrinsic(Inst
, ExpectedType
);
599 Type
*TargetTransformInfo::getMemcpyLoopLoweringType(LLVMContext
&Context
,
602 unsigned DestAlign
) const {
603 return TTIImpl
->getMemcpyLoopLoweringType(Context
, Length
, SrcAlign
,
607 void TargetTransformInfo::getMemcpyLoopResidualLoweringType(
608 SmallVectorImpl
<Type
*> &OpsOut
, LLVMContext
&Context
,
609 unsigned RemainingBytes
, unsigned SrcAlign
, unsigned DestAlign
) const {
610 TTIImpl
->getMemcpyLoopResidualLoweringType(OpsOut
, Context
, RemainingBytes
,
611 SrcAlign
, DestAlign
);
614 bool TargetTransformInfo::areInlineCompatible(const Function
*Caller
,
615 const Function
*Callee
) const {
616 return TTIImpl
->areInlineCompatible(Caller
, Callee
);
619 bool TargetTransformInfo::isIndexedLoadLegal(MemIndexedMode Mode
,
621 return TTIImpl
->isIndexedLoadLegal(Mode
, Ty
);
624 bool TargetTransformInfo::isIndexedStoreLegal(MemIndexedMode Mode
,
626 return TTIImpl
->isIndexedStoreLegal(Mode
, Ty
);
629 unsigned TargetTransformInfo::getLoadStoreVecRegBitWidth(unsigned AS
) const {
630 return TTIImpl
->getLoadStoreVecRegBitWidth(AS
);
633 bool TargetTransformInfo::isLegalToVectorizeLoad(LoadInst
*LI
) const {
634 return TTIImpl
->isLegalToVectorizeLoad(LI
);
637 bool TargetTransformInfo::isLegalToVectorizeStore(StoreInst
*SI
) const {
638 return TTIImpl
->isLegalToVectorizeStore(SI
);
641 bool TargetTransformInfo::isLegalToVectorizeLoadChain(
642 unsigned ChainSizeInBytes
, unsigned Alignment
, unsigned AddrSpace
) const {
643 return TTIImpl
->isLegalToVectorizeLoadChain(ChainSizeInBytes
, Alignment
,
647 bool TargetTransformInfo::isLegalToVectorizeStoreChain(
648 unsigned ChainSizeInBytes
, unsigned Alignment
, unsigned AddrSpace
) const {
649 return TTIImpl
->isLegalToVectorizeStoreChain(ChainSizeInBytes
, Alignment
,
653 unsigned TargetTransformInfo::getLoadVectorFactor(unsigned VF
,
655 unsigned ChainSizeInBytes
,
656 VectorType
*VecTy
) const {
657 return TTIImpl
->getLoadVectorFactor(VF
, LoadSize
, ChainSizeInBytes
, VecTy
);
660 unsigned TargetTransformInfo::getStoreVectorFactor(unsigned VF
,
662 unsigned ChainSizeInBytes
,
663 VectorType
*VecTy
) const {
664 return TTIImpl
->getStoreVectorFactor(VF
, StoreSize
, ChainSizeInBytes
, VecTy
);
667 bool TargetTransformInfo::useReductionIntrinsic(unsigned Opcode
,
668 Type
*Ty
, ReductionFlags Flags
) const {
669 return TTIImpl
->useReductionIntrinsic(Opcode
, Ty
, Flags
);
672 bool TargetTransformInfo::shouldExpandReduction(const IntrinsicInst
*II
) const {
673 return TTIImpl
->shouldExpandReduction(II
);
676 int TargetTransformInfo::getInstructionLatency(const Instruction
*I
) const {
677 return TTIImpl
->getInstructionLatency(I
);
680 static bool matchPairwiseShuffleMask(ShuffleVectorInst
*SI
, bool IsLeft
,
682 // We don't need a shuffle if we just want to have element 0 in position 0 of
684 if (!SI
&& Level
== 0 && IsLeft
)
689 SmallVector
<int, 32> Mask(SI
->getType()->getVectorNumElements(), -1);
691 // Build a mask of 0, 2, ... (left) or 1, 3, ... (right) depending on whether
692 // we look at the left or right side.
693 for (unsigned i
= 0, e
= (1 << Level
), val
= !IsLeft
; i
!= e
; ++i
, val
+= 2)
696 SmallVector
<int, 16> ActualMask
= SI
->getShuffleMask();
697 return Mask
== ActualMask
;
701 /// Kind of the reduction data.
703 RK_None
, /// Not a reduction.
704 RK_Arithmetic
, /// Binary reduction data.
705 RK_MinMax
, /// Min/max reduction data.
706 RK_UnsignedMinMax
, /// Unsigned min/max reduction data.
708 /// Contains opcode + LHS/RHS parts of the reduction operations.
709 struct ReductionData
{
710 ReductionData() = delete;
711 ReductionData(ReductionKind Kind
, unsigned Opcode
, Value
*LHS
, Value
*RHS
)
712 : Opcode(Opcode
), LHS(LHS
), RHS(RHS
), Kind(Kind
) {
713 assert(Kind
!= RK_None
&& "expected binary or min/max reduction only.");
716 Value
*LHS
= nullptr;
717 Value
*RHS
= nullptr;
718 ReductionKind Kind
= RK_None
;
719 bool hasSameData(ReductionData
&RD
) const {
720 return Kind
== RD
.Kind
&& Opcode
== RD
.Opcode
;
725 static Optional
<ReductionData
> getReductionData(Instruction
*I
) {
727 if (m_BinOp(m_Value(L
), m_Value(R
)).match(I
))
728 return ReductionData(RK_Arithmetic
, I
->getOpcode(), L
, R
);
729 if (auto *SI
= dyn_cast
<SelectInst
>(I
)) {
730 if (m_SMin(m_Value(L
), m_Value(R
)).match(SI
) ||
731 m_SMax(m_Value(L
), m_Value(R
)).match(SI
) ||
732 m_OrdFMin(m_Value(L
), m_Value(R
)).match(SI
) ||
733 m_OrdFMax(m_Value(L
), m_Value(R
)).match(SI
) ||
734 m_UnordFMin(m_Value(L
), m_Value(R
)).match(SI
) ||
735 m_UnordFMax(m_Value(L
), m_Value(R
)).match(SI
)) {
736 auto *CI
= cast
<CmpInst
>(SI
->getCondition());
737 return ReductionData(RK_MinMax
, CI
->getOpcode(), L
, R
);
739 if (m_UMin(m_Value(L
), m_Value(R
)).match(SI
) ||
740 m_UMax(m_Value(L
), m_Value(R
)).match(SI
)) {
741 auto *CI
= cast
<CmpInst
>(SI
->getCondition());
742 return ReductionData(RK_UnsignedMinMax
, CI
->getOpcode(), L
, R
);
748 static ReductionKind
matchPairwiseReductionAtLevel(Instruction
*I
,
750 unsigned NumLevels
) {
751 // Match one level of pairwise operations.
752 // %rdx.shuf.0.0 = shufflevector <4 x float> %rdx, <4 x float> undef,
753 // <4 x i32> <i32 0, i32 2 , i32 undef, i32 undef>
754 // %rdx.shuf.0.1 = shufflevector <4 x float> %rdx, <4 x float> undef,
755 // <4 x i32> <i32 1, i32 3, i32 undef, i32 undef>
756 // %bin.rdx.0 = fadd <4 x float> %rdx.shuf.0.0, %rdx.shuf.0.1
760 assert(I
->getType()->isVectorTy() && "Expecting a vector type");
762 Optional
<ReductionData
> RD
= getReductionData(I
);
766 ShuffleVectorInst
*LS
= dyn_cast
<ShuffleVectorInst
>(RD
->LHS
);
769 ShuffleVectorInst
*RS
= dyn_cast
<ShuffleVectorInst
>(RD
->RHS
);
773 // On level 0 we can omit one shufflevector instruction.
774 if (!Level
&& !RS
&& !LS
)
777 // Shuffle inputs must match.
778 Value
*NextLevelOpL
= LS
? LS
->getOperand(0) : nullptr;
779 Value
*NextLevelOpR
= RS
? RS
->getOperand(0) : nullptr;
780 Value
*NextLevelOp
= nullptr;
781 if (NextLevelOpR
&& NextLevelOpL
) {
782 // If we have two shuffles their operands must match.
783 if (NextLevelOpL
!= NextLevelOpR
)
786 NextLevelOp
= NextLevelOpL
;
787 } else if (Level
== 0 && (NextLevelOpR
|| NextLevelOpL
)) {
788 // On the first level we can omit the shufflevector <0, undef,...>. So the
789 // input to the other shufflevector <1, undef> must match with one of the
790 // inputs to the current binary operation.
792 // %NextLevelOpL = shufflevector %R, <1, undef ...>
793 // %BinOp = fadd %NextLevelOpL, %R
794 if (NextLevelOpL
&& NextLevelOpL
!= RD
->RHS
)
796 else if (NextLevelOpR
&& NextLevelOpR
!= RD
->LHS
)
799 NextLevelOp
= NextLevelOpL
? RD
->RHS
: RD
->LHS
;
803 // Check that the next levels binary operation exists and matches with the
805 if (Level
+ 1 != NumLevels
) {
806 Optional
<ReductionData
> NextLevelRD
=
807 getReductionData(cast
<Instruction
>(NextLevelOp
));
808 if (!NextLevelRD
|| !RD
->hasSameData(*NextLevelRD
))
812 // Shuffle mask for pairwise operation must match.
813 if (matchPairwiseShuffleMask(LS
, /*IsLeft=*/true, Level
)) {
814 if (!matchPairwiseShuffleMask(RS
, /*IsLeft=*/false, Level
))
816 } else if (matchPairwiseShuffleMask(RS
, /*IsLeft=*/true, Level
)) {
817 if (!matchPairwiseShuffleMask(LS
, /*IsLeft=*/false, Level
))
823 if (++Level
== NumLevels
)
827 return matchPairwiseReductionAtLevel(cast
<Instruction
>(NextLevelOp
), Level
,
831 static ReductionKind
matchPairwiseReduction(const ExtractElementInst
*ReduxRoot
,
832 unsigned &Opcode
, Type
*&Ty
) {
833 if (!EnableReduxCost
)
836 // Need to extract the first element.
837 ConstantInt
*CI
= dyn_cast
<ConstantInt
>(ReduxRoot
->getOperand(1));
840 Idx
= CI
->getZExtValue();
844 auto *RdxStart
= dyn_cast
<Instruction
>(ReduxRoot
->getOperand(0));
847 Optional
<ReductionData
> RD
= getReductionData(RdxStart
);
851 Type
*VecTy
= RdxStart
->getType();
852 unsigned NumVecElems
= VecTy
->getVectorNumElements();
853 if (!isPowerOf2_32(NumVecElems
))
856 // We look for a sequence of shuffle,shuffle,add triples like the following
857 // that builds a pairwise reduction tree.
860 // (X0 + X1, X2 + X3, undef, undef)
861 // ((X0 + X1) + (X2 + X3), undef, undef, undef)
863 // %rdx.shuf.0.0 = shufflevector <4 x float> %rdx, <4 x float> undef,
864 // <4 x i32> <i32 0, i32 2 , i32 undef, i32 undef>
865 // %rdx.shuf.0.1 = shufflevector <4 x float> %rdx, <4 x float> undef,
866 // <4 x i32> <i32 1, i32 3, i32 undef, i32 undef>
867 // %bin.rdx.0 = fadd <4 x float> %rdx.shuf.0.0, %rdx.shuf.0.1
868 // %rdx.shuf.1.0 = shufflevector <4 x float> %bin.rdx.0, <4 x float> undef,
869 // <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>
870 // %rdx.shuf.1.1 = shufflevector <4 x float> %bin.rdx.0, <4 x float> undef,
871 // <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
872 // %bin.rdx8 = fadd <4 x float> %rdx.shuf.1.0, %rdx.shuf.1.1
873 // %r = extractelement <4 x float> %bin.rdx8, i32 0
874 if (matchPairwiseReductionAtLevel(RdxStart
, 0, Log2_32(NumVecElems
)) ==
884 static std::pair
<Value
*, ShuffleVectorInst
*>
885 getShuffleAndOtherOprd(Value
*L
, Value
*R
) {
886 ShuffleVectorInst
*S
= nullptr;
888 if ((S
= dyn_cast
<ShuffleVectorInst
>(L
)))
889 return std::make_pair(R
, S
);
891 S
= dyn_cast
<ShuffleVectorInst
>(R
);
892 return std::make_pair(L
, S
);
896 matchVectorSplittingReduction(const ExtractElementInst
*ReduxRoot
,
897 unsigned &Opcode
, Type
*&Ty
) {
898 if (!EnableReduxCost
)
901 // Need to extract the first element.
902 ConstantInt
*CI
= dyn_cast
<ConstantInt
>(ReduxRoot
->getOperand(1));
905 Idx
= CI
->getZExtValue();
909 auto *RdxStart
= dyn_cast
<Instruction
>(ReduxRoot
->getOperand(0));
912 Optional
<ReductionData
> RD
= getReductionData(RdxStart
);
916 Type
*VecTy
= ReduxRoot
->getOperand(0)->getType();
917 unsigned NumVecElems
= VecTy
->getVectorNumElements();
918 if (!isPowerOf2_32(NumVecElems
))
921 // We look for a sequence of shuffles and adds like the following matching one
922 // fadd, shuffle vector pair at a time.
924 // %rdx.shuf = shufflevector <4 x float> %rdx, <4 x float> undef,
925 // <4 x i32> <i32 2, i32 3, i32 undef, i32 undef>
926 // %bin.rdx = fadd <4 x float> %rdx, %rdx.shuf
927 // %rdx.shuf7 = shufflevector <4 x float> %bin.rdx, <4 x float> undef,
928 // <4 x i32> <i32 1, i32 undef, i32 undef, i32 undef>
929 // %bin.rdx8 = fadd <4 x float> %bin.rdx, %rdx.shuf7
930 // %r = extractelement <4 x float> %bin.rdx8, i32 0
932 unsigned MaskStart
= 1;
933 Instruction
*RdxOp
= RdxStart
;
934 SmallVector
<int, 32> ShuffleMask(NumVecElems
, 0);
935 unsigned NumVecElemsRemain
= NumVecElems
;
936 while (NumVecElemsRemain
- 1) {
937 // Check for the right reduction operation.
940 Optional
<ReductionData
> RDLevel
= getReductionData(RdxOp
);
941 if (!RDLevel
|| !RDLevel
->hasSameData(*RD
))
945 ShuffleVectorInst
*Shuffle
;
946 std::tie(NextRdxOp
, Shuffle
) =
947 getShuffleAndOtherOprd(RDLevel
->LHS
, RDLevel
->RHS
);
949 // Check the current reduction operation and the shuffle use the same value.
950 if (Shuffle
== nullptr)
952 if (Shuffle
->getOperand(0) != NextRdxOp
)
955 // Check that shuffle masks matches.
956 for (unsigned j
= 0; j
!= MaskStart
; ++j
)
957 ShuffleMask
[j
] = MaskStart
+ j
;
958 // Fill the rest of the mask with -1 for undef.
959 std::fill(&ShuffleMask
[MaskStart
], ShuffleMask
.end(), -1);
961 SmallVector
<int, 16> Mask
= Shuffle
->getShuffleMask();
962 if (ShuffleMask
!= Mask
)
965 RdxOp
= dyn_cast
<Instruction
>(NextRdxOp
);
966 NumVecElemsRemain
/= 2;
975 int TargetTransformInfo::getInstructionThroughput(const Instruction
*I
) const {
976 switch (I
->getOpcode()) {
977 case Instruction::GetElementPtr
:
978 return getUserCost(I
);
980 case Instruction::Ret
:
981 case Instruction::PHI
:
982 case Instruction::Br
: {
983 return getCFInstrCost(I
->getOpcode());
985 case Instruction::Add
:
986 case Instruction::FAdd
:
987 case Instruction::Sub
:
988 case Instruction::FSub
:
989 case Instruction::Mul
:
990 case Instruction::FMul
:
991 case Instruction::UDiv
:
992 case Instruction::SDiv
:
993 case Instruction::FDiv
:
994 case Instruction::URem
:
995 case Instruction::SRem
:
996 case Instruction::FRem
:
997 case Instruction::Shl
:
998 case Instruction::LShr
:
999 case Instruction::AShr
:
1000 case Instruction::And
:
1001 case Instruction::Or
:
1002 case Instruction::Xor
: {
1003 TargetTransformInfo::OperandValueKind Op1VK
, Op2VK
;
1004 TargetTransformInfo::OperandValueProperties Op1VP
, Op2VP
;
1005 Op1VK
= getOperandInfo(I
->getOperand(0), Op1VP
);
1006 Op2VK
= getOperandInfo(I
->getOperand(1), Op2VP
);
1007 SmallVector
<const Value
*, 2> Operands(I
->operand_values());
1008 return getArithmeticInstrCost(I
->getOpcode(), I
->getType(), Op1VK
, Op2VK
,
1009 Op1VP
, Op2VP
, Operands
);
1011 case Instruction::Select
: {
1012 const SelectInst
*SI
= cast
<SelectInst
>(I
);
1013 Type
*CondTy
= SI
->getCondition()->getType();
1014 return getCmpSelInstrCost(I
->getOpcode(), I
->getType(), CondTy
, I
);
1016 case Instruction::ICmp
:
1017 case Instruction::FCmp
: {
1018 Type
*ValTy
= I
->getOperand(0)->getType();
1019 return getCmpSelInstrCost(I
->getOpcode(), ValTy
, I
->getType(), I
);
1021 case Instruction::Store
: {
1022 const StoreInst
*SI
= cast
<StoreInst
>(I
);
1023 Type
*ValTy
= SI
->getValueOperand()->getType();
1024 return getMemoryOpCost(I
->getOpcode(), ValTy
,
1026 SI
->getPointerAddressSpace(), I
);
1028 case Instruction::Load
: {
1029 const LoadInst
*LI
= cast
<LoadInst
>(I
);
1030 return getMemoryOpCost(I
->getOpcode(), I
->getType(),
1032 LI
->getPointerAddressSpace(), I
);
1034 case Instruction::ZExt
:
1035 case Instruction::SExt
:
1036 case Instruction::FPToUI
:
1037 case Instruction::FPToSI
:
1038 case Instruction::FPExt
:
1039 case Instruction::PtrToInt
:
1040 case Instruction::IntToPtr
:
1041 case Instruction::SIToFP
:
1042 case Instruction::UIToFP
:
1043 case Instruction::Trunc
:
1044 case Instruction::FPTrunc
:
1045 case Instruction::BitCast
:
1046 case Instruction::AddrSpaceCast
: {
1047 Type
*SrcTy
= I
->getOperand(0)->getType();
1048 return getCastInstrCost(I
->getOpcode(), I
->getType(), SrcTy
, I
);
1050 case Instruction::ExtractElement
: {
1051 const ExtractElementInst
* EEI
= cast
<ExtractElementInst
>(I
);
1052 ConstantInt
*CI
= dyn_cast
<ConstantInt
>(I
->getOperand(1));
1055 Idx
= CI
->getZExtValue();
1057 // Try to match a reduction sequence (series of shufflevector and vector
1058 // adds followed by a extractelement).
1059 unsigned ReduxOpCode
;
1062 switch (matchVectorSplittingReduction(EEI
, ReduxOpCode
, ReduxType
)) {
1064 return getArithmeticReductionCost(ReduxOpCode
, ReduxType
,
1065 /*IsPairwiseForm=*/false);
1067 return getMinMaxReductionCost(
1068 ReduxType
, CmpInst::makeCmpResultType(ReduxType
),
1069 /*IsPairwiseForm=*/false, /*IsUnsigned=*/false);
1070 case RK_UnsignedMinMax
:
1071 return getMinMaxReductionCost(
1072 ReduxType
, CmpInst::makeCmpResultType(ReduxType
),
1073 /*IsPairwiseForm=*/false, /*IsUnsigned=*/true);
1078 switch (matchPairwiseReduction(EEI
, ReduxOpCode
, ReduxType
)) {
1080 return getArithmeticReductionCost(ReduxOpCode
, ReduxType
,
1081 /*IsPairwiseForm=*/true);
1083 return getMinMaxReductionCost(
1084 ReduxType
, CmpInst::makeCmpResultType(ReduxType
),
1085 /*IsPairwiseForm=*/true, /*IsUnsigned=*/false);
1086 case RK_UnsignedMinMax
:
1087 return getMinMaxReductionCost(
1088 ReduxType
, CmpInst::makeCmpResultType(ReduxType
),
1089 /*IsPairwiseForm=*/true, /*IsUnsigned=*/true);
1094 return getVectorInstrCost(I
->getOpcode(),
1095 EEI
->getOperand(0)->getType(), Idx
);
1097 case Instruction::InsertElement
: {
1098 const InsertElementInst
* IE
= cast
<InsertElementInst
>(I
);
1099 ConstantInt
*CI
= dyn_cast
<ConstantInt
>(IE
->getOperand(2));
1102 Idx
= CI
->getZExtValue();
1103 return getVectorInstrCost(I
->getOpcode(),
1104 IE
->getType(), Idx
);
1106 case Instruction::ShuffleVector
: {
1107 const ShuffleVectorInst
*Shuffle
= cast
<ShuffleVectorInst
>(I
);
1108 // TODO: Identify and add costs for insert/extract subvector, etc.
1109 if (Shuffle
->changesLength())
1112 if (Shuffle
->isIdentity())
1115 Type
*Ty
= Shuffle
->getType();
1116 if (Shuffle
->isReverse())
1117 return TTIImpl
->getShuffleCost(SK_Reverse
, Ty
, 0, nullptr);
1119 if (Shuffle
->isSelect())
1120 return TTIImpl
->getShuffleCost(SK_Select
, Ty
, 0, nullptr);
1122 if (Shuffle
->isTranspose())
1123 return TTIImpl
->getShuffleCost(SK_Transpose
, Ty
, 0, nullptr);
1125 if (Shuffle
->isZeroEltSplat())
1126 return TTIImpl
->getShuffleCost(SK_Broadcast
, Ty
, 0, nullptr);
1128 if (Shuffle
->isSingleSource())
1129 return TTIImpl
->getShuffleCost(SK_PermuteSingleSrc
, Ty
, 0, nullptr);
1131 return TTIImpl
->getShuffleCost(SK_PermuteTwoSrc
, Ty
, 0, nullptr);
1133 case Instruction::Call
:
1134 if (const IntrinsicInst
*II
= dyn_cast
<IntrinsicInst
>(I
)) {
1135 SmallVector
<Value
*, 4> Args(II
->arg_operands());
1138 if (auto *FPMO
= dyn_cast
<FPMathOperator
>(II
))
1139 FMF
= FPMO
->getFastMathFlags();
1141 return getIntrinsicInstrCost(II
->getIntrinsicID(), II
->getType(),
1146 // We don't have any information on this instruction.
1151 TargetTransformInfo::Concept::~Concept() {}
1153 TargetIRAnalysis::TargetIRAnalysis() : TTICallback(&getDefaultTTI
) {}
1155 TargetIRAnalysis::TargetIRAnalysis(
1156 std::function
<Result(const Function
&)> TTICallback
)
1157 : TTICallback(std::move(TTICallback
)) {}
1159 TargetIRAnalysis::Result
TargetIRAnalysis::run(const Function
&F
,
1160 FunctionAnalysisManager
&) {
1161 return TTICallback(F
);
1164 AnalysisKey
TargetIRAnalysis::Key
;
1166 TargetIRAnalysis::Result
TargetIRAnalysis::getDefaultTTI(const Function
&F
) {
1167 return Result(F
.getParent()->getDataLayout());
1170 // Register the basic pass.
1171 INITIALIZE_PASS(TargetTransformInfoWrapperPass
, "tti",
1172 "Target Transform Information", false, true)
1173 char TargetTransformInfoWrapperPass::ID
= 0;
1175 void TargetTransformInfoWrapperPass::anchor() {}
1177 TargetTransformInfoWrapperPass::TargetTransformInfoWrapperPass()
1178 : ImmutablePass(ID
) {
1179 initializeTargetTransformInfoWrapperPassPass(
1180 *PassRegistry::getPassRegistry());
1183 TargetTransformInfoWrapperPass::TargetTransformInfoWrapperPass(
1184 TargetIRAnalysis TIRA
)
1185 : ImmutablePass(ID
), TIRA(std::move(TIRA
)) {
1186 initializeTargetTransformInfoWrapperPassPass(
1187 *PassRegistry::getPassRegistry());
1190 TargetTransformInfo
&TargetTransformInfoWrapperPass::getTTI(const Function
&F
) {
1191 FunctionAnalysisManager DummyFAM
;
1192 TTI
= TIRA
.run(F
, DummyFAM
);
1197 llvm::createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA
) {
1198 return new TargetTransformInfoWrapperPass(std::move(TIRA
));