30#define DEBUG_TYPE "tti"
34 cl::desc(
"Recognize reduction patterns."));
38 cl::desc(
"Use this to override the target cache line size when "
39 "specified by the user."));
43 cl::desc(
"Use this to override the target's minimum page size."));
48 "Use this to override the target's predictable branch threshold (%)."));
62 std::unique_ptr<const TargetTransformInfoImplBase> Impl)
79 ScalarizationCost(ScalarizationCost), LibInfo(LibInfo) {
82 FMF = FPMO->getFastMathFlags();
87 ParamTys.insert(ParamTys.begin(), FTy->param_begin(), FTy->param_end());
95 : II(
I), RetTy(RTy), IID(Id), FMF(Flags), ScalarizationCost(ScalarCost) {
96 ParamTys.insert(ParamTys.begin(), Tys.
begin(), Tys.
end());
101 : RetTy(Ty), IID(Id) {
103 Arguments.insert(Arguments.begin(), Args.begin(), Args.end());
104 ParamTys.reserve(Arguments.size());
113 : II(
I), RetTy(RTy), IID(Id), FMF(Flags), ScalarizationCost(ScalarCost),
115 ParamTys.insert(ParamTys.begin(), Tys.
begin(), Tys.
end());
116 Arguments.insert(Arguments.begin(), Args.begin(), Args.end());
132 L->getExitingBlocks(ExitingBlocks);
137 if (!
L->isLoopLatch(BB)) {
146 if (ConstEC->getValue()->isZero())
167 bool NotAlways =
false;
169 if (!
L->contains(Pred))
187 if (!BI->isConditional())
207 : TTIImpl(
std::make_unique<NoTTIImpl>(
DL)) {}
212 : TTIImpl(
std::
move(Arg.TTIImpl)) {}
215 TTIImpl = std::move(RHS.TTIImpl);
220 return TTIImpl->getInliningThresholdMultiplier();
225 return TTIImpl->getInliningCostBenefitAnalysisSavingsMultiplier();
231 return TTIImpl->getInliningCostBenefitAnalysisProfitableMultiplier();
235 return TTIImpl->getInliningLastCallToStaticBonus();
240 return TTIImpl->adjustInliningThreshold(CB);
245 return TTIImpl->getCallerAllocaCost(CB, AI);
249 return TTIImpl->getInlinerVectorBonusPercent();
255 return TTIImpl->getGEPCost(PointeeType, Ptr, Operands, AccessType,
CostKind);
263 "If pointers have same base address it has to be provided.");
264 return TTIImpl->getPointersChainCost(Ptrs,
Base, Info, AccessTy,
CostKind);
270 return TTIImpl->getEstimatedNumberOfCaseClusters(
SI, JTSize, PSI, BFI);
279 "TTI should not produce negative costs!");
286 : TTIImpl->getPredictableBranchThreshold();
290 return TTIImpl->getBranchMispredictPenalty();
294 return TTIImpl->hasBranchDivergence(
F);
301 if (
Call->hasFnAttr(Attribute::NoDivergenceSource))
304 return TTIImpl->getInstructionUniformity(V);
308 unsigned ToAS)
const {
309 return TTIImpl->isValidAddrSpaceCast(FromAS, ToAS);
313 unsigned ToAS)
const {
314 return TTIImpl->addrspacesMayAlias(FromAS, ToAS);
318 return TTIImpl->getFlatAddressSpace();
323 return TTIImpl->collectFlatAddressOperands(OpIndexes, IID);
327 unsigned ToAS)
const {
328 return TTIImpl->isNoopAddrSpaceCast(FromAS, ToAS);
331std::pair<KnownBits, KnownBits>
333 const Value &PtrOp)
const {
334 return TTIImpl->computeKnownBitsAddrSpaceCast(ToAS, PtrOp);
338 unsigned FromAS,
unsigned ToAS,
const KnownBits &FromPtrBits)
const {
339 return TTIImpl->computeKnownBitsAddrSpaceCast(FromAS, ToAS, FromPtrBits);
344 return TTIImpl->canHaveNonUndefGlobalInitializerInAddressSpace(AS);
348 return TTIImpl->getAssumedAddrSpace(V);
352 return TTIImpl->isSingleThreaded();
355std::pair<const Value *, unsigned>
357 return TTIImpl->getPredicatedAddrSpace(V);
362 return TTIImpl->rewriteIntrinsicWithAddressSpace(
II, OldV, NewV);
366 return TTIImpl->isLoweredToCall(
F);
372 return TTIImpl->isHardwareLoopProfitable(L, SE, AC, LibInfo, HWLoopInfo);
376 return TTIImpl->getEpilogueVectorizationMinVF();
381 return TTIImpl->preferPredicateOverEpilogue(TFI);
385 bool IVUpdateMayOverflow)
const {
386 return TTIImpl->getPreferredTailFoldingStyle(IVUpdateMayOverflow);
389std::optional<Instruction *>
392 return TTIImpl->instCombineIntrinsic(IC,
II);
397 bool &KnownBitsComputed)
const {
398 return TTIImpl->simplifyDemandedUseBitsIntrinsic(IC,
II, DemandedMask, Known,
406 SimplifyAndSetOp)
const {
407 return TTIImpl->simplifyDemandedVectorEltsIntrinsic(
408 IC,
II, DemandedElts, UndefElts, UndefElts2, UndefElts3,
415 return TTIImpl->getUnrollingPreferences(L, SE, UP, ORE);
420 return TTIImpl->getPeelingPreferences(L, SE, PP);
424 return TTIImpl->isLegalAddImmediate(Imm);
428 return TTIImpl->isLegalAddScalableImmediate(Imm);
432 return TTIImpl->isLegalICmpImmediate(Imm);
437 bool HasBaseReg, int64_t Scale,
440 int64_t ScalableOffset)
const {
441 return TTIImpl->isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg,
442 Scale, AddrSpace,
I, ScalableOffset);
447 return TTIImpl->isLSRCostLess(C1, C2);
451 return TTIImpl->isNumRegsMajorCostOfLSR();
455 return TTIImpl->shouldDropLSRSolutionIfLessProfitable();
459 return TTIImpl->isProfitableLSRChainElement(
I);
463 return TTIImpl->canMacroFuseCmp();
470 return TTIImpl->canSaveCmp(L, BI, SE, LI, DT, AC, LibInfo);
476 return TTIImpl->getPreferredAddressingMode(L, SE);
482 return TTIImpl->isLegalMaskedStore(DataType, Alignment,
AddressSpace,
489 return TTIImpl->isLegalMaskedLoad(DataType, Alignment,
AddressSpace,
494 Align Alignment)
const {
495 return TTIImpl->isLegalNTStore(DataType, Alignment);
499 return TTIImpl->isLegalNTLoad(DataType, Alignment);
504 return TTIImpl->isLegalBroadcastLoad(ElementTy, NumElements);
508 Align Alignment)
const {
509 return TTIImpl->isLegalMaskedGather(DataType, Alignment);
513 VectorType *VecTy,
unsigned Opcode0,
unsigned Opcode1,
515 return TTIImpl->isLegalAltInstr(VecTy, Opcode0, Opcode1, OpcodeMask);
519 Align Alignment)
const {
520 return TTIImpl->isLegalMaskedScatter(DataType, Alignment);
524 Align Alignment)
const {
525 return TTIImpl->forceScalarizeMaskedGather(DataType, Alignment);
529 Align Alignment)
const {
530 return TTIImpl->forceScalarizeMaskedScatter(DataType, Alignment);
534 Align Alignment)
const {
535 return TTIImpl->isLegalMaskedCompressStore(DataType, Alignment);
539 Align Alignment)
const {
540 return TTIImpl->isLegalMaskedExpandLoad(DataType, Alignment);
544 Align Alignment)
const {
545 return TTIImpl->isLegalStridedLoadStore(DataType, Alignment);
550 unsigned AddrSpace)
const {
551 return TTIImpl->isLegalInterleavedAccessType(VTy, Factor, Alignment,
556 Type *DataType)
const {
557 return TTIImpl->isLegalMaskedVectorHistogram(AddrType, DataType);
561 return TTIImpl->enableOrderedReductions();
565 return TTIImpl->hasDivRemOp(DataType, IsSigned);
569 unsigned AddrSpace)
const {
570 return TTIImpl->hasVolatileVariant(
I, AddrSpace);
574 return TTIImpl->prefersVectorizedAddressing();
579 int64_t Scale,
unsigned AddrSpace)
const {
581 Ty, BaseGV, BaseOffset, HasBaseReg, Scale, AddrSpace);
582 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
587 return TTIImpl->LSRWithInstrQueries();
591 return TTIImpl->isTruncateFree(Ty1, Ty2);
595 return TTIImpl->isProfitableToHoist(
I);
601 return TTIImpl->isTypeLegal(Ty);
605 return TTIImpl->getRegUsageForType(Ty);
609 return TTIImpl->shouldBuildLookupTables();
614 return TTIImpl->shouldBuildLookupTablesForConstant(
C);
618 return TTIImpl->shouldBuildRelLookupTables();
622 return TTIImpl->useColdCCForColdCall(
F);
626 return TTIImpl->useFastCCForInternalCall(
F);
631 return TTIImpl->isTargetIntrinsicTriviallyScalarizable(
ID);
636 return TTIImpl->isTargetIntrinsicWithScalarOpAtArg(
ID, ScalarOpdIdx);
641 return TTIImpl->isTargetIntrinsicWithOverloadTypeAtArg(
ID, OpdIdx);
646 return TTIImpl->isTargetIntrinsicWithStructReturnOverloadAtField(
ID, RetIdx);
653 return TTIImpl->getScalarizationOverhead(Ty, DemandedElts, Insert, Extract,
659 return TTIImpl->getOperandsScalarizationOverhead(Tys,
CostKind);
663 return TTIImpl->supportsEfficientVectorElementLoadStore();
667 return TTIImpl->supportsTailCalls();
671 return TTIImpl->supportsTailCallFor(CB);
675 bool LoopHasReductions)
const {
676 return TTIImpl->enableAggressiveInterleaving(LoopHasReductions);
681 return TTIImpl->enableMemCmpExpansion(OptSize, IsZeroCmp);
685 return TTIImpl->enableSelectOptimize();
690 return TTIImpl->shouldTreatInstructionLikeSelect(
I);
694 return TTIImpl->enableInterleavedAccessVectorization();
698 return TTIImpl->enableMaskedInterleavedAccessVectorization();
702 return TTIImpl->isFPVectorizationPotentiallyUnsafe();
710 unsigned *
Fast)
const {
711 return TTIImpl->allowsMisalignedMemoryAccesses(Context,
BitWidth,
717 return TTIImpl->getPopcntSupport(IntTyWidthInBit);
721 return TTIImpl->haveFastSqrt(Ty);
726 return TTIImpl->isExpensiveToSpeculativelyExecute(
I);
730 return TTIImpl->isFCmpOrdCheaperThanFCmpZero(Ty);
735 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
744 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
752 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
757 unsigned Opcode,
unsigned Idx,
const APInt &Imm,
Type *Ty,
760 TTIImpl->getIntImmCostInst(Opcode, Idx, Imm, Ty,
CostKind, Inst);
761 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
770 TTIImpl->getIntImmCostIntrin(IID, Idx, Imm, Ty,
CostKind);
771 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
777 return TTIImpl->preferToKeepConstantsAttached(Inst, Fn);
781 return TTIImpl->getNumberOfRegisters(ClassID);
785 bool IsStore)
const {
786 return TTIImpl->hasConditionalLoadStoreForType(Ty, IsStore);
791 return TTIImpl->getRegisterClassForType(
Vector, Ty);
795 return TTIImpl->getRegisterClassName(ClassID);
800 return TTIImpl->getRegisterBitWidth(K);
804 return TTIImpl->getMinVectorRegisterBitWidth();
808 return TTIImpl->getMaxVScale();
812 return TTIImpl->getVScaleForTuning();
816 return TTIImpl->isVScaleKnownToBeAPowerOfTwo();
821 return TTIImpl->shouldMaximizeVectorBandwidth(K);
825 bool IsScalable)
const {
826 return TTIImpl->getMinimumVF(ElemWidth, IsScalable);
830 unsigned Opcode)
const {
831 return TTIImpl->getMaximumVF(ElemWidth, Opcode);
835 Type *ScalarValTy)
const {
836 return TTIImpl->getStoreMinimumVF(VF, ScalarMemTy, ScalarValTy);
840 const Instruction &
I,
bool &AllowPromotionWithoutCommonHeader)
const {
841 return TTIImpl->shouldConsiderAddressTypePromotion(
842 I, AllowPromotionWithoutCommonHeader);
847 : TTIImpl->getCacheLineSize();
850std::optional<unsigned>
852 return TTIImpl->getCacheSize(Level);
855std::optional<unsigned>
857 return TTIImpl->getCacheAssociativity(Level);
862 : TTIImpl->getMinPageSize();
866 return TTIImpl->getPrefetchDistance();
870 unsigned NumMemAccesses,
unsigned NumStridedMemAccesses,
871 unsigned NumPrefetches,
bool HasCall)
const {
872 return TTIImpl->getMinPrefetchStride(NumMemAccesses, NumStridedMemAccesses,
873 NumPrefetches, HasCall);
877 return TTIImpl->getMaxPrefetchIterationsAhead();
881 return TTIImpl->enableWritePrefetching();
885 return TTIImpl->shouldPrefetchAddressSpace(AS);
889 unsigned Opcode,
Type *InputTypeA,
Type *InputTypeB,
Type *AccumType,
893 return TTIImpl->getPartialReductionCost(Opcode, InputTypeA, InputTypeB,
894 AccumType, VF, OpAExtend, OpBExtend,
899 return TTIImpl->getMaxInterleaveFactor(VF);
913 if (CI->getValue().isPowerOf2())
915 else if (CI->getValue().isNegatedPowerOf2())
925 if (ShuffleInst->isZeroEltSplat())
940 if (CI->getValue().isPowerOf2())
942 else if (CI->getValue().isNegatedPowerOf2())
948 bool AllPow2 =
true, AllNegPow2 =
true;
949 for (
uint64_t I = 0, E = CDS->getNumElements();
I != E; ++
I) {
951 AllPow2 &= CI->getValue().isPowerOf2();
952 AllNegPow2 &= CI->getValue().isNegatedPowerOf2();
953 if (AllPow2 || AllNegPow2)
956 AllPow2 = AllNegPow2 =
false;
965 return {OpInfo, OpProps};
977 if (TLibInfo && Opcode == Instruction::FRem) {
981 TLibInfo->
getLibFunc(Instruction::FRem, Ty->getScalarType(), Func) &&
988 TTIImpl->getArithmeticInstrCost(Opcode, Ty,
CostKind,
991 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
996 VectorType *VecTy,
unsigned Opcode0,
unsigned Opcode1,
999 TTIImpl->getAltInstrCost(VecTy, Opcode0, Opcode1, OpcodeMask,
CostKind);
1000 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1010 "Expected the Mask to match the return size if given");
1012 "Expected the same scalar types");
1014 Kind, DstTy, SrcTy, Mask,
CostKind, Index, SubTp, Args, CxtI);
1015 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1030 case Instruction::CastOps::ZExt:
1032 case Instruction::CastOps::SExt:
1045 auto getLoadStoreKind = [](
const Value *V,
unsigned LdStOp,
unsigned MaskedOp,
1046 unsigned GatScatOp) {
1051 if (
I->getOpcode() == LdStOp)
1055 if (
II->getIntrinsicID() == MaskedOp)
1057 if (
II->getIntrinsicID() == GatScatOp)
1064 switch (
I->getOpcode()) {
1065 case Instruction::ZExt:
1066 case Instruction::SExt:
1067 case Instruction::FPExt:
1068 return getLoadStoreKind(
I->getOperand(0), Instruction::Load,
1069 Intrinsic::masked_load, Intrinsic::masked_gather);
1070 case Instruction::Trunc:
1071 case Instruction::FPTrunc:
1073 return getLoadStoreKind(*
I->user_begin(), Instruction::Store,
1074 Intrinsic::masked_store,
1075 Intrinsic::masked_scatter);
1087 assert((
I ==
nullptr ||
I->getOpcode() == Opcode) &&
1088 "Opcode should reflect passed instruction.");
1090 TTIImpl->getCastInstrCost(Opcode, Dst, Src, CCH,
CostKind,
I);
1091 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1099 TTIImpl->getExtractWithExtendCost(Opcode, Dst, VecTy, Index,
CostKind);
1100 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1106 assert((
I ==
nullptr ||
I->getOpcode() == Opcode) &&
1107 "Opcode should reflect passed instruction.");
1109 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1117 assert((
I ==
nullptr ||
I->getOpcode() == Opcode) &&
1118 "Opcode should reflect passed instruction.");
1120 Opcode, ValTy, CondTy, VecPred,
CostKind, Op1Info, Op2Info,
I);
1121 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1128 assert((Opcode == Instruction::InsertElement ||
1129 Opcode == Instruction::ExtractElement) &&
1130 "Expecting Opcode to be insertelement/extractelement.");
1132 TTIImpl->getVectorInstrCost(Opcode, Val,
CostKind, Index, Op0, Op1);
1133 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1140 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx)
const {
1141 assert((Opcode == Instruction::InsertElement ||
1142 Opcode == Instruction::ExtractElement) &&
1143 "Expecting Opcode to be insertelement/extractelement.");
1145 Opcode, Val,
CostKind, Index, Scalar, ScalarUserAndIdx);
1146 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1153 unsigned Index)
const {
1158 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1164 unsigned Index)
const {
1166 TTIImpl->getIndexedVectorInstrCostFromEnd(Opcode, Val,
CostKind, Index);
1167 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1173 assert((Opcode == Instruction::InsertValue ||
1174 Opcode == Instruction::ExtractValue) &&
1175 "Expecting Opcode to be insertvalue/extractvalue.");
1177 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1182 Type *EltTy,
int ReplicationFactor,
int VF,
const APInt &DemandedDstElts,
1185 EltTy, ReplicationFactor, VF, DemandedDstElts,
CostKind);
1186 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1194 assert((
I ==
nullptr ||
I->getOpcode() == Opcode) &&
1195 "Opcode should reflect passed instruction.");
1198 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1205 bool UseMaskForCond,
bool UseMaskForGaps)
const {
1208 UseMaskForCond, UseMaskForGaps);
1209 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1217 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1225 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1234 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1239 return TTIImpl->getNumberOfParts(Tp);
1246 TTIImpl->getAddressComputationCost(PtrTy, SE, Ptr,
CostKind);
1247 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1253 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1258 return TTIImpl->getMaxMemIntrinsicInlineSizeThreshold();
1262 unsigned Opcode,
VectorType *Ty, std::optional<FastMathFlags> FMF,
1265 TTIImpl->getArithmeticReductionCost(Opcode, Ty, FMF,
CostKind);
1266 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1274 TTIImpl->getMinMaxReductionCost(IID, Ty, FMF,
CostKind);
1275 assert(
Cost >= 0 &&
"TTI should not produce negative costs!");
1282 return TTIImpl->getExtendedReductionCost(Opcode, IsUnsigned, ResTy, Ty, FMF,
1287 bool IsUnsigned,
unsigned RedOpcode,
Type *ResTy,
VectorType *Ty,
1289 return TTIImpl->getMulAccReductionCost(IsUnsigned, RedOpcode, ResTy, Ty,
1295 return TTIImpl->getCostOfKeepingLiveOverCall(Tys);
1300 return TTIImpl->getTgtMemIntrinsic(Inst, Info);
1304 return TTIImpl->getAtomicMemIntrinsicMaxElementSize();
1309 return TTIImpl->getOrCreateResultFromMemIntrinsic(Inst, ExpectedType,
1315 unsigned DestAddrSpace,
Align SrcAlign,
Align DestAlign,
1316 std::optional<uint32_t> AtomicElementSize)
const {
1317 return TTIImpl->getMemcpyLoopLoweringType(Context,
Length, SrcAddrSpace,
1318 DestAddrSpace, SrcAlign, DestAlign,
1324 unsigned RemainingBytes,
unsigned SrcAddrSpace,
unsigned DestAddrSpace,
1326 std::optional<uint32_t> AtomicCpySize)
const {
1327 TTIImpl->getMemcpyLoopResidualLoweringType(
1328 OpsOut, Context, RemainingBytes, SrcAddrSpace, DestAddrSpace, SrcAlign,
1329 DestAlign, AtomicCpySize);
1334 return TTIImpl->areInlineCompatible(Caller, Callee);
1340 unsigned DefaultCallPenalty)
const {
1341 return TTIImpl->getInlineCallPenalty(
F,
Call, DefaultCallPenalty);
1347 return TTIImpl->areTypesABICompatible(Caller, Callee, Types);
1352 return TTIImpl->isIndexedLoadLegal(Mode, Ty);
1357 return TTIImpl->isIndexedStoreLegal(Mode, Ty);
1361 return TTIImpl->getLoadStoreVecRegBitWidth(AS);
1365 return TTIImpl->isLegalToVectorizeLoad(LI);
1369 return TTIImpl->isLegalToVectorizeStore(
SI);
1373 unsigned ChainSizeInBytes,
Align Alignment,
unsigned AddrSpace)
const {
1374 return TTIImpl->isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
1379 unsigned ChainSizeInBytes,
Align Alignment,
unsigned AddrSpace)
const {
1380 return TTIImpl->isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
1386 return TTIImpl->isLegalToVectorizeReduction(RdxDesc, VF);
1390 return TTIImpl->isElementTypeLegalForScalableVector(Ty);
1395 unsigned ChainSizeInBytes,
1397 return TTIImpl->getLoadVectorFactor(VF, LoadSize, ChainSizeInBytes, VecTy);
1402 unsigned ChainSizeInBytes,
1404 return TTIImpl->getStoreVectorFactor(VF, StoreSize, ChainSizeInBytes, VecTy);
1408 bool IsEpilogue)
const {
1409 return TTIImpl->preferFixedOverScalableIfEqualCost(IsEpilogue);
1414 return TTIImpl->preferInLoopReduction(Kind, Ty);
1418 return TTIImpl->preferAlternateOpcodeVectorization();
1422 return TTIImpl->preferPredicatedReductionSelect();
1426 return TTIImpl->preferEpilogueVectorization();
1430 return TTIImpl->shouldConsiderVectorizationRegPressure();
1435 return TTIImpl->getVPLegalizationStrategy(VPI);
1439 return TTIImpl->hasArmWideBranch(Thumb);
1443 return TTIImpl->getFeatureMask(
F);
1447 return TTIImpl->getPriorityMask(
F);
1451 return TTIImpl->isMultiversionedFunction(
F);
1455 return TTIImpl->getMaxNumArgs();
1459 return TTIImpl->shouldExpandReduction(
II);
1465 return TTIImpl->getPreferredExpandedReductionShuffle(
II);
1469 return TTIImpl->getGISelRematGlobalCost();
1473 return TTIImpl->getMinTripCountTailFoldingThreshold();
1477 return TTIImpl->supportsScalableVectors();
1481 return TTIImpl->enableScalableVectorization();
1485 return TTIImpl->hasActiveVectorLength();
1490 return TTIImpl->isProfitableToSinkOperands(
I, OpsToSink);
1494 return TTIImpl->isVectorShiftByScalarCheap(Ty);
1500 return TTIImpl->getNumBytesToPadGlobalArray(
Size,
ArrayType);
1506 return TTIImpl->collectKernelLaunchBounds(
F, LB);
1510 return TTIImpl->allowVectorElementIndexingUsingGEP();
1519 : TTICallback(
std::
move(TTICallback)) {}
1523 assert(!
F.isIntrinsic() &&
"Should not request TTI for intrinsics");
1524 return TTICallback(
F);
1530 return Result(
F.getDataLayout());
1535 "Target Transform Information",
false,
true)
1549 TTI = TIRA.run(
F, DummyFAM);
for(const MachineOperand &MO :llvm::drop_begin(OldMI.operands(), Desc.getNumOperands()))
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
static cl::opt< bool > ForceNestedLoop("force-nested-hardware-loop", cl::Hidden, cl::init(false), cl::desc("Force allowance of nested hardware loops"))
static cl::opt< bool > ForceHardwareLoopPHI("force-hardware-loop-phi", cl::Hidden, cl::init(false), cl::desc("Force hardware loop counter to be updated through a phi"))
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
Module.h This file contains the declarations for the Module class.
uint64_t IntrinsicInst * II
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
This file defines the SmallVector class.
static SymbolRef::Type getType(const Symbol *Sym)
Class for arbitrary precision integers.
an instruction to allocate memory on the stack
This class represents an incoming formal argument to a Function.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Class to represent array types.
A cache of @llvm.assume calls within a function.
LLVM Basic Block Representation.
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Conditional or Unconditional Branch instruction.
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Function * getCalledFunction() const
Returns the function called, or null if this is an indirect function invocation or the function signa...
User::op_iterator arg_begin()
Return the iterator pointing to the beginning of the argument list.
User::op_iterator arg_end()
Return the iterator pointing to the end of the argument list.
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
This is an important base class in LLVM.
A parsed version of the target data layout string in and methods for querying it.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
LLVM_ABI bool dominates(const BasicBlock *BB, const Use &U) const
Return true if the (end of the) basic block BB dominates the use U.
Convenience struct for specifying and reasoning about fast-math flags.
Class to represent function types.
FunctionType * getFunctionType() const
Returns the FunctionType for me.
ImmutablePass class - This class is used to provide information that does not need to be run.
The core instruction combiner logic.
LLVM_ABI IntrinsicCostAttributes(Intrinsic::ID Id, const CallBase &CI, InstructionCost ScalarCost=InstructionCost::getInvalid(), bool TypeBasedOnly=false, TargetLibraryInfo const *LibInfo=nullptr)
A wrapper class for inspecting calls to intrinsic functions.
This is an important class for using LLVM in a threaded context.
An instruction for reading from memory.
Wrapper class to LoopBlocksDFS that provides a standard begin()/end() interface for the DFS reverse p...
void perform(const LoopInfo *LI)
Traverse the loop blocks and store the DFS result.
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
Represents a single loop in the control flow graph.
Information for memory intrinsic cost model.
Analysis providing profile information.
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
This class represents a constant integer value.
This class represents an analyzed expression in the program.
The main scalar evolution driver.
LLVM_ABI uint64_t getTypeSizeInBits(Type *Ty) const
Return the size in bits of the specified type, for which isSCEVable must return true.
LLVM_ABI bool isLoopInvariant(const SCEV *S, const Loop *L)
Return true if the value of the given SCEV is unchanging in the specified loop.
LLVM_ABI const SCEV * getExitCount(const Loop *L, const BasicBlock *ExitingBlock, ExitCountKind Kind=Exact)
Return the number of times the backedge executes before the given exit would be taken; if not exactly...
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
StackOffset holds a fixed and a scalable offset in bytes.
An instruction for storing to memory.
Analysis pass providing the TargetTransformInfo.
LLVM_ABI Result run(const Function &F, FunctionAnalysisManager &)
TargetTransformInfo Result
LLVM_ABI TargetIRAnalysis()
Default construct a target IR analysis.
Provides information about what library functions are available for the current target.
bool getLibFunc(StringRef funcName, LibFunc &F) const
Searches for a particular function name.
StringRef getName(LibFunc F) const
bool isFunctionVectorizable(StringRef F, const ElementCount &VF) const
The instances of the Type class are immutable: once they are created, they are never changed.
LLVM_ABI bool isScalableTy(SmallPtrSetImpl< const Type * > &Visited) const
Return true if this is a type whose size is a known multiple of vscale.
static LLVM_ABI IntegerType * getInt32Ty(LLVMContext &C)
Type * getScalarType() const
If this is a vector type, return the element type, otherwise return 'this'.
This is the common base class for vector predication intrinsics.
LLVM Value Representation.
Type * getType() const
All values are typed, get the type of this value.
Base class of all SIMD vector types.
ElementCount getElementCount() const
Return an ElementCount instance to represent the (possibly scalable) number of elements in the vector...
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
#define llvm_unreachable(msg)
Marks that the current location is not supposed to be reachable.
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
@ Fast
Attempts to make calls as fast as possible (e.g.
@ C
The default llvm calling convention, compatible with C.
initializer< Ty > init(const Ty &Val)
This is an optimization pass for GlobalISel generic memory operations.
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
LLVM_ABI Value * getSplatValue(const Value *V)
Get splat value if the input is a splat vector or return nullptr.
bool containsIrreducibleCFG(RPOTraversalT &RPOTraversal, const LoopInfoT &LI)
Return true if the control flow in RPOTraversal is irreducible.
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
LLVM_ABI ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
RecurKind
These are the kinds of recurrences that we support.
constexpr unsigned BitWidth
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
auto predecessors(const MachineBasicBlock *BB)
AnalysisManager< Function > FunctionAnalysisManager
Convenience typedef for the Function analysis manager.
InstructionUniformity
Enum describing how instructions behave with respect to uniformity and divergence,...
@ AlwaysUniform
The result values are always uniform.
Implement std::hash so that hash_code can be used in STL containers.
This struct is a compact representation of a valid (non-zero power of two) alignment.
A special type used by analysis passes to provide an address that identifies that particular analysis...
Attributes of a target dependent hardware loop.
LLVM_ABI bool canAnalyze(LoopInfo &LI)
HardwareLoopInfo()=delete
LLVM_ABI bool isHardwareLoopCandidate(ScalarEvolution &SE, LoopInfo &LI, DominatorTree &DT, bool ForceNestedLoop=false, bool ForceHardwareLoopPHI=false)
Information about a load/store intrinsic defined by the target.