25 #define DEBUG_TYPE "tti"
28 "use-wide-memcpy-loop-lowering",
cl::init(
false),
29 cl::desc(
"Enables the new wide memcpy loop lowering in Transforms/Utils."),
44 : TTIImpl(new
Model<NoTTIImpl>(NoTTIImpl(DL))) {}
49 : TTIImpl(std::move(Arg.TTIImpl)) {}
52 TTIImpl = std::move(RHS.TTIImpl);
58 int Cost = TTIImpl->getOperationCost(Opcode, Ty, OpTy);
59 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
64 int Cost = TTIImpl->getCallCost(FTy, NumArgs);
65 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
71 int Cost = TTIImpl->getCallCost(F, Arguments);
72 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
77 return TTIImpl->getInliningThresholdMultiplier();
82 return TTIImpl->getGEPCost(PointeeType, Ptr, Operands);
86 const Value *Src)
const {
87 return TTIImpl->getExtCost(I, Src);
92 int Cost = TTIImpl->getIntrinsicCost(IID, RetTy, Arguments);
93 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
99 unsigned &JTSize)
const {
100 return TTIImpl->getEstimatedNumberOfCaseClusters(SI, JTSize);
105 int Cost = TTIImpl->getUserCost(U, Operands);
106 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
111 return TTIImpl->hasBranchDivergence();
115 return TTIImpl->isSourceOfDivergence(V);
119 return TTIImpl->isAlwaysUniform(V);
123 return TTIImpl->getFlatAddressSpace();
127 return TTIImpl->isLoweredToCall(F);
132 return TTIImpl->getUnrollingPreferences(L, SE, UP);
136 return TTIImpl->isLegalAddImmediate(Imm);
140 return TTIImpl->isLegalICmpImmediate(Imm);
147 unsigned AddrSpace)
const {
148 return TTIImpl->isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg,
153 return TTIImpl->isLSRCostLess(C1, C2);
157 return TTIImpl->isLegalMaskedStore(DataType);
161 return TTIImpl->isLegalMaskedLoad(DataType);
165 return TTIImpl->isLegalMaskedGather(DataType);
169 return TTIImpl->isLegalMaskedGather(DataType);
173 return TTIImpl->prefersVectorizedAddressing();
180 unsigned AddrSpace)
const {
181 int Cost = TTIImpl->getScalingFactorCost(Ty, BaseGV, BaseOffset, HasBaseReg,
183 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
189 return TTIImpl->isFoldableMemAccessOffset(I, Offset);
193 return TTIImpl->isTruncateFree(Ty1, Ty2);
197 return TTIImpl->isProfitableToHoist(I);
201 return TTIImpl->isTypeLegal(Ty);
205 return TTIImpl->getJumpBufAlignment();
209 return TTIImpl->getJumpBufSize();
213 return TTIImpl->shouldBuildLookupTables();
216 return TTIImpl->shouldBuildLookupTablesForConstant(C);
221 return TTIImpl->getScalarizationOverhead(Ty, Insert, Extract);
227 return TTIImpl->getOperandsScalarizationOverhead(Args, VF);
231 return TTIImpl->supportsEfficientVectorElementLoadStore();
235 return TTIImpl->enableAggressiveInterleaving(LoopHasReductions);
239 return TTIImpl->expandMemCmp(I, MaxLoadSize);
243 return TTIImpl->enableInterleavedAccessVectorization();
247 return TTIImpl->isFPVectorizationPotentiallyUnsafe();
255 return TTIImpl->allowsMisalignedMemoryAccesses(Context, BitWidth, AddressSpace,
261 return TTIImpl->getPopcntSupport(IntTyWidthInBit);
265 return TTIImpl->haveFastSqrt(Ty);
269 int Cost = TTIImpl->getFPOpCost(Ty);
270 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
277 int Cost = TTIImpl->getIntImmCodeSizeCost(Opcode, Idx, Imm, Ty);
278 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
283 int Cost = TTIImpl->getIntImmCost(Imm, Ty);
284 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
290 int Cost = TTIImpl->getIntImmCost(Opcode, Idx, Imm, Ty);
291 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
297 int Cost = TTIImpl->getIntImmCost(IID, Idx, Imm, Ty);
298 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
303 return TTIImpl->getNumberOfRegisters(Vector);
307 return TTIImpl->getRegisterBitWidth(Vector);
311 return TTIImpl->getMinVectorRegisterBitWidth();
315 const Instruction &
I,
bool &AllowPromotionWithoutCommonHeader)
const {
316 return TTIImpl->shouldConsiderAddressTypePromotion(
317 I, AllowPromotionWithoutCommonHeader);
321 return TTIImpl->getCacheLineSize();
325 return TTIImpl->getPrefetchDistance();
329 return TTIImpl->getMinPrefetchStride();
333 return TTIImpl->getMaxPrefetchIterationsAhead();
337 return TTIImpl->getMaxInterleaveFactor(VF);
345 int Cost = TTIImpl->getArithmeticInstrCost(Opcode, Ty, Opd1Info, Opd2Info,
346 Opd1PropInfo, Opd2PropInfo, Args);
347 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
353 int Cost = TTIImpl->getShuffleCost(Kind, Ty, Index, SubTp);
354 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
361 "Opcode should reflect passed instruction.");
362 int Cost = TTIImpl->getCastInstrCost(Opcode, Dst, Src, I);
363 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
369 unsigned Index)
const {
370 int Cost = TTIImpl->getExtractWithExtendCost(Opcode, Dst, VecTy, Index);
371 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
376 int Cost = TTIImpl->getCFInstrCost(Opcode);
377 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
384 "Opcode should reflect passed instruction.");
385 int Cost = TTIImpl->getCmpSelInstrCost(Opcode, ValTy, CondTy, I);
386 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
391 unsigned Index)
const {
392 int Cost = TTIImpl->getVectorInstrCost(Opcode, Val, Index);
393 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
402 "Opcode should reflect passed instruction.");
403 int Cost = TTIImpl->getMemoryOpCost(Opcode, Src, Alignment, AddressSpace, I);
404 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
412 TTIImpl->getMaskedMemoryOpCost(Opcode, Src, Alignment, AddressSpace);
413 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
419 unsigned Alignment)
const {
420 int Cost = TTIImpl->getGatherScatterOpCost(Opcode, DataTy, Ptr, VariableMask,
422 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
429 int Cost = TTIImpl->getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices,
430 Alignment, AddressSpace);
431 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
437 unsigned ScalarizationCostPassed)
const {
438 int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Tys, FMF,
439 ScalarizationCostPassed);
440 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
446 int Cost = TTIImpl->getIntrinsicInstrCost(ID, RetTy, Args, FMF, VF);
447 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
453 int Cost = TTIImpl->getCallInstrCost(F, RetTy, Tys);
454 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
459 return TTIImpl->getNumberOfParts(Tp);
465 int Cost = TTIImpl->getAddressComputationCost(Tp, SE, Ptr);
466 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
471 bool IsPairwiseForm)
const {
472 int Cost = TTIImpl->getReductionCost(Opcode, Ty, IsPairwiseForm);
473 assert(Cost >= 0 &&
"TTI should not produce negative costs!");
479 return TTIImpl->getCostOfKeepingLiveOverCall(Tys);
484 return TTIImpl->getTgtMemIntrinsic(Inst, Info);
488 return TTIImpl->getAtomicMemIntrinsicMaxElementSize();
493 return TTIImpl->getOrCreateResultFromMemIntrinsic(Inst, ExpectedType);
499 unsigned DestAlign)
const {
500 return TTIImpl->getMemcpyLoopLoweringType(Context, Length, SrcAlign,
506 unsigned RemainingBytes,
unsigned SrcAlign,
unsigned DestAlign)
const {
507 TTIImpl->getMemcpyLoopResidualLoweringType(OpsOut, Context, RemainingBytes,
508 SrcAlign, DestAlign);
517 return TTIImpl->areInlineCompatible(Caller, Callee);
521 return TTIImpl->getLoadStoreVecRegBitWidth(AS);
525 return TTIImpl->isLegalToVectorizeLoad(LI);
529 return TTIImpl->isLegalToVectorizeStore(SI);
533 unsigned ChainSizeInBytes,
unsigned Alignment,
unsigned AddrSpace)
const {
534 return TTIImpl->isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
539 unsigned ChainSizeInBytes,
unsigned Alignment,
unsigned AddrSpace)
const {
540 return TTIImpl->isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
546 unsigned ChainSizeInBytes,
548 return TTIImpl->getLoadVectorFactor(VF, LoadSize, ChainSizeInBytes, VecTy);
553 unsigned ChainSizeInBytes,
555 return TTIImpl->getStoreVectorFactor(VF, StoreSize, ChainSizeInBytes, VecTy);
560 return TTIImpl->useReductionIntrinsic(Opcode, Ty, Flags);
564 return TTIImpl->shouldExpandReduction(II);
573 : TTICallback(std::move(TTICallback)) {}
577 return TTICallback(F);
588 "Target Transform Information",
false,
true)
608 TTI = TIRA.
run(F, DummyFAM);
A parsed version of the target data layout string in and methods for querying it. ...
static PassRegistry * getPassRegistry()
getPassRegistry - Access the global registry object, which is automatically initialized at applicatio...
The main scalar evolution driver.
ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
Analysis pass providing the TargetTransformInfo.
An instruction for reading from memory.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Class to represent function types.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
An instruction for storing to memory.
void initializeTargetTransformInfoWrapperPassPass(PassRegistry &)
initializer< Ty > init(const Ty &Val)
The instances of the Type class are immutable: once they are created, they are never changed...
This is an important class for using LLVM in a threaded context.
This is an important base class in LLVM.
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
TargetIRAnalysis()
Default construct a target IR analysis.
#define INITIALIZE_PASS(passName, arg, name, cfg, analysis)
ImmutablePass class - This class is used to provide information that does not need to be run...
Module.h This file contains the declarations for the Module class.
Class to represent vector types.
Class for arbitrary precision integers.
Result run(const Function &F, FunctionAnalysisManager &)
static std::vector< std::string > Flags
const DataLayout & getDataLayout() const
Get the data layout for the module's target platform.
This class represents an analyzed expression in the program.
Represents a single loop in the control flow graph.
Fast - This calling convention attempts to make calls as fast as possible (e.g.
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
TargetTransformInfo Result
Module * getParent()
Get the module that this global value is contained inside of...
LLVM Value Representation.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
print Print MemDeps of function
Convenience struct for specifying and reasoning about fast-math flags.
A container for analyses that lazily runs them and caches their results.
Information about a load/store intrinsic defined by the target.
A special type used by analysis passes to provide an address that identifies that particular analysis...
A wrapper class for inspecting calls to intrinsic functions.