Movatterモバイル変換


[0]ホーム

URL:


LLVM 20.0.0git
TargetTransformInfo.h
Go to the documentation of this file.
1//===- TargetTransformInfo.h ------------------------------------*- C++ -*-===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8/// \file
9/// This pass exposes codegen information to IR-level passes. Every
10/// transformation that uses codegen information is broken into three parts:
11/// 1. The IR-level analysis pass.
12/// 2. The IR-level transformation interface which provides the needed
13/// information.
14/// 3. Codegen-level implementation which uses target-specific hooks.
15///
16/// This file defines #2, which is the interface that IR-level transformations
17/// use for querying the codegen.
18///
19//===----------------------------------------------------------------------===//
20
21#ifndef LLVM_ANALYSIS_TARGETTRANSFORMINFO_H
22#define LLVM_ANALYSIS_TARGETTRANSFORMINFO_H
23
24#include "llvm/ADT/APInt.h"
25#include "llvm/ADT/ArrayRef.h"
26#include "llvm/IR/FMF.h"
27#include "llvm/IR/InstrTypes.h"
28#include "llvm/IR/PassManager.h"
29#include "llvm/Pass.h"
30#include "llvm/Support/AtomicOrdering.h"
31#include "llvm/Support/BranchProbability.h"
32#include "llvm/Support/InstructionCost.h"
33#include <functional>
34#include <optional>
35#include <utility>
36
37namespacellvm {
38
39namespaceIntrinsic {
40typedefunsignedID;
41}
42
43classAllocaInst;
44classAssumptionCache;
45classBlockFrequencyInfo;
46classDominatorTree;
47classBranchInst;
48classFunction;
49classGlobalValue;
50classInstCombiner;
51classOptimizationRemarkEmitter;
52classInterleavedAccessInfo;
53classIntrinsicInst;
54classLoadInst;
55classLoop;
56classLoopInfo;
57classLoopVectorizationLegality;
58classProfileSummaryInfo;
59classRecurrenceDescriptor;
60classSCEV;
61classScalarEvolution;
62classSmallBitVector;
63classStoreInst;
64classSwitchInst;
65classTargetLibraryInfo;
66classType;
67classVPIntrinsic;
68structKnownBits;
69
70/// Information about a load/store intrinsic defined by the target.
71structMemIntrinsicInfo {
72 /// This is the pointer that the intrinsic is loading from or storing to.
73 /// If this is non-null, then analysis/optimization passes can assume that
74 /// this intrinsic is functionally equivalent to a load/store from this
75 /// pointer.
76Value *PtrVal =nullptr;
77
78// Ordering for atomic operations.
79AtomicOrderingOrdering =AtomicOrdering::NotAtomic;
80
81// Same Id is set by the target for corresponding load/store intrinsics.
82unsignedshortMatchingId = 0;
83
84boolReadMem =false;
85boolWriteMem =false;
86boolIsVolatile =false;
87
88boolisUnordered() const{
89return (Ordering ==AtomicOrdering::NotAtomic ||
90Ordering ==AtomicOrdering::Unordered) &&
91 !IsVolatile;
92 }
93};
94
95/// Attributes of a target dependent hardware loop.
96structHardwareLoopInfo {
97HardwareLoopInfo() =delete;
98HardwareLoopInfo(Loop *L);
99Loop *L =nullptr;
100BasicBlock *ExitBlock =nullptr;
101BranchInst *ExitBranch =nullptr;
102constSCEV *ExitCount =nullptr;
103IntegerType *CountType =nullptr;
104Value *LoopDecrement =nullptr;// Decrement the loop counter by this
105// value in every iteration.
106boolIsNestingLegal =false;// Can a hardware loop be a parent to
107// another hardware loop?
108boolCounterInReg =false;// Should loop counter be updated in
109// the loop via a phi?
110boolPerformEntryTest =false;// Generate the intrinsic which also performs
111// icmp ne zero on the loop counter value and
112// produces an i1 to guard the loop entry.
113boolisHardwareLoopCandidate(ScalarEvolution &SE,LoopInfo &LI,
114DominatorTree &DT,boolForceNestedLoop =false,
115boolForceHardwareLoopPHI =false);
116boolcanAnalyze(LoopInfo &LI);
117};
118
119classIntrinsicCostAttributes {
120constIntrinsicInst *II =nullptr;
121Type *RetTy =nullptr;
122Intrinsic::ID IID;
123SmallVector<Type *, 4> ParamTys;
124SmallVector<const Value *, 4> Arguments;
125FastMathFlags FMF;
126// If ScalarizationCost is UINT_MAX, the cost of scalarizing the
127// arguments and the return value will be computed based on types.
128InstructionCost ScalarizationCost =InstructionCost::getInvalid();
129
130public:
131IntrinsicCostAttributes(
132Intrinsic::ID Id,constCallBase &CI,
133InstructionCost ScalarCost =InstructionCost::getInvalid(),
134bool TypeBasedOnly =false);
135
136IntrinsicCostAttributes(
137Intrinsic::ID Id,Type *RTy,ArrayRef<Type *> Tys,
138FastMathFlags Flags =FastMathFlags(),constIntrinsicInst *I =nullptr,
139InstructionCost ScalarCost =InstructionCost::getInvalid());
140
141IntrinsicCostAttributes(Intrinsic::ID Id,Type *RTy,
142ArrayRef<const Value *> Args);
143
144IntrinsicCostAttributes(
145Intrinsic::ID Id,Type *RTy,ArrayRef<const Value *> Args,
146ArrayRef<Type *> Tys,FastMathFlags Flags =FastMathFlags(),
147constIntrinsicInst *I =nullptr,
148InstructionCost ScalarCost =InstructionCost::getInvalid());
149
150Intrinsic::IDgetID() const{return IID; }
151constIntrinsicInst *getInst() const{returnII; }
152Type *getReturnType() const{returnRetTy; }
153FastMathFlagsgetFlags() const{return FMF; }
154InstructionCostgetScalarizationCost() const{return ScalarizationCost; }
155constSmallVectorImpl<const Value *> &getArgs() const{returnArguments; }
156constSmallVectorImpl<Type *> &getArgTypes() const{return ParamTys; }
157
158boolisTypeBasedOnly() const{
159returnArguments.empty();
160 }
161
162boolskipScalarizationCost() const{return ScalarizationCost.isValid(); }
163};
164
165enum classTailFoldingStyle {
166 /// Don't use tail folding
167None,
168 /// Use predicate only to mask operations on data in the loop.
169 /// When the VL is not known to be a power-of-2, this method requires a
170 /// runtime overflow check for the i + VL in the loop because it compares the
171 /// scalar induction variable against the tripcount rounded up by VL which may
172 /// overflow. When the VL is a power-of-2, both the increment and uprounded
173 /// tripcount will overflow to 0, which does not require a runtime check
174 /// since the loop is exited when the loop induction variable equals the
175 /// uprounded trip-count, which are both 0.
176Data,
177 /// Same as Data, but avoids using the get.active.lane.mask intrinsic to
178 /// calculate the mask and instead implements this with a
179 /// splat/stepvector/cmp.
180 /// FIXME: Can this kind be removed now that SelectionDAGBuilder expands the
181 /// active.lane.mask intrinsic when it is not natively supported?
182DataWithoutLaneMask,
183 /// Use predicate to control both data and control flow.
184 /// This method always requires a runtime overflow check for the i + VL
185 /// increment inside the loop, because it uses the result direclty in the
186 /// active.lane.mask to calculate the mask for the next iteration. If the
187 /// increment overflows, the mask is no longer correct.
188DataAndControlFlow,
189 /// Use predicate to control both data and control flow, but modify
190 /// the trip count so that a runtime overflow check can be avoided
191 /// and such that the scalar epilogue loop can always be removed.
192DataAndControlFlowWithoutRuntimeCheck,
193 /// Use predicated EVL instructions for tail-folding.
194 /// Indicates that VP intrinsics should be used.
195DataWithEVL,
196};
197
198structTailFoldingInfo {
199TargetLibraryInfo *TLI;
200LoopVectorizationLegality *LVL;
201InterleavedAccessInfo *IAI;
202TailFoldingInfo(TargetLibraryInfo *TLI,LoopVectorizationLegality *LVL,
203InterleavedAccessInfo *IAI)
204 :TLI(TLI),LVL(LVL),IAI(IAI) {}
205};
206
207classTargetTransformInfo;
208typedefTargetTransformInfoTTI;
209
210/// This pass provides access to the codegen interfaces that are needed
211/// for IR-level transformations.
212classTargetTransformInfo {
213public:
214enumPartialReductionExtendKind {PR_None,PR_SignExtend,PR_ZeroExtend };
215
216 /// Get the kind of extension that an instruction represents.
217staticPartialReductionExtendKind
218getPartialReductionExtendKind(Instruction *I);
219
220 /// Construct a TTI object using a type implementing the \c Concept
221 /// API below.
222 ///
223 /// This is used by targets to construct a TTI wrapping their target-specific
224 /// implementation that encodes appropriate costs for their target.
225template <typename T>TargetTransformInfo(T Impl);
226
227 /// Construct a baseline TTI object using a minimal implementation of
228 /// the \c Concept API below.
229 ///
230 /// The TTI implementation will reflect the information in the DataLayout
231 /// provided if non-null.
232explicitTargetTransformInfo(constDataLayout &DL);
233
234// Provide move semantics.
235TargetTransformInfo(TargetTransformInfo &&Arg);
236TargetTransformInfo &operator=(TargetTransformInfo &&RHS);
237
238// We need to define the destructor out-of-line to define our sub-classes
239// out-of-line.
240~TargetTransformInfo();
241
242 /// Handle the invalidation of this information.
243 ///
244 /// When used as a result of \c TargetIRAnalysis this method will be called
245 /// when the function this was computed for changes. When it returns false,
246 /// the information is preserved across those changes.
247boolinvalidate(Function &,constPreservedAnalyses &,
248FunctionAnalysisManager::Invalidator &) {
249// FIXME: We should probably in some way ensure that the subtarget
250// information for a function hasn't changed.
251returnfalse;
252 }
253
254 /// \name Generic Target Information
255 /// @{
256
257 /// The kind of cost model.
258 ///
259 /// There are several different cost models that can be customized by the
260 /// target. The normalization of each cost model may be target specific.
261 /// e.g. TCK_SizeAndLatency should be comparable to target thresholds such as
262 /// those derived from MCSchedModel::LoopMicroOpBufferSize etc.
263enumTargetCostKind {
264TCK_RecipThroughput,///< Reciprocal throughput.
265TCK_Latency,///< The latency of instruction.
266TCK_CodeSize,///< Instruction code size.
267TCK_SizeAndLatency///< The weighted sum of size and latency.
268 };
269
270 /// Underlying constants for 'cost' values in this interface.
271 ///
272 /// Many APIs in this interface return a cost. This enum defines the
273 /// fundamental values that should be used to interpret (and produce) those
274 /// costs. The costs are returned as an int rather than a member of this
275 /// enumeration because it is expected that the cost of one IR instruction
276 /// may have a multiplicative factor to it or otherwise won't fit directly
277 /// into the enum. Moreover, it is common to sum or average costs which works
278 /// better as simple integral values. Thus this enum only provides constants.
279 /// Also note that the returned costs are signed integers to make it natural
280 /// to add, subtract, and test with zero (a common boundary condition). It is
281 /// not expected that 2^32 is a realistic cost to be modeling at any point.
282 ///
283 /// Note that these costs should usually reflect the intersection of code-size
284 /// cost and execution cost. A free instruction is typically one that folds
285 /// into another instruction. For example, reg-to-reg moves can often be
286 /// skipped by renaming the registers in the CPU, but they still are encoded
287 /// and thus wouldn't be considered 'free' here.
288enumTargetCostConstants {
289TCC_Free = 0,///< Expected to fold away in lowering.
290TCC_Basic = 1,///< The cost of a typical 'add' instruction.
291TCC_Expensive = 4///< The cost of a 'div' instruction on x86.
292 };
293
294 /// Estimate the cost of a GEP operation when lowered.
295 ///
296 /// \p PointeeType is the source element type of the GEP.
297 /// \p Ptr is the base pointer operand.
298 /// \p Operands is the list of indices following the base pointer.
299 ///
300 /// \p AccessType is a hint as to what type of memory might be accessed by
301 /// users of the GEP. getGEPCost will use it to determine if the GEP can be
302 /// folded into the addressing mode of a load/store. If AccessType is null,
303 /// then the resulting target type based off of PointeeType will be used as an
304 /// approximation.
305InstructionCost
306getGEPCost(Type *PointeeType,constValue *Ptr,
307ArrayRef<const Value *>Operands,Type *AccessType =nullptr,
308TargetCostKindCostKind =TCK_SizeAndLatency)const;
309
310 /// Describe known properties for a set of pointers.
311structPointersChainInfo {
312 /// All the GEPs in a set have same base address.
313unsignedIsSameBaseAddress : 1;
314 /// These properties only valid if SameBaseAddress is set.
315 /// True if all pointers are separated by a unit stride.
316unsignedIsUnitStride : 1;
317 /// True if distance between any two neigbouring pointers is a known value.
318unsignedIsKnownStride : 1;
319unsignedReserved : 29;
320
321boolisSameBase() const{returnIsSameBaseAddress; }
322boolisUnitStride() const{returnIsSameBaseAddress &&IsUnitStride; }
323boolisKnownStride() const{returnIsSameBaseAddress &&IsKnownStride; }
324
325staticPointersChainInfogetUnitStride() {
326return {/*IsSameBaseAddress=*/1,/*IsUnitStride=*/1,
327/*IsKnownStride=*/1, 0};
328 }
329staticPointersChainInfogetKnownStride() {
330return {/*IsSameBaseAddress=*/1,/*IsUnitStride=*/0,
331/*IsKnownStride=*/1, 0};
332 }
333staticPointersChainInfogetUnknownStride() {
334return {/*IsSameBaseAddress=*/1,/*IsUnitStride=*/0,
335/*IsKnownStride=*/0, 0};
336 }
337 };
338static_assert(sizeof(PointersChainInfo) == 4,"Was size increase justified?");
339
340 /// Estimate the cost of a chain of pointers (typically pointer operands of a
341 /// chain of loads or stores within same block) operations set when lowered.
342 /// \p AccessTy is the type of the loads/stores that will ultimately use the
343 /// \p Ptrs.
344InstructionCostgetPointersChainCost(
345ArrayRef<const Value *> Ptrs,constValue *Base,
346const PointersChainInfo &Info,Type *AccessTy,
347TargetCostKindCostKind =TTI::TCK_RecipThroughput)const;
348
349 /// \returns A value by which our inlining threshold should be multiplied.
350 /// This is primarily used to bump up the inlining threshold wholesale on
351 /// targets where calls are unusually expensive.
352 ///
353 /// TODO: This is a rather blunt instrument. Perhaps altering the costs of
354 /// individual classes of instructions would be better.
355unsignedgetInliningThresholdMultiplier()const;
356
357unsignedgetInliningCostBenefitAnalysisSavingsMultiplier()const;
358unsignedgetInliningCostBenefitAnalysisProfitableMultiplier()const;
359
360 /// \returns The bonus of inlining the last call to a static function.
361intgetInliningLastCallToStaticBonus()const;
362
363 /// \returns A value to be added to the inlining threshold.
364unsignedadjustInliningThreshold(constCallBase *CB)const;
365
366 /// \returns The cost of having an Alloca in the caller if not inlined, to be
367 /// added to the threshold
368unsignedgetCallerAllocaCost(constCallBase *CB,constAllocaInst *AI)const;
369
370 /// \returns Vector bonus in percent.
371 ///
372 /// Vector bonuses: We want to more aggressively inline vector-dense kernels
373 /// and apply this bonus based on the percentage of vector instructions. A
374 /// bonus is applied if the vector instructions exceed 50% and half that
375 /// amount is applied if it exceeds 10%. Note that these bonuses are some what
376 /// arbitrary and evolved over time by accident as much as because they are
377 /// principled bonuses.
378 /// FIXME: It would be nice to base the bonus values on something more
379 /// scientific. A target may has no bonus on vector instructions.
380intgetInlinerVectorBonusPercent()const;
381
382 /// \return the expected cost of a memcpy, which could e.g. depend on the
383 /// source/destination type and alignment and the number of bytes copied.
384InstructionCostgetMemcpyCost(constInstruction *I)const;
385
386 /// Returns the maximum memset / memcpy size in bytes that still makes it
387 /// profitable to inline the call.
388uint64_tgetMaxMemIntrinsicInlineSizeThreshold()const;
389
390 /// \return The estimated number of case clusters when lowering \p 'SI'.
391 /// \p JTSize Set a jump table size only when \p SI is suitable for a jump
392 /// table.
393unsignedgetEstimatedNumberOfCaseClusters(constSwitchInst &SI,
394unsigned &JTSize,
395ProfileSummaryInfo *PSI,
396BlockFrequencyInfo *BFI)const;
397
398 /// Estimate the cost of a given IR user when lowered.
399 ///
400 /// This can estimate the cost of either a ConstantExpr or Instruction when
401 /// lowered.
402 ///
403 /// \p Operands is a list of operands which can be a result of transformations
404 /// of the current operands. The number of the operands on the list must equal
405 /// to the number of the current operands the IR user has. Their order on the
406 /// list must be the same as the order of the current operands the IR user
407 /// has.
408 ///
409 /// The returned cost is defined in terms of \c TargetCostConstants, see its
410 /// comments for a detailed explanation of the cost values.
411InstructionCostgetInstructionCost(constUser *U,
412ArrayRef<const Value *>Operands,
413TargetCostKindCostKind)const;
414
415 /// This is a helper function which calls the three-argument
416 /// getInstructionCost with \p Operands which are the current operands U has.
417InstructionCostgetInstructionCost(constUser *U,
418TargetCostKindCostKind) const{
419SmallVector<const Value *, 4>Operands(U->operand_values());
420returngetInstructionCost(U,Operands,CostKind);
421 }
422
423 /// If a branch or a select condition is skewed in one direction by more than
424 /// this factor, it is very likely to be predicted correctly.
425BranchProbabilitygetPredictableBranchThreshold()const;
426
427 /// Returns estimated penalty of a branch misprediction in latency. Indicates
428 /// how aggressive the target wants for eliminating unpredictable branches. A
429 /// zero return value means extra optimization applied to them should be
430 /// minimal.
431InstructionCostgetBranchMispredictPenalty()const;
432
433 /// Return true if branch divergence exists.
434 ///
435 /// Branch divergence has a significantly negative impact on GPU performance
436 /// when threads in the same wavefront take different paths due to conditional
437 /// branches.
438 ///
439 /// If \p F is passed, provides a context function. If \p F is known to only
440 /// execute in a single threaded environment, the target may choose to skip
441 /// uniformity analysis and assume all values are uniform.
442boolhasBranchDivergence(constFunction *F =nullptr)const;
443
444 /// Returns whether V is a source of divergence.
445 ///
446 /// This function provides the target-dependent information for
447 /// the target-independent UniformityAnalysis.
448boolisSourceOfDivergence(constValue *V)const;
449
450// Returns true for the target specific
451// set of operations which produce uniform result
452// even taking non-uniform arguments
453boolisAlwaysUniform(constValue *V)const;
454
455 /// Query the target whether the specified address space cast from FromAS to
456 /// ToAS is valid.
457boolisValidAddrSpaceCast(unsigned FromAS,unsigned ToAS)const;
458
459 /// Return false if a \p AS0 address cannot possibly alias a \p AS1 address.
460booladdrspacesMayAlias(unsigned AS0,unsigned AS1)const;
461
462 /// Returns the address space ID for a target's 'flat' address space. Note
463 /// this is not necessarily the same as addrspace(0), which LLVM sometimes
464 /// refers to as the generic address space. The flat address space is a
465 /// generic address space that can be used access multiple segments of memory
466 /// with different address spaces. Access of a memory location through a
467 /// pointer with this address space is expected to be legal but slower
468 /// compared to the same memory location accessed through a pointer with a
469 /// different address space.
470//
471 /// This is for targets with different pointer representations which can
472 /// be converted with the addrspacecast instruction. If a pointer is converted
473 /// to this address space, optimizations should attempt to replace the access
474 /// with the source address space.
475 ///
476 /// \returns ~0u if the target does not have such a flat address space to
477 /// optimize away.
478unsignedgetFlatAddressSpace()const;
479
480 /// Return any intrinsic address operand indexes which may be rewritten if
481 /// they use a flat address space pointer.
482 ///
483 /// \returns true if the intrinsic was handled.
484boolcollectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
485Intrinsic::ID IID)const;
486
487boolisNoopAddrSpaceCast(unsigned FromAS,unsigned ToAS)const;
488
489 /// Return true if globals in this address space can have initializers other
490 /// than `undef`.
491boolcanHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS)const;
492
493unsignedgetAssumedAddrSpace(constValue *V)const;
494
495boolisSingleThreaded()const;
496
497 std::pair<const Value *, unsigned>
498getPredicatedAddrSpace(constValue *V)const;
499
500 /// Rewrite intrinsic call \p II such that \p OldV will be replaced with \p
501 /// NewV, which has a different address space. This should happen for every
502 /// operand index that collectFlatAddressOperands returned for the intrinsic.
503 /// \returns nullptr if the intrinsic was not handled. Otherwise, returns the
504 /// new value (which may be the original \p II with modified operands).
505Value *rewriteIntrinsicWithAddressSpace(IntrinsicInst *II,Value *OldV,
506Value *NewV)const;
507
508 /// Test whether calls to a function lower to actual program function
509 /// calls.
510 ///
511 /// The idea is to test whether the program is likely to require a 'call'
512 /// instruction or equivalent in order to call the given function.
513 ///
514 /// FIXME: It's not clear that this is a good or useful query API. Client's
515 /// should probably move to simpler cost metrics using the above.
516 /// Alternatively, we could split the cost interface into distinct code-size
517 /// and execution-speed costs. This would allow modelling the core of this
518 /// query more accurately as a call is a single small instruction, but
519 /// incurs significant execution cost.
520boolisLoweredToCall(constFunction *F)const;
521
522structLSRCost {
523 /// TODO: Some of these could be merged. Also, a lexical ordering
524 /// isn't always optimal.
525unsignedInsns;
526unsignedNumRegs;
527unsignedAddRecCost;
528unsignedNumIVMuls;
529unsignedNumBaseAdds;
530unsignedImmCost;
531unsignedSetupCost;
532unsignedScaleCost;
533 };
534
535 /// Parameters that control the generic loop unrolling transformation.
536structUnrollingPreferences {
537 /// The cost threshold for the unrolled loop. Should be relative to the
538 /// getInstructionCost values returned by this API, and the expectation is
539 /// that the unrolled loop's instructions when run through that interface
540 /// should not exceed this cost. However, this is only an estimate. Also,
541 /// specific loops may be unrolled even with a cost above this threshold if
542 /// deemed profitable. Set this to UINT_MAX to disable the loop body cost
543 /// restriction.
544unsignedThreshold;
545 /// If complete unrolling will reduce the cost of the loop, we will boost
546 /// the Threshold by a certain percent to allow more aggressive complete
547 /// unrolling. This value provides the maximum boost percentage that we
548 /// can apply to Threshold (The value should be no less than 100).
549 /// BoostedThreshold = Threshold * min(RolledCost / UnrolledCost,
550 /// MaxPercentThresholdBoost / 100)
551 /// E.g. if complete unrolling reduces the loop execution time by 50%
552 /// then we boost the threshold by the factor of 2x. If unrolling is not
553 /// expected to reduce the running time, then we do not increase the
554 /// threshold.
555unsignedMaxPercentThresholdBoost;
556 /// The cost threshold for the unrolled loop when optimizing for size (set
557 /// to UINT_MAX to disable).
558unsignedOptSizeThreshold;
559 /// The cost threshold for the unrolled loop, like Threshold, but used
560 /// for partial/runtime unrolling (set to UINT_MAX to disable).
561unsignedPartialThreshold;
562 /// The cost threshold for the unrolled loop when optimizing for size, like
563 /// OptSizeThreshold, but used for partial/runtime unrolling (set to
564 /// UINT_MAX to disable).
565unsignedPartialOptSizeThreshold;
566 /// A forced unrolling factor (the number of concatenated bodies of the
567 /// original loop in the unrolled loop body). When set to 0, the unrolling
568 /// transformation will select an unrolling factor based on the current cost
569 /// threshold and other factors.
570unsignedCount;
571 /// Default unroll count for loops with run-time trip count.
572unsignedDefaultUnrollRuntimeCount;
573// Set the maximum unrolling factor. The unrolling factor may be selected
574// using the appropriate cost threshold, but may not exceed this number
575// (set to UINT_MAX to disable). This does not apply in cases where the
576// loop is being fully unrolled.
577unsignedMaxCount;
578 /// Set the maximum upper bound of trip count. Allowing the MaxUpperBound
579 /// to be overrided by a target gives more flexiblity on certain cases.
580 /// By default, MaxUpperBound uses UnrollMaxUpperBound which value is 8.
581unsignedMaxUpperBound;
582 /// Set the maximum unrolling factor for full unrolling. Like MaxCount, but
583 /// applies even if full unrolling is selected. This allows a target to fall
584 /// back to Partial unrolling if full unrolling is above FullUnrollMaxCount.
585unsignedFullUnrollMaxCount;
586// Represents number of instructions optimized when "back edge"
587// becomes "fall through" in unrolled loop.
588// For now we count a conditional branch on a backedge and a comparison
589// feeding it.
590unsignedBEInsns;
591 /// Allow partial unrolling (unrolling of loops to expand the size of the
592 /// loop body, not only to eliminate small constant-trip-count loops).
593boolPartial;
594 /// Allow runtime unrolling (unrolling of loops to expand the size of the
595 /// loop body even when the number of loop iterations is not known at
596 /// compile time).
597boolRuntime;
598 /// Allow generation of a loop remainder (extra iterations after unroll).
599boolAllowRemainder;
600 /// Allow emitting expensive instructions (such as divisions) when computing
601 /// the trip count of a loop for runtime unrolling.
602boolAllowExpensiveTripCount;
603 /// Apply loop unroll on any kind of loop
604 /// (mainly to loops that fail runtime unrolling).
605boolForce;
606 /// Allow using trip count upper bound to unroll loops.
607boolUpperBound;
608 /// Allow unrolling of all the iterations of the runtime loop remainder.
609boolUnrollRemainder;
610 /// Allow unroll and jam. Used to enable unroll and jam for the target.
611boolUnrollAndJam;
612 /// Threshold for unroll and jam, for inner loop size. The 'Threshold'
613 /// value above is used during unroll and jam for the outer loop size.
614 /// This value is used in the same manner to limit the size of the inner
615 /// loop.
616unsignedUnrollAndJamInnerLoopThreshold;
617 /// Don't allow loop unrolling to simulate more than this number of
618 /// iterations when checking full unroll profitability
619unsignedMaxIterationsCountToAnalyze;
620 /// Don't disable runtime unroll for the loops which were vectorized.
621boolUnrollVectorizedLoop =false;
622 /// Don't allow runtime unrolling if expanding the trip count takes more
623 /// than SCEVExpansionBudget.
624unsignedSCEVExpansionBudget;
625 /// Allow runtime unrolling multi-exit loops. Should only be set if the
626 /// target determined that multi-exit unrolling is profitable for the loop.
627 /// Fall back to the generic logic to determine whether multi-exit unrolling
628 /// is profitable if set to false.
629boolRuntimeUnrollMultiExit;
630 };
631
632 /// Get target-customized preferences for the generic loop unrolling
633 /// transformation. The caller will initialize UP with the current
634 /// target-independent defaults.
635voidgetUnrollingPreferences(Loop *L,ScalarEvolution &,
636UnrollingPreferences &UP,
637OptimizationRemarkEmitter *ORE)const;
638
639 /// Query the target whether it would be profitable to convert the given loop
640 /// into a hardware loop.
641boolisHardwareLoopProfitable(Loop *L,ScalarEvolution &SE,
642AssumptionCache &AC,TargetLibraryInfo *LibInfo,
643HardwareLoopInfo &HWLoopInfo)const;
644
645// Query the target for which minimum vectorization factor epilogue
646// vectorization should be considered.
647unsignedgetEpilogueVectorizationMinVF()const;
648
649 /// Query the target whether it would be prefered to create a predicated
650 /// vector loop, which can avoid the need to emit a scalar epilogue loop.
651boolpreferPredicateOverEpilogue(TailFoldingInfo *TFI)const;
652
653 /// Query the target what the preferred style of tail folding is.
654 /// \param IVUpdateMayOverflow Tells whether it is known if the IV update
655 /// may (or will never) overflow for the suggested VF/UF in the given loop.
656 /// Targets can use this information to select a more optimal tail folding
657 /// style. The value conservatively defaults to true, such that no assumptions
658 /// are made on overflow.
659TailFoldingStyle
660getPreferredTailFoldingStyle(bool IVUpdateMayOverflow =true)const;
661
662// Parameters that control the loop peeling transformation
663structPeelingPreferences {
664 /// A forced peeling factor (the number of bodied of the original loop
665 /// that should be peeled off before the loop body). When set to 0, the
666 /// a peeling factor based on profile information and other factors.
667unsignedPeelCount;
668 /// Allow peeling off loop iterations.
669boolAllowPeeling;
670 /// Allow peeling off loop iterations for loop nests.
671boolAllowLoopNestsPeeling;
672 /// Allow peeling basing on profile. Uses to enable peeling off all
673 /// iterations basing on provided profile.
674 /// If the value is true the peeling cost model can decide to peel only
675 /// some iterations and in this case it will set this to false.
676boolPeelProfiledIterations;
677 };
678
679 /// Get target-customized preferences for the generic loop peeling
680 /// transformation. The caller will initialize \p PP with the current
681 /// target-independent defaults with information from \p L and \p SE.
682voidgetPeelingPreferences(Loop *L,ScalarEvolution &SE,
683PeelingPreferences &PP)const;
684
685 /// Targets can implement their own combinations for target-specific
686 /// intrinsics. This function will be called from the InstCombine pass every
687 /// time a target-specific intrinsic is encountered.
688 ///
689 /// \returns std::nullopt to not do anything target specific or a value that
690 /// will be returned from the InstCombiner. It is possible to return null and
691 /// stop further processing of the intrinsic by returning nullptr.
692 std::optional<Instruction *>instCombineIntrinsic(InstCombiner & IC,
693IntrinsicInst &II)const;
694 /// Can be used to implement target-specific instruction combining.
695 /// \see instCombineIntrinsic
696 std::optional<Value *>simplifyDemandedUseBitsIntrinsic(
697InstCombiner & IC,IntrinsicInst &II,APInt DemandedMask,
698KnownBits & Known,bool &KnownBitsComputed)const;
699 /// Can be used to implement target-specific instruction combining.
700 /// \see instCombineIntrinsic
701 std::optional<Value *>simplifyDemandedVectorEltsIntrinsic(
702InstCombiner & IC,IntrinsicInst &II,APInt DemandedElts,
703APInt & UndefElts,APInt & UndefElts2,APInt & UndefElts3,
704 std::function<void(Instruction *,unsigned,APInt,APInt &)>
705 SimplifyAndSetOp)const;
706 /// @}
707
708 /// \name Scalar Target Information
709 /// @{
710
711 /// Flags indicating the kind of support for population count.
712 ///
713 /// Compared to the SW implementation, HW support is supposed to
714 /// significantly boost the performance when the population is dense, and it
715 /// may or may not degrade performance if the population is sparse. A HW
716 /// support is considered as "Fast" if it can outperform, or is on a par
717 /// with, SW implementation when the population is sparse; otherwise, it is
718 /// considered as "Slow".
719enumPopcntSupportKind {PSK_Software,PSK_SlowHardware,PSK_FastHardware };
720
721 /// Return true if the specified immediate is legal add immediate, that
722 /// is the target has add instructions which can add a register with the
723 /// immediate without having to materialize the immediate into a register.
724boolisLegalAddImmediate(int64_t Imm)const;
725
726 /// Return true if adding the specified scalable immediate is legal, that is
727 /// the target has add instructions which can add a register with the
728 /// immediate (multiplied by vscale) without having to materialize the
729 /// immediate into a register.
730boolisLegalAddScalableImmediate(int64_t Imm)const;
731
732 /// Return true if the specified immediate is legal icmp immediate,
733 /// that is the target has icmp instructions which can compare a register
734 /// against the immediate without having to materialize the immediate into a
735 /// register.
736boolisLegalICmpImmediate(int64_t Imm)const;
737
738 /// Return true if the addressing mode represented by AM is legal for
739 /// this target, for a load/store of the specified type.
740 /// The type may be VoidTy, in which case only return true if the addressing
741 /// mode is legal for a load/store of any legal type.
742 /// If target returns true in LSRWithInstrQueries(), I may be valid.
743 /// \param ScalableOffset represents a quantity of bytes multiplied by vscale,
744 /// an invariant value known only at runtime. Most targets should not accept
745 /// a scalable offset.
746 ///
747 /// TODO: Handle pre/postinc as well.
748boolisLegalAddressingMode(Type *Ty,GlobalValue *BaseGV, int64_t BaseOffset,
749bool HasBaseReg, int64_t Scale,
750unsigned AddrSpace = 0,Instruction *I =nullptr,
751 int64_t ScalableOffset = 0)const;
752
753 /// Return true if LSR cost of C1 is lower than C2.
754boolisLSRCostLess(constTargetTransformInfo::LSRCost &C1,
755constTargetTransformInfo::LSRCost &C2)const;
756
757 /// Return true if LSR major cost is number of registers. Targets which
758 /// implement their own isLSRCostLess and unset number of registers as major
759 /// cost should return false, otherwise return true.
760boolisNumRegsMajorCostOfLSR()const;
761
762 /// Return true if LSR should drop a found solution if it's calculated to be
763 /// less profitable than the baseline.
764boolshouldDropLSRSolutionIfLessProfitable()const;
765
766 /// \returns true if LSR should not optimize a chain that includes \p I.
767boolisProfitableLSRChainElement(Instruction *I)const;
768
769 /// Return true if the target can fuse a compare and branch.
770 /// Loop-strength-reduction (LSR) uses that knowledge to adjust its cost
771 /// calculation for the instructions in a loop.
772boolcanMacroFuseCmp()const;
773
774 /// Return true if the target can save a compare for loop count, for example
775 /// hardware loop saves a compare.
776boolcanSaveCmp(Loop *L,BranchInst **BI,ScalarEvolution *SE,LoopInfo *LI,
777DominatorTree *DT,AssumptionCache *AC,
778TargetLibraryInfo *LibInfo)const;
779
780enumAddressingModeKind {
781AMK_PreIndexed,
782AMK_PostIndexed,
783AMK_None
784 };
785
786 /// Return the preferred addressing mode LSR should make efforts to generate.
787AddressingModeKindgetPreferredAddressingMode(constLoop *L,
788ScalarEvolution *SE)const;
789
790 /// Return true if the target supports masked store.
791boolisLegalMaskedStore(Type *DataType,Align Alignment)const;
792 /// Return true if the target supports masked load.
793boolisLegalMaskedLoad(Type *DataType,Align Alignment)const;
794
795 /// Return true if the target supports nontemporal store.
796boolisLegalNTStore(Type *DataType,Align Alignment)const;
797 /// Return true if the target supports nontemporal load.
798boolisLegalNTLoad(Type *DataType,Align Alignment)const;
799
800 /// \Returns true if the target supports broadcasting a load to a vector of
801 /// type <NumElements x ElementTy>.
802boolisLegalBroadcastLoad(Type *ElementTy,ElementCount NumElements)const;
803
804 /// Return true if the target supports masked scatter.
805boolisLegalMaskedScatter(Type *DataType,Align Alignment)const;
806 /// Return true if the target supports masked gather.
807boolisLegalMaskedGather(Type *DataType,Align Alignment)const;
808 /// Return true if the target forces scalarizing of llvm.masked.gather
809 /// intrinsics.
810boolforceScalarizeMaskedGather(VectorType *Type,Align Alignment)const;
811 /// Return true if the target forces scalarizing of llvm.masked.scatter
812 /// intrinsics.
813boolforceScalarizeMaskedScatter(VectorType *Type,Align Alignment)const;
814
815 /// Return true if the target supports masked compress store.
816boolisLegalMaskedCompressStore(Type *DataType,Align Alignment)const;
817 /// Return true if the target supports masked expand load.
818boolisLegalMaskedExpandLoad(Type *DataType,Align Alignment)const;
819
820 /// Return true if the target supports strided load.
821boolisLegalStridedLoadStore(Type *DataType,Align Alignment)const;
822
823 /// Return true is the target supports interleaved access for the given vector
824 /// type \p VTy, interleave factor \p Factor, alignment \p Alignment and
825 /// address space \p AddrSpace.
826boolisLegalInterleavedAccessType(VectorType *VTy,unsigned Factor,
827Align Alignment,unsigned AddrSpace)const;
828
829// Return true if the target supports masked vector histograms.
830boolisLegalMaskedVectorHistogram(Type *AddrType,Type *DataType)const;
831
832 /// Return true if this is an alternating opcode pattern that can be lowered
833 /// to a single instruction on the target. In X86 this is for the addsub
834 /// instruction which corrsponds to a Shuffle + Fadd + FSub pattern in IR.
835 /// This function expectes two opcodes: \p Opcode1 and \p Opcode2 being
836 /// selected by \p OpcodeMask. The mask contains one bit per lane and is a `0`
837 /// when \p Opcode0 is selected and `1` when Opcode1 is selected.
838 /// \p VecTy is the vector type of the instruction to be generated.
839boolisLegalAltInstr(VectorType *VecTy,unsigned Opcode0,unsigned Opcode1,
840constSmallBitVector &OpcodeMask)const;
841
842 /// Return true if we should be enabling ordered reductions for the target.
843boolenableOrderedReductions()const;
844
845 /// Return true if the target has a unified operation to calculate division
846 /// and remainder. If so, the additional implicit multiplication and
847 /// subtraction required to calculate a remainder from division are free. This
848 /// can enable more aggressive transformations for division and remainder than
849 /// would typically be allowed using throughput or size cost models.
850boolhasDivRemOp(Type *DataType,bool IsSigned)const;
851
852 /// Return true if the given instruction (assumed to be a memory access
853 /// instruction) has a volatile variant. If that's the case then we can avoid
854 /// addrspacecast to generic AS for volatile loads/stores. Default
855 /// implementation returns false, which prevents address space inference for
856 /// volatile loads/stores.
857boolhasVolatileVariant(Instruction *I,unsigned AddrSpace)const;
858
859 /// Return true if target doesn't mind addresses in vectors.
860boolprefersVectorizedAddressing()const;
861
862 /// Return the cost of the scaling factor used in the addressing
863 /// mode represented by AM for this target, for a load/store
864 /// of the specified type.
865 /// If the AM is supported, the return value must be >= 0.
866 /// If the AM is not supported, it returns a negative value.
867 /// TODO: Handle pre/postinc as well.
868InstructionCostgetScalingFactorCost(Type *Ty,GlobalValue *BaseGV,
869StackOffset BaseOffset,bool HasBaseReg,
870 int64_t Scale,
871unsigned AddrSpace = 0)const;
872
873 /// Return true if the loop strength reduce pass should make
874 /// Instruction* based TTI queries to isLegalAddressingMode(). This is
875 /// needed on SystemZ, where e.g. a memcpy can only have a 12 bit unsigned
876 /// immediate offset and no index register.
877boolLSRWithInstrQueries()const;
878
879 /// Return true if it's free to truncate a value of type Ty1 to type
880 /// Ty2. e.g. On x86 it's free to truncate a i32 value in register EAX to i16
881 /// by referencing its sub-register AX.
882boolisTruncateFree(Type *Ty1,Type *Ty2)const;
883
884 /// Return true if it is profitable to hoist instruction in the
885 /// then/else to before if.
886boolisProfitableToHoist(Instruction *I)const;
887
888booluseAA()const;
889
890 /// Return true if this type is legal.
891boolisTypeLegal(Type *Ty)const;
892
893 /// Returns the estimated number of registers required to represent \p Ty.
894unsignedgetRegUsageForType(Type *Ty)const;
895
896 /// Return true if switches should be turned into lookup tables for the
897 /// target.
898boolshouldBuildLookupTables()const;
899
900 /// Return true if switches should be turned into lookup tables
901 /// containing this constant value for the target.
902boolshouldBuildLookupTablesForConstant(Constant *C)const;
903
904 /// Return true if lookup tables should be turned into relative lookup tables.
905boolshouldBuildRelLookupTables()const;
906
907 /// Return true if the input function which is cold at all call sites,
908 /// should use coldcc calling convention.
909booluseColdCCForColdCall(Function &F)const;
910
911boolisTargetIntrinsicTriviallyScalarizable(Intrinsic::IDID)const;
912
913 /// Identifies if the vector form of the intrinsic has a scalar operand.
914boolisTargetIntrinsicWithScalarOpAtArg(Intrinsic::IDID,
915unsigned ScalarOpdIdx)const;
916
917 /// Identifies if the vector form of the intrinsic is overloaded on the type
918 /// of the operand at index \p OpdIdx, or on the return type if \p OpdIdx is
919 /// -1.
920boolisTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::IDID,
921int OpdIdx)const;
922
923 /// Identifies if the vector form of the intrinsic that returns a struct is
924 /// overloaded at the struct element index \p RetIdx.
925boolisTargetIntrinsicWithStructReturnOverloadAtField(Intrinsic::IDID,
926int RetIdx)const;
927
928 /// Estimate the overhead of scalarizing an instruction. Insert and Extract
929 /// are set if the demanded result elements need to be inserted and/or
930 /// extracted from vectors. The involved values may be passed in VL if
931 /// Insert is true.
932InstructionCostgetScalarizationOverhead(VectorType *Ty,
933constAPInt &DemandedElts,
934bool Insert,bool Extract,
935TTI::TargetCostKindCostKind,
936ArrayRef<Value *> VL = {})const;
937
938 /// Estimate the overhead of scalarizing an instructions unique
939 /// non-constant operands. The (potentially vector) types to use for each of
940 /// argument are passes via Tys.
941 InstructionCost
942getOperandsScalarizationOverhead(ArrayRef<const Value *> Args,
943 ArrayRef<Type *> Tys,
944TTI::TargetCostKindCostKind)const;
945
946 /// If target has efficient vector element load/store instructions, it can
947 /// return true here so that insertion/extraction costs are not added to
948 /// the scalarization cost of a load/store.
949boolsupportsEfficientVectorElementLoadStore()const;
950
951 /// If the target supports tail calls.
952boolsupportsTailCalls()const;
953
954 /// If target supports tail call on \p CB
955boolsupportsTailCallFor(const CallBase *CB)const;
956
957 /// Don't restrict interleaved unrolling to small loops.
958boolenableAggressiveInterleaving(bool LoopHasReductions)const;
959
960 /// Returns options for expansion of memcmp. IsZeroCmp is
961// true if this is the expansion of memcmp(p1, p2, s) == 0.
962structMemCmpExpansionOptions {
963// Return true if memcmp expansion is enabled.
964operatorbool() const{returnMaxNumLoads > 0; }
965
966// Maximum number of load operations.
967unsignedMaxNumLoads = 0;
968
969// The list of available load sizes (in bytes), sorted in decreasing order.
970SmallVector<unsigned, 8>LoadSizes;
971
972// For memcmp expansion when the memcmp result is only compared equal or
973// not-equal to 0, allow up to this number of load pairs per block. As an
974// example, this may allow 'memcmp(a, b, 3) == 0' in a single block:
975// a0 = load2bytes &a[0]
976// b0 = load2bytes &b[0]
977// a2 = load1byte &a[2]
978// b2 = load1byte &b[2]
979// r = cmp eq (a0 ^ b0 | a2 ^ b2), 0
980unsignedNumLoadsPerBlock = 1;
981
982// Set to true to allow overlapping loads. For example, 7-byte compares can
983// be done with two 4-byte compares instead of 4+2+1-byte compares. This
984// requires all loads in LoadSizes to be doable in an unaligned way.
985boolAllowOverlappingLoads =false;
986
987// Sometimes, the amount of data that needs to be compared is smaller than
988// the standard register size, but it cannot be loaded with just one load
989// instruction. For example, if the size of the memory comparison is 6
990// bytes, we can handle it more efficiently by loading all 6 bytes in a
991// single block and generating an 8-byte number, instead of generating two
992// separate blocks with conditional jumps for 4 and 2 byte loads. This
993// approach simplifies the process and produces the comparison result as
994// normal. This array lists the allowed sizes of memcmp tails that can be
995// merged into one block
996SmallVector<unsigned, 4>AllowedTailExpansions;
997 };
998MemCmpExpansionOptionsenableMemCmpExpansion(bool OptSize,
999bool IsZeroCmp)const;
1000
1001 /// Should the Select Optimization pass be enabled and ran.
1002boolenableSelectOptimize()const;
1003
1004 /// Should the Select Optimization pass treat the given instruction like a
1005 /// select, potentially converting it to a conditional branch. This can
1006 /// include select-like instructions like or(zext(c), x) that can be converted
1007 /// to selects.
1008boolshouldTreatInstructionLikeSelect(constInstruction *I)const;
1009
1010 /// Enable matching of interleaved access groups.
1011boolenableInterleavedAccessVectorization()const;
1012
1013 /// Enable matching of interleaved access groups that contain predicated
1014 /// accesses or gaps and therefore vectorized using masked
1015 /// vector loads/stores.
1016boolenableMaskedInterleavedAccessVectorization()const;
1017
1018 /// Indicate that it is potentially unsafe to automatically vectorize
1019 /// floating-point operations because the semantics of vector and scalar
1020 /// floating-point semantics may differ. For example, ARM NEON v7 SIMD math
1021 /// does not support IEEE-754 denormal numbers, while depending on the
1022 /// platform, scalar floating-point math does.
1023 /// This applies to floating-point math operations and calls, not memory
1024 /// operations, shuffles, or casts.
1025boolisFPVectorizationPotentiallyUnsafe()const;
1026
1027 /// Determine if the target supports unaligned memory accesses.
1028boolallowsMisalignedMemoryAccesses(LLVMContext &Context,unsignedBitWidth,
1029unsignedAddressSpace = 0,
1030Align Alignment =Align(1),
1031unsigned *Fast =nullptr)const;
1032
1033 /// Return hardware support for population count.
1034PopcntSupportKindgetPopcntSupport(unsigned IntTyWidthInBit)const;
1035
1036 /// Return true if the hardware has a fast square-root instruction.
1037boolhaveFastSqrt(Type *Ty)const;
1038
1039 /// Return true if the cost of the instruction is too high to speculatively
1040 /// execute and should be kept behind a branch.
1041 /// This normally just wraps around a getInstructionCost() call, but some
1042 /// targets might report a low TCK_SizeAndLatency value that is incompatible
1043 /// with the fixed TCC_Expensive value.
1044 /// NOTE: This assumes the instruction passes isSafeToSpeculativelyExecute().
1045boolisExpensiveToSpeculativelyExecute(constInstruction *I)const;
1046
1047 /// Return true if it is faster to check if a floating-point value is NaN
1048 /// (or not-NaN) versus a comparison against a constant FP zero value.
1049 /// Targets should override this if materializing a 0.0 for comparison is
1050 /// generally as cheap as checking for ordered/unordered.
1051boolisFCmpOrdCheaperThanFCmpZero(Type *Ty)const;
1052
1053 /// Return the expected cost of supporting the floating point operation
1054 /// of the specified type.
1055InstructionCostgetFPOpCost(Type *Ty)const;
1056
1057 /// Return the expected cost of materializing for the given integer
1058 /// immediate of the specified type.
1059InstructionCostgetIntImmCost(constAPInt &Imm,Type *Ty,
1060TargetCostKindCostKind)const;
1061
1062 /// Return the expected cost of materialization for the given integer
1063 /// immediate of the specified type for a given instruction. The cost can be
1064 /// zero if the immediate can be folded into the specified instruction.
1065InstructionCostgetIntImmCostInst(unsigned Opc,unsignedIdx,
1066constAPInt &Imm,Type *Ty,
1067TargetCostKindCostKind,
1068Instruction *Inst =nullptr)const;
1069InstructionCostgetIntImmCostIntrin(Intrinsic::ID IID,unsignedIdx,
1070constAPInt &Imm,Type *Ty,
1071TargetCostKindCostKind)const;
1072
1073 /// Return the expected cost for the given integer when optimising
1074 /// for size. This is different than the other integer immediate cost
1075 /// functions in that it is subtarget agnostic. This is useful when you e.g.
1076 /// target one ISA such as Aarch32 but smaller encodings could be possible
1077 /// with another such as Thumb. This return value is used as a penalty when
1078 /// the total costs for a constant is calculated (the bigger the cost, the
1079 /// more beneficial constant hoisting is).
1080InstructionCostgetIntImmCodeSizeCost(unsigned Opc,unsignedIdx,
1081constAPInt &Imm,Type *Ty)const;
1082
1083 /// It can be advantageous to detach complex constants from their uses to make
1084 /// their generation cheaper. This hook allows targets to report when such
1085 /// transformations might negatively effect the code generation of the
1086 /// underlying operation. The motivating example is divides whereby hoisting
1087 /// constants prevents the code generator's ability to transform them into
1088 /// combinations of simpler operations.
1089boolpreferToKeepConstantsAttached(constInstruction &Inst,
1090constFunction &Fn)const;
1091
1092 /// @}
1093
1094 /// \name Vector Target Information
1095 /// @{
1096
1097 /// The various kinds of shuffle patterns for vector queries.
1098enumShuffleKind {
1099SK_Broadcast,///< Broadcast element 0 to all other elements.
1100SK_Reverse,///< Reverse the order of the vector.
1101SK_Select,///< Selects elements from the corresponding lane of
1102 ///< either source operand. This is equivalent to a
1103 ///< vector select with a constant condition operand.
1104SK_Transpose,///< Transpose two vectors.
1105SK_InsertSubvector,///< InsertSubvector. Index indicates start offset.
1106SK_ExtractSubvector,///< ExtractSubvector Index indicates start offset.
1107SK_PermuteTwoSrc,///< Merge elements from two source vectors into one
1108 ///< with any shuffle mask.
1109SK_PermuteSingleSrc,///< Shuffle elements of single source vector with any
1110 ///< shuffle mask.
1111SK_Splice///< Concatenates elements from the first input vector
1112 ///< with elements of the second input vector. Returning
1113 ///< a vector of the same type as the input vectors.
1114 ///< Index indicates start offset in first input vector.
1115 };
1116
1117 /// Additional information about an operand's possible values.
1118enumOperandValueKind {
1119OK_AnyValue,// Operand can have any value.
1120OK_UniformValue,// Operand is uniform (splat of a value).
1121OK_UniformConstantValue,// Operand is uniform constant.
1122OK_NonUniformConstantValue// Operand is a non uniform constant value.
1123 };
1124
1125 /// Additional properties of an operand's values.
1126enumOperandValueProperties {
1127OP_None = 0,
1128OP_PowerOf2 = 1,
1129OP_NegatedPowerOf2 = 2,
1130 };
1131
1132// Describe the values an operand can take. We're in the process
1133// of migrating uses of OperandValueKind and OperandValueProperties
1134// to use this class, and then will change the internal representation.
1135structOperandValueInfo {
1136OperandValueKindKind =OK_AnyValue;
1137OperandValuePropertiesProperties =OP_None;
1138
1139boolisConstant() const{
1140returnKind ==OK_UniformConstantValue ||Kind ==OK_NonUniformConstantValue;
1141 }
1142boolisUniform() const{
1143returnKind ==OK_UniformConstantValue ||Kind ==OK_UniformValue;
1144 }
1145boolisPowerOf2() const{
1146returnProperties ==OP_PowerOf2;
1147 }
1148boolisNegatedPowerOf2() const{
1149returnProperties ==OP_NegatedPowerOf2;
1150 }
1151
1152OperandValueInfogetNoProps() const{
1153return {Kind,OP_None};
1154 }
1155 };
1156
1157 /// \return the number of registers in the target-provided register class.
1158unsignedgetNumberOfRegisters(unsigned ClassID)const;
1159
1160 /// \return true if the target supports load/store that enables fault
1161 /// suppression of memory operands when the source condition is false.
1162boolhasConditionalLoadStoreForType(Type *Ty =nullptr)const;
1163
1164 /// \return the target-provided register class ID for the provided type,
1165 /// accounting for type promotion and other type-legalization techniques that
1166 /// the target might apply. However, it specifically does not account for the
1167 /// scalarization or splitting of vector types. Should a vector type require
1168 /// scalarization or splitting into multiple underlying vector registers, that
1169 /// type should be mapped to a register class containing no registers.
1170 /// Specifically, this is designed to provide a simple, high-level view of the
1171 /// register allocation later performed by the backend. These register classes
1172 /// don't necessarily map onto the register classes used by the backend.
1173 /// FIXME: It's not currently possible to determine how many registers
1174 /// are used by the provided type.
1175unsignedgetRegisterClassForType(boolVector,Type *Ty =nullptr)const;
1176
1177 /// \return the target-provided register class name
1178constchar *getRegisterClassName(unsigned ClassID)const;
1179
1180enumRegisterKind {RGK_Scalar,RGK_FixedWidthVector,RGK_ScalableVector };
1181
1182 /// \return The width of the largest scalar or vector register type.
1183TypeSizegetRegisterBitWidth(RegisterKind K)const;
1184
1185 /// \return The width of the smallest vector register type.
1186unsignedgetMinVectorRegisterBitWidth()const;
1187
1188 /// \return The maximum value of vscale if the target specifies an
1189 /// architectural maximum vector length, and std::nullopt otherwise.
1190 std::optional<unsigned>getMaxVScale()const;
1191
1192 /// \return the value of vscale to tune the cost model for.
1193 std::optional<unsigned>getVScaleForTuning()const;
1194
1195 /// \return true if vscale is known to be a power of 2
1196boolisVScaleKnownToBeAPowerOfTwo()const;
1197
1198 /// \return True if the vectorization factor should be chosen to
1199 /// make the vector of the smallest element type match the size of a
1200 /// vector register. For wider element types, this could result in
1201 /// creating vectors that span multiple vector registers.
1202 /// If false, the vectorization factor will be chosen based on the
1203 /// size of the widest element type.
1204 /// \p K Register Kind for vectorization.
1205boolshouldMaximizeVectorBandwidth(TargetTransformInfo::RegisterKind K)const;
1206
1207 /// \return The minimum vectorization factor for types of given element
1208 /// bit width, or 0 if there is no minimum VF. The returned value only
1209 /// applies when shouldMaximizeVectorBandwidth returns true.
1210 /// If IsScalable is true, the returned ElementCount must be a scalable VF.
1211ElementCountgetMinimumVF(unsigned ElemWidth,bool IsScalable)const;
1212
1213 /// \return The maximum vectorization factor for types of given element
1214 /// bit width and opcode, or 0 if there is no maximum VF.
1215 /// Currently only used by the SLP vectorizer.
1216unsignedgetMaximumVF(unsigned ElemWidth,unsigned Opcode)const;
1217
1218 /// \return The minimum vectorization factor for the store instruction. Given
1219 /// the initial estimation of the minimum vector factor and store value type,
1220 /// it tries to find possible lowest VF, which still might be profitable for
1221 /// the vectorization.
1222 /// \param VF Initial estimation of the minimum vector factor.
1223 /// \param ScalarMemTy Scalar memory type of the store operation.
1224 /// \param ScalarValTy Scalar type of the stored value.
1225 /// Currently only used by the SLP vectorizer.
1226unsignedgetStoreMinimumVF(unsigned VF,Type *ScalarMemTy,
1227Type *ScalarValTy)const;
1228
1229 /// \return True if it should be considered for address type promotion.
1230 /// \p AllowPromotionWithoutCommonHeader Set true if promoting \p I is
1231 /// profitable without finding other extensions fed by the same input.
1232boolshouldConsiderAddressTypePromotion(
1233constInstruction &I,bool &AllowPromotionWithoutCommonHeader)const;
1234
1235 /// \return The size of a cache line in bytes.
1236unsignedgetCacheLineSize()const;
1237
1238 /// The possible cache levels
1239enum classCacheLevel {
1240L1D,// The L1 data cache
1241L2D,// The L2 data cache
1242
1243// We currently do not model L3 caches, as their sizes differ widely between
1244// microarchitectures. Also, we currently do not have a use for L3 cache
1245// size modeling yet.
1246 };
1247
1248 /// \return The size of the cache level in bytes, if available.
1249 std::optional<unsigned>getCacheSize(CacheLevel Level)const;
1250
1251 /// \return The associativity of the cache level, if available.
1252 std::optional<unsigned>getCacheAssociativity(CacheLevel Level)const;
1253
1254 /// \return The minimum architectural page size for the target.
1255 std::optional<unsigned>getMinPageSize()const;
1256
1257 /// \return How much before a load we should place the prefetch
1258 /// instruction. This is currently measured in number of
1259 /// instructions.
1260unsignedgetPrefetchDistance()const;
1261
1262 /// Some HW prefetchers can handle accesses up to a certain constant stride.
1263 /// Sometimes prefetching is beneficial even below the HW prefetcher limit,
1264 /// and the arguments provided are meant to serve as a basis for deciding this
1265 /// for a particular loop.
1266 ///
1267 /// \param NumMemAccesses Number of memory accesses in the loop.
1268 /// \param NumStridedMemAccesses Number of the memory accesses that
1269 /// ScalarEvolution could find a known stride
1270 /// for.
1271 /// \param NumPrefetches Number of software prefetches that will be
1272 /// emitted as determined by the addresses
1273 /// involved and the cache line size.
1274 /// \param HasCall True if the loop contains a call.
1275 ///
1276 /// \return This is the minimum stride in bytes where it makes sense to start
1277 /// adding SW prefetches. The default is 1, i.e. prefetch with any
1278 /// stride.
1279unsignedgetMinPrefetchStride(unsigned NumMemAccesses,
1280unsigned NumStridedMemAccesses,
1281unsigned NumPrefetches,bool HasCall)const;
1282
1283 /// \return The maximum number of iterations to prefetch ahead. If
1284 /// the required number of iterations is more than this number, no
1285 /// prefetching is performed.
1286unsignedgetMaxPrefetchIterationsAhead()const;
1287
1288 /// \return True if prefetching should also be done for writes.
1289boolenableWritePrefetching()const;
1290
1291 /// \return if target want to issue a prefetch in address space \p AS.
1292boolshouldPrefetchAddressSpace(unsigned AS)const;
1293
1294 /// \return The cost of a partial reduction, which is a reduction from a
1295 /// vector to another vector with fewer elements of larger size. They are
1296 /// represented by the llvm.experimental.partial.reduce.add intrinsic, which
1297 /// takes an accumulator and a binary operation operand that itself is fed by
1298 /// two extends. An example of an operation that uses a partial reduction is a
1299 /// dot product, which reduces two vectors to another of 4 times fewer and 4
1300 /// times larger elements.
1301InstructionCost
1302getPartialReductionCost(unsigned Opcode,Type *InputTypeA,Type *InputTypeB,
1303Type *AccumType,ElementCount VF,
1304PartialReductionExtendKind OpAExtend,
1305PartialReductionExtendKind OpBExtend,
1306 std::optional<unsigned> BinOp = std::nullopt)const;
1307
1308 /// \return The maximum interleave factor that any transform should try to
1309 /// perform for this target. This number depends on the level of parallelism
1310 /// and the number of execution units in the CPU.
1311unsignedgetMaxInterleaveFactor(ElementCount VF)const;
1312
1313 /// Collect properties of V used in cost analysis, e.g. OP_PowerOf2.
1314static OperandValueInfogetOperandInfo(constValue *V);
1315
1316 /// This is an approximation of reciprocal throughput of a math/logic op.
1317 /// A higher cost indicates less expected throughput.
1318 /// From Agner Fog's guides, reciprocal throughput is "the average number of
1319 /// clock cycles per instruction when the instructions are not part of a
1320 /// limiting dependency chain."
1321 /// Therefore, costs should be scaled to account for multiple execution units
1322 /// on the target that can process this type of instruction. For example, if
1323 /// there are 5 scalar integer units and 2 vector integer units that can
1324 /// calculate an 'add' in a single cycle, this model should indicate that the
1325 /// cost of the vector add instruction is 2.5 times the cost of the scalar
1326 /// add instruction.
1327 /// \p Args is an optional argument which holds the instruction operands
1328 /// values so the TTI can analyze those values searching for special
1329 /// cases or optimizations based on those values.
1330 /// \p CxtI is the optional original context instruction, if one exists, to
1331 /// provide even more information.
1332 /// \p TLibInfo is used to search for platform specific vector library
1333 /// functions for instructions that might be converted to calls (e.g. frem).
1334InstructionCostgetArithmeticInstrCost(
1335unsigned Opcode,Type *Ty,
1336TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput,
1337TTI::OperandValueInfo Opd1Info = {TTI::OK_AnyValue,TTI::OP_None},
1338 TTI::OperandValueInfo Opd2Info = {TTI::OK_AnyValue,TTI::OP_None},
1339 ArrayRef<const Value *>Args = {},const Instruction *CxtI =nullptr,
1340const TargetLibraryInfo *TLibInfo =nullptr)const;
1341
1342 /// Returns the cost estimation for alternating opcode pattern that can be
1343 /// lowered to a single instruction on the target. In X86 this is for the
1344 /// addsub instruction which corrsponds to a Shuffle + Fadd + FSub pattern in
1345 /// IR. This function expects two opcodes: \p Opcode1 and \p Opcode2 being
1346 /// selected by \p OpcodeMask. The mask contains one bit per lane and is a `0`
1347 /// when \p Opcode0 is selected and `1` when Opcode1 is selected.
1348 /// \p VecTy is the vector type of the instruction to be generated.
1349 InstructionCostgetAltInstrCost(
1350VectorType *VecTy,unsigned Opcode0,unsigned Opcode1,
1351const SmallBitVector &OpcodeMask,
1352TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput)const;
1353
1354 /// \return The cost of a shuffle instruction of kind Kind and of type Tp.
1355 /// The exact mask may be passed as Mask, or else the array will be empty.
1356 /// The index and subtype parameters are used by the subvector insertion and
1357 /// extraction shuffle kinds to show the insert/extract point and the type of
1358 /// the subvector being inserted/extracted. The operands of the shuffle can be
1359 /// passed through \p Args, which helps improve the cost estimation in some
1360 /// cases, like in broadcast loads.
1361 /// NOTE: For subvector extractions Tp represents the source type.
1362 InstructionCost
1363getShuffleCost(ShuffleKind Kind,VectorType *Tp, ArrayRef<int> Mask = {},
1364TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput,
1365intIndex = 0,VectorType *SubTp =nullptr,
1366 ArrayRef<const Value *>Args = {},
1367const Instruction *CxtI =nullptr)const;
1368
1369 /// Represents a hint about the context in which a cast is used.
1370 ///
1371 /// For zext/sext, the context of the cast is the operand, which must be a
1372 /// load of some kind. For trunc, the context is of the cast is the single
1373 /// user of the instruction, which must be a store of some kind.
1374 ///
1375 /// This enum allows the vectorizer to give getCastInstrCost an idea of the
1376 /// type of cast it's dealing with, as not every cast is equal. For instance,
1377 /// the zext of a load may be free, but the zext of an interleaving load can
1378 //// be (very) expensive!
1379 ///
1380 /// See \c getCastContextHint to compute a CastContextHint from a cast
1381 /// Instruction*. Callers can use it if they don't need to override the
1382 /// context and just want it to be calculated from the instruction.
1383 ///
1384 /// FIXME: This handles the types of load/store that the vectorizer can
1385 /// produce, which are the cases where the context instruction is most
1386 /// likely to be incorrect. There are other situations where that can happen
1387 /// too, which might be handled here but in the long run a more general
1388 /// solution of costing multiple instructions at the same times may be better.
1389enum classCastContextHint :uint8_t {
1390None,///< The cast is not used with a load/store of any kind.
1391Normal,///< The cast is used with a normal load/store.
1392Masked,///< The cast is used with a masked load/store.
1393GatherScatter,///< The cast is used with a gather/scatter.
1394Interleave,///< The cast is used with an interleaved load/store.
1395Reversed,///< The cast is used with a reversed load/store.
1396 };
1397
1398 /// Calculates a CastContextHint from \p I.
1399 /// This should be used by callers of getCastInstrCost if they wish to
1400 /// determine the context from some instruction.
1401 /// \returns the CastContextHint for ZExt/SExt/Trunc, None if \p I is nullptr,
1402 /// or if it's another type of cast.
1403staticCastContextHintgetCastContextHint(constInstruction *I);
1404
1405 /// \return The expected cost of cast instructions, such as bitcast, trunc,
1406 /// zext, etc. If there is an existing instruction that holds Opcode, it
1407 /// may be passed in the 'I' parameter.
1408InstructionCost
1409getCastInstrCost(unsigned Opcode,Type *Dst,Type *Src,
1410TTI::CastContextHint CCH,
1411TTI::TargetCostKindCostKind =TTI::TCK_SizeAndLatency,
1412constInstruction *I =nullptr)const;
1413
1414 /// \return The expected cost of a sign- or zero-extended vector extract. Use
1415 /// Index = -1 to indicate that there is no information about the index value.
1416InstructionCostgetExtractWithExtendCost(unsigned Opcode,Type *Dst,
1417VectorType *VecTy,
1418unsignedIndex)const;
1419
1420 /// \return The expected cost of control-flow related instructions such as
1421 /// Phi, Ret, Br, Switch.
1422InstructionCost
1423getCFInstrCost(unsigned Opcode,
1424TTI::TargetCostKindCostKind =TTI::TCK_SizeAndLatency,
1425constInstruction *I =nullptr)const;
1426
1427 /// \returns The expected cost of compare and select instructions. If there
1428 /// is an existing instruction that holds Opcode, it may be passed in the
1429 /// 'I' parameter. The \p VecPred parameter can be used to indicate the select
1430 /// is using a compare with the specified predicate as condition. When vector
1431 /// types are passed, \p VecPred must be used for all lanes. For a
1432 /// comparison, the two operands are the natural values. For a select, the
1433 /// two operands are the *value* operands, not the condition operand.
1434InstructionCost
1435getCmpSelInstrCost(unsigned Opcode,Type *ValTy,Type *CondTy,
1436CmpInst::Predicate VecPred,
1437TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput,
1438 OperandValueInfo Op1Info = {OK_AnyValue,OP_None},
1439 OperandValueInfo Op2Info = {OK_AnyValue,OP_None},
1440const Instruction *I =nullptr)const;
1441
1442 /// \return The expected cost of vector Insert and Extract.
1443 /// Use -1 to indicate that there is no information on the index value.
1444 /// This is used when the instruction is not available; a typical use
1445 /// case is to provision the cost of vectorization/scalarization in
1446 /// vectorizer passes.
1447 InstructionCostgetVectorInstrCost(unsigned Opcode, Type *Val,
1448TTI::TargetCostKindCostKind,
1449unsignedIndex = -1, Value *Op0 =nullptr,
1450 Value *Op1 =nullptr)const;
1451
1452 /// \return The expected cost of vector Insert and Extract.
1453 /// Use -1 to indicate that there is no information on the index value.
1454 /// This is used when the instruction is not available; a typical use
1455 /// case is to provision the cost of vectorization/scalarization in
1456 /// vectorizer passes.
1457 /// \param ScalarUserAndIdx encodes the information about extracts from a
1458 /// vector with 'Scalar' being the value being extracted,'User' being the user
1459 /// of the extract(nullptr if user is not known before vectorization) and
1460 /// 'Idx' being the extract lane.
1461 InstructionCostgetVectorInstrCost(
1462unsigned Opcode, Type *Val,TTI::TargetCostKindCostKind,unsignedIndex,
1463 Value *Scalar,
1464 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx)const;
1465
1466 /// \return The expected cost of vector Insert and Extract.
1467 /// This is used when instruction is available, and implementation
1468 /// asserts 'I' is not nullptr.
1469 ///
1470 /// A typical suitable use case is cost estimation when vector instruction
1471 /// exists (e.g., from basic blocks during transformation).
1472 InstructionCostgetVectorInstrCost(const Instruction &I, Type *Val,
1473TTI::TargetCostKindCostKind,
1474unsignedIndex = -1)const;
1475
1476 /// \return The cost of replication shuffle of \p VF elements typed \p EltTy
1477 /// \p ReplicationFactor times.
1478 ///
1479 /// For example, the mask for \p ReplicationFactor=3 and \p VF=4 is:
1480 /// <0,0,0,1,1,1,2,2,2,3,3,3>
1481 InstructionCostgetReplicationShuffleCost(Type *EltTy,int ReplicationFactor,
1482int VF,
1483const APInt &DemandedDstElts,
1484TTI::TargetCostKindCostKind)const;
1485
1486 /// \return The cost of Load and Store instructions.
1487 InstructionCost
1488getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
1489unsignedAddressSpace,
1490TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput,
1491 OperandValueInfo OpdInfo = {OK_AnyValue,OP_None},
1492const Instruction *I =nullptr)const;
1493
1494 /// \return The cost of VP Load and Store instructions.
1495 InstructionCost
1496getVPMemoryOpCost(unsigned Opcode,Type *Src,Align Alignment,
1497unsignedAddressSpace,
1498TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput,
1499constInstruction *I =nullptr)const;
1500
1501 /// \return The cost of masked Load and Store instructions.
1502InstructionCostgetMaskedMemoryOpCost(
1503unsigned Opcode,Type *Src,Align Alignment,unsignedAddressSpace,
1504TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput)const;
1505
1506 /// \return The cost of Gather or Scatter operation
1507 /// \p Opcode - is a type of memory access Load or Store
1508 /// \p DataTy - a vector type of the data to be loaded or stored
1509 /// \p Ptr - pointer [or vector of pointers] - address[es] in memory
1510 /// \p VariableMask - true when the memory access is predicated with a mask
1511 /// that is not a compile-time constant
1512 /// \p Alignment - alignment of single element
1513 /// \p I - the optional original context instruction, if one exists, e.g. the
1514 /// load/store to transform or the call to the gather/scatter intrinsic
1515InstructionCostgetGatherScatterOpCost(
1516unsigned Opcode,Type *DataTy,constValue *Ptr,bool VariableMask,
1517Align Alignment,TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput,
1518constInstruction *I =nullptr)const;
1519
1520 /// \return The cost of strided memory operations.
1521 /// \p Opcode - is a type of memory access Load or Store
1522 /// \p DataTy - a vector type of the data to be loaded or stored
1523 /// \p Ptr - pointer [or vector of pointers] - address[es] in memory
1524 /// \p VariableMask - true when the memory access is predicated with a mask
1525 /// that is not a compile-time constant
1526 /// \p Alignment - alignment of single element
1527 /// \p I - the optional original context instruction, if one exists, e.g. the
1528 /// load/store to transform or the call to the gather/scatter intrinsic
1529InstructionCostgetStridedMemoryOpCost(
1530unsigned Opcode,Type *DataTy,constValue *Ptr,bool VariableMask,
1531Align Alignment,TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput,
1532constInstruction *I =nullptr)const;
1533
1534 /// \return The cost of the interleaved memory operation.
1535 /// \p Opcode is the memory operation code
1536 /// \p VecTy is the vector type of the interleaved access.
1537 /// \p Factor is the interleave factor
1538 /// \p Indices is the indices for interleaved load members (as interleaved
1539 /// load allows gaps)
1540 /// \p Alignment is the alignment of the memory operation
1541 /// \p AddressSpace is address space of the pointer.
1542 /// \p UseMaskForCond indicates if the memory access is predicated.
1543 /// \p UseMaskForGaps indicates if gaps should be masked.
1544InstructionCostgetInterleavedMemoryOpCost(
1545unsigned Opcode,Type *VecTy,unsigned Factor,ArrayRef<unsigned> Indices,
1546Align Alignment,unsignedAddressSpace,
1547TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput,
1548bool UseMaskForCond =false,bool UseMaskForGaps =false)const;
1549
1550 /// A helper function to determine the type of reduction algorithm used
1551 /// for a given \p Opcode and set of FastMathFlags \p FMF.
1552staticboolrequiresOrderedReduction(std::optional<FastMathFlags> FMF) {
1553return FMF && !(*FMF).allowReassoc();
1554 }
1555
1556 /// Calculate the cost of vector reduction intrinsics.
1557 ///
1558 /// This is the cost of reducing the vector value of type \p Ty to a scalar
1559 /// value using the operation denoted by \p Opcode. The FastMathFlags
1560 /// parameter \p FMF indicates what type of reduction we are performing:
1561 /// 1. Tree-wise. This is the typical 'fast' reduction performed that
1562 /// involves successively splitting a vector into half and doing the
1563 /// operation on the pair of halves until you have a scalar value. For
1564 /// example:
1565 /// (v0, v1, v2, v3)
1566 /// ((v0+v2), (v1+v3), undef, undef)
1567 /// ((v0+v2+v1+v3), undef, undef, undef)
1568 /// This is the default behaviour for integer operations, whereas for
1569 /// floating point we only do this if \p FMF indicates that
1570 /// reassociation is allowed.
1571 /// 2. Ordered. For a vector with N elements this involves performing N
1572 /// operations in lane order, starting with an initial scalar value, i.e.
1573 /// result = InitVal + v0
1574 /// result = result + v1
1575 /// result = result + v2
1576 /// result = result + v3
1577 /// This is only the case for FP operations and when reassociation is not
1578 /// allowed.
1579 ///
1580InstructionCostgetArithmeticReductionCost(
1581unsigned Opcode,VectorType *Ty, std::optional<FastMathFlags> FMF,
1582TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput)const;
1583
1584InstructionCostgetMinMaxReductionCost(
1585Intrinsic::ID IID,VectorType *Ty,FastMathFlags FMF =FastMathFlags(),
1586TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput)const;
1587
1588 /// Calculate the cost of an extended reduction pattern, similar to
1589 /// getArithmeticReductionCost of an Add reduction with multiply and optional
1590 /// extensions. This is the cost of as:
1591 /// ResTy vecreduce.add(mul (A, B)).
1592 /// ResTy vecreduce.add(mul(ext(Ty A), ext(Ty B)).
1593InstructionCostgetMulAccReductionCost(
1594bool IsUnsigned,Type *ResTy,VectorType *Ty,
1595TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput)const;
1596
1597 /// Calculate the cost of an extended reduction pattern, similar to
1598 /// getArithmeticReductionCost of a reduction with an extension.
1599 /// This is the cost of as:
1600 /// ResTy vecreduce.opcode(ext(Ty A)).
1601InstructionCostgetExtendedReductionCost(
1602unsigned Opcode,bool IsUnsigned,Type *ResTy,VectorType *Ty,
1603FastMathFlags FMF,
1604TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput)const;
1605
1606 /// \returns The cost of Intrinsic instructions. Analyses the real arguments.
1607 /// Three cases are handled: 1. scalar instruction 2. vector instruction
1608 /// 3. scalar instruction which is to be vectorized.
1609InstructionCostgetIntrinsicInstrCost(constIntrinsicCostAttributes &ICA,
1610TTI::TargetCostKindCostKind)const;
1611
1612 /// \returns The cost of Call instructions.
1613InstructionCostgetCallInstrCost(
1614Function *F,Type *RetTy,ArrayRef<Type *> Tys,
1615TTI::TargetCostKindCostKind =TTI::TCK_SizeAndLatency)const;
1616
1617 /// \returns The number of pieces into which the provided type must be
1618 /// split during legalization. Zero is returned when the answer is unknown.
1619unsignedgetNumberOfParts(Type *Tp)const;
1620
1621 /// \returns The cost of the address computation. For most targets this can be
1622 /// merged into the instruction indexing mode. Some targets might want to
1623 /// distinguish between address computation for memory operations on vector
1624 /// types and scalar types. Such targets should override this function.
1625 /// The 'SE' parameter holds pointer for the scalar evolution object which
1626 /// is used in order to get the Ptr step value in case of constant stride.
1627 /// The 'Ptr' parameter holds SCEV of the access pointer.
1628InstructionCostgetAddressComputationCost(Type *Ty,
1629ScalarEvolution *SE =nullptr,
1630constSCEV *Ptr =nullptr)const;
1631
1632 /// \returns The cost, if any, of keeping values of the given types alive
1633 /// over a callsite.
1634 ///
1635 /// Some types may require the use of register classes that do not have
1636 /// any callee-saved registers, so would require a spill and fill.
1637InstructionCostgetCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys)const;
1638
1639 /// \returns True if the intrinsic is a supported memory intrinsic. Info
1640 /// will contain additional information - whether the intrinsic may write
1641 /// or read to memory, volatility and the pointer. Info is undefined
1642 /// if false is returned.
1643boolgetTgtMemIntrinsic(IntrinsicInst *Inst,MemIntrinsicInfo &Info)const;
1644
1645 /// \returns The maximum element size, in bytes, for an element
1646 /// unordered-atomic memory intrinsic.
1647unsignedgetAtomicMemIntrinsicMaxElementSize()const;
1648
1649 /// \returns A value which is the result of the given memory intrinsic. New
1650 /// instructions may be created to extract the result from the given intrinsic
1651 /// memory operation. Returns nullptr if the target cannot create a result
1652 /// from the given intrinsic.
1653Value *getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst,
1654Type *ExpectedType)const;
1655
1656 /// \returns The type to use in a loop expansion of a memcpy call.
1657Type *getMemcpyLoopLoweringType(
1658LLVMContext &Context,Value *Length,unsigned SrcAddrSpace,
1659unsigned DestAddrSpace,Align SrcAlign,Align DestAlign,
1660 std::optional<uint32_t> AtomicElementSize = std::nullopt)const;
1661
1662 /// \param[out] OpsOut The operand types to copy RemainingBytes of memory.
1663 /// \param RemainingBytes The number of bytes to copy.
1664 ///
1665 /// Calculates the operand types to use when copying \p RemainingBytes of
1666 /// memory, where source and destination alignments are \p SrcAlign and
1667 /// \p DestAlign respectively.
1668voidgetMemcpyLoopResidualLoweringType(
1669SmallVectorImpl<Type *> &OpsOut,LLVMContext &Context,
1670unsigned RemainingBytes,unsigned SrcAddrSpace,unsigned DestAddrSpace,
1671Align SrcAlign,Align DestAlign,
1672 std::optional<uint32_t> AtomicCpySize = std::nullopt)const;
1673
1674 /// \returns True if the two functions have compatible attributes for inlining
1675 /// purposes.
1676boolareInlineCompatible(constFunction *Caller,
1677constFunction *Callee)const;
1678
1679 /// Returns a penalty for invoking call \p Call in \p F.
1680 /// For example, if a function F calls a function G, which in turn calls
1681 /// function H, then getInlineCallPenalty(F, H()) would return the
1682 /// penalty of calling H from F, e.g. after inlining G into F.
1683 /// \p DefaultCallPenalty is passed to give a default penalty that
1684 /// the target can amend or override.
1685unsignedgetInlineCallPenalty(constFunction *F,constCallBase &Call,
1686unsigned DefaultCallPenalty)const;
1687
1688 /// \returns True if the caller and callee agree on how \p Types will be
1689 /// passed to or returned from the callee.
1690 /// to the callee.
1691 /// \param Types List of types to check.
1692boolareTypesABICompatible(constFunction *Caller,constFunction *Callee,
1693constArrayRef<Type *> &Types)const;
1694
1695 /// The type of load/store indexing.
1696enumMemIndexedMode {
1697MIM_Unindexed,///< No indexing.
1698MIM_PreInc,///< Pre-incrementing.
1699MIM_PreDec,///< Pre-decrementing.
1700MIM_PostInc,///< Post-incrementing.
1701MIM_PostDec///< Post-decrementing.
1702 };
1703
1704 /// \returns True if the specified indexed load for the given type is legal.
1705boolisIndexedLoadLegal(enumMemIndexedModeMode,Type *Ty)const;
1706
1707 /// \returns True if the specified indexed store for the given type is legal.
1708boolisIndexedStoreLegal(enumMemIndexedModeMode,Type *Ty)const;
1709
1710 /// \returns The bitwidth of the largest vector type that should be used to
1711 /// load/store in the given address space.
1712unsignedgetLoadStoreVecRegBitWidth(unsigned AddrSpace)const;
1713
1714 /// \returns True if the load instruction is legal to vectorize.
1715boolisLegalToVectorizeLoad(LoadInst *LI)const;
1716
1717 /// \returns True if the store instruction is legal to vectorize.
1718boolisLegalToVectorizeStore(StoreInst *SI)const;
1719
1720 /// \returns True if it is legal to vectorize the given load chain.
1721boolisLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,Align Alignment,
1722unsigned AddrSpace)const;
1723
1724 /// \returns True if it is legal to vectorize the given store chain.
1725boolisLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,Align Alignment,
1726unsigned AddrSpace)const;
1727
1728 /// \returns True if it is legal to vectorize the given reduction kind.
1729boolisLegalToVectorizeReduction(constRecurrenceDescriptor &RdxDesc,
1730ElementCount VF)const;
1731
1732 /// \returns True if the given type is supported for scalable vectors
1733boolisElementTypeLegalForScalableVector(Type *Ty)const;
1734
1735 /// \returns The new vector factor value if the target doesn't support \p
1736 /// SizeInBytes loads or has a better vector factor.
1737unsignedgetLoadVectorFactor(unsigned VF,unsigned LoadSize,
1738unsigned ChainSizeInBytes,
1739VectorType *VecTy)const;
1740
1741 /// \returns The new vector factor value if the target doesn't support \p
1742 /// SizeInBytes stores or has a better vector factor.
1743unsignedgetStoreVectorFactor(unsigned VF,unsigned StoreSize,
1744unsigned ChainSizeInBytes,
1745VectorType *VecTy)const;
1746
1747 /// Flags describing the kind of vector reduction.
1748structReductionFlags {
1749ReductionFlags() =default;
1750boolIsMaxOp =
1751false;///< If the op a min/max kind, true if it's a max operation.
1752boolIsSigned =false;///< Whether the operation is a signed int reduction.
1753boolNoNaN =
1754false;///< If op is an fp min/max, whether NaNs may be present.
1755 };
1756
1757 /// \returns True if the targets prefers fixed width vectorization if the
1758 /// loop vectorizer's cost-model assigns an equal cost to the fixed and
1759 /// scalable version of the vectorized loop.
1760boolpreferFixedOverScalableIfEqualCost()const;
1761
1762 /// \returns True if the target prefers reductions in loop.
1763boolpreferInLoopReduction(unsigned Opcode,Type *Ty,
1764ReductionFlags Flags)const;
1765
1766 /// \returns True if the target prefers reductions select kept in the loop
1767 /// when tail folding. i.e.
1768 /// loop:
1769 /// p = phi (0, s)
1770 /// a = add (p, x)
1771 /// s = select (mask, a, p)
1772 /// vecreduce.add(s)
1773 ///
1774 /// As opposed to the normal scheme of p = phi (0, a) which allows the select
1775 /// to be pulled out of the loop. If the select(.., add, ..) can be predicated
1776 /// by the target, this can lead to cleaner code generation.
1777boolpreferPredicatedReductionSelect(unsigned Opcode,Type *Ty,
1778ReductionFlags Flags)const;
1779
1780 /// Return true if the loop vectorizer should consider vectorizing an
1781 /// otherwise scalar epilogue loop.
1782boolpreferEpilogueVectorization()const;
1783
1784 /// \returns True if the target wants to expand the given reduction intrinsic
1785 /// into a shuffle sequence.
1786boolshouldExpandReduction(constIntrinsicInst *II)const;
1787
1788enum structReductionShuffle {SplitHalf,Pairwise };
1789
1790 /// \returns The shuffle sequence pattern used to expand the given reduction
1791 /// intrinsic.
1792ReductionShuffle
1793getPreferredExpandedReductionShuffle(constIntrinsicInst *II)const;
1794
1795 /// \returns the size cost of rematerializing a GlobalValue address relative
1796 /// to a stack reload.
1797unsignedgetGISelRematGlobalCost()const;
1798
1799 /// \returns the lower bound of a trip count to decide on vectorization
1800 /// while tail-folding.
1801unsignedgetMinTripCountTailFoldingThreshold()const;
1802
1803 /// \returns True if the target supports scalable vectors.
1804boolsupportsScalableVectors()const;
1805
1806 /// \return true when scalable vectorization is preferred.
1807boolenableScalableVectorization()const;
1808
1809 /// \name Vector Predication Information
1810 /// @{
1811 /// Whether the target supports the %evl parameter of VP intrinsic efficiently
1812 /// in hardware, for the given opcode and type/alignment. (see LLVM Language
1813 /// Reference - "Vector Predication Intrinsics").
1814 /// Use of %evl is discouraged when that is not the case.
1815boolhasActiveVectorLength(unsigned Opcode,Type *DataType,
1816Align Alignment)const;
1817
1818 /// Return true if sinking I's operands to the same basic block as I is
1819 /// profitable, e.g. because the operands can be folded into a target
1820 /// instruction during instruction selection. After calling the function
1821 /// \p Ops contains the Uses to sink ordered by dominance (dominating users
1822 /// come first).
1823boolisProfitableToSinkOperands(Instruction *I,
1824SmallVectorImpl<Use *> &Ops)const;
1825
1826 /// Return true if it's significantly cheaper to shift a vector by a uniform
1827 /// scalar than by an amount which will vary across each lane. On x86 before
1828 /// AVX2 for example, there is a "psllw" instruction for the former case, but
1829 /// no simple instruction for a general "a << b" operation on vectors.
1830 /// This should also apply to lowering for vector funnel shifts (rotates).
1831boolisVectorShiftByScalarCheap(Type *Ty)const;
1832
1833structVPLegalization {
1834enumVPTransform {
1835// keep the predicating parameter
1836Legal = 0,
1837// where legal, discard the predicate parameter
1838Discard = 1,
1839// transform into something else that is also predicating
1840Convert = 2
1841 };
1842
1843// How to transform the EVL parameter.
1844// Legal: keep the EVL parameter as it is.
1845// Discard: Ignore the EVL parameter where it is safe to do so.
1846// Convert: Fold the EVL into the mask parameter.
1847VPTransformEVLParamStrategy;
1848
1849// How to transform the operator.
1850// Legal: The target supports this operator.
1851// Convert: Convert this to a non-VP operation.
1852// The 'Discard' strategy is invalid.
1853VPTransformOpStrategy;
1854
1855boolshouldDoNothing() const{
1856return (EVLParamStrategy ==Legal) && (OpStrategy ==Legal);
1857 }
1858VPLegalization(VPTransformEVLParamStrategy,VPTransformOpStrategy)
1859 :EVLParamStrategy(EVLParamStrategy),OpStrategy(OpStrategy) {}
1860 };
1861
1862 /// \returns How the target needs this vector-predicated operation to be
1863 /// transformed.
1864VPLegalizationgetVPLegalizationStrategy(constVPIntrinsic &PI)const;
1865 /// @}
1866
1867 /// \returns Whether a 32-bit branch instruction is available in Arm or Thumb
1868 /// state.
1869 ///
1870 /// Used by the LowerTypeTests pass, which constructs an IR inline assembler
1871 /// node containing a jump table in a format suitable for the target, so it
1872 /// needs to know what format of jump table it can legally use.
1873 ///
1874 /// For non-Arm targets, this function isn't used. It defaults to returning
1875 /// false, but it shouldn't matter what it returns anyway.
1876boolhasArmWideBranch(bool Thumb)const;
1877
1878 /// Returns a bitmask constructed from the target-features or fmv-features
1879 /// metadata of a function.
1880uint64_tgetFeatureMask(constFunction &F)const;
1881
1882 /// Returns true if this is an instance of a function with multiple versions.
1883boolisMultiversionedFunction(constFunction &F)const;
1884
1885 /// \return The maximum number of function arguments the target supports.
1886unsignedgetMaxNumArgs()const;
1887
1888 /// \return For an array of given Size, return alignment boundary to
1889 /// pad to. Default is no padding.
1890unsignedgetNumBytesToPadGlobalArray(unsignedSize,Type *ArrayType)const;
1891
1892 /// @}
1893
1894private:
1895 /// The abstract base class used to type erase specific TTI
1896 /// implementations.
1897classConcept;
1898
1899 /// The template model for the base class which wraps a concrete
1900 /// implementation in a type erased interface.
1901template <typename T>classModel;
1902
1903 std::unique_ptr<Concept> TTIImpl;
1904};
1905
1906classTargetTransformInfo::Concept {
1907public:
1908virtual~Concept() = 0;
1909virtualconstDataLayout &getDataLayout()const = 0;
1910virtualInstructionCostgetGEPCost(Type *PointeeType,constValue *Ptr,
1911ArrayRef<const Value *>Operands,
1912Type *AccessType,
1913TTI::TargetCostKindCostKind) = 0;
1914virtualInstructionCost
1915getPointersChainCost(ArrayRef<const Value *> Ptrs,constValue *Base,
1916constTTI::PointersChainInfo &Info,Type *AccessTy,
1917TTI::TargetCostKindCostKind) = 0;
1918virtualunsignedgetInliningThresholdMultiplier()const = 0;
1919virtualunsignedgetInliningCostBenefitAnalysisSavingsMultiplier()const = 0;
1920virtualunsigned
1921getInliningCostBenefitAnalysisProfitableMultiplier()const = 0;
1922virtualintgetInliningLastCallToStaticBonus()const = 0;
1923virtualunsignedadjustInliningThreshold(constCallBase *CB) = 0;
1924virtualintgetInlinerVectorBonusPercent()const = 0;
1925virtualunsignedgetCallerAllocaCost(constCallBase *CB,
1926constAllocaInst *AI)const = 0;
1927virtualInstructionCostgetMemcpyCost(constInstruction *I) = 0;
1928virtualuint64_tgetMaxMemIntrinsicInlineSizeThreshold()const = 0;
1929virtualunsigned
1930getEstimatedNumberOfCaseClusters(constSwitchInst &SI,unsigned &JTSize,
1931ProfileSummaryInfo *PSI,
1932BlockFrequencyInfo *BFI) = 0;
1933virtualInstructionCostgetInstructionCost(constUser *U,
1934ArrayRef<const Value *>Operands,
1935TargetCostKindCostKind) = 0;
1936virtualBranchProbabilitygetPredictableBranchThreshold() = 0;
1937virtualInstructionCostgetBranchMispredictPenalty() = 0;
1938virtualboolhasBranchDivergence(constFunction *F =nullptr) = 0;
1939virtualboolisSourceOfDivergence(constValue *V) = 0;
1940virtualboolisAlwaysUniform(constValue *V) = 0;
1941virtualboolisValidAddrSpaceCast(unsigned FromAS,unsigned ToAS)const = 0;
1942virtualbooladdrspacesMayAlias(unsigned AS0,unsigned AS1)const = 0;
1943virtualunsignedgetFlatAddressSpace() = 0;
1944virtualboolcollectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
1945Intrinsic::ID IID)const = 0;
1946virtualboolisNoopAddrSpaceCast(unsigned FromAS,unsigned ToAS)const = 0;
1947virtualbool
1948canHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS)const = 0;
1949virtualunsignedgetAssumedAddrSpace(constValue *V)const = 0;
1950virtualboolisSingleThreaded()const = 0;
1951virtual std::pair<const Value *, unsigned>
1952getPredicatedAddrSpace(constValue *V)const = 0;
1953virtualValue *rewriteIntrinsicWithAddressSpace(IntrinsicInst *II,
1954Value *OldV,
1955Value *NewV)const = 0;
1956virtualboolisLoweredToCall(constFunction *F) = 0;
1957virtualvoidgetUnrollingPreferences(Loop *L,ScalarEvolution &,
1958UnrollingPreferences &UP,
1959OptimizationRemarkEmitter *ORE) = 0;
1960virtualvoidgetPeelingPreferences(Loop *L,ScalarEvolution &SE,
1961PeelingPreferences &PP) = 0;
1962virtualboolisHardwareLoopProfitable(Loop *L,ScalarEvolution &SE,
1963AssumptionCache &AC,
1964TargetLibraryInfo *LibInfo,
1965HardwareLoopInfo &HWLoopInfo) = 0;
1966virtualunsignedgetEpilogueVectorizationMinVF() = 0;
1967virtualboolpreferPredicateOverEpilogue(TailFoldingInfo *TFI) = 0;
1968virtualTailFoldingStyle
1969getPreferredTailFoldingStyle(bool IVUpdateMayOverflow =true) = 0;
1970virtual std::optional<Instruction *>instCombineIntrinsic(
1971InstCombiner &IC,IntrinsicInst &II) = 0;
1972virtual std::optional<Value *>simplifyDemandedUseBitsIntrinsic(
1973InstCombiner &IC,IntrinsicInst &II,APInt DemandedMask,
1974KnownBits & Known,bool &KnownBitsComputed) = 0;
1975virtual std::optional<Value *>simplifyDemandedVectorEltsIntrinsic(
1976InstCombiner &IC,IntrinsicInst &II,APInt DemandedElts,
1977APInt &UndefElts,APInt &UndefElts2,APInt &UndefElts3,
1978 std::function<void(Instruction *,unsigned,APInt,APInt &)>
1979 SimplifyAndSetOp) = 0;
1980virtualboolisLegalAddImmediate(int64_t Imm) = 0;
1981virtualboolisLegalAddScalableImmediate(int64_t Imm) = 0;
1982virtualboolisLegalICmpImmediate(int64_t Imm) = 0;
1983virtualboolisLegalAddressingMode(Type *Ty,GlobalValue *BaseGV,
1984 int64_t BaseOffset,bool HasBaseReg,
1985 int64_t Scale,unsigned AddrSpace,
1986Instruction *I,
1987 int64_t ScalableOffset) = 0;
1988virtualboolisLSRCostLess(constTargetTransformInfo::LSRCost &C1,
1989constTargetTransformInfo::LSRCost &C2) = 0;
1990virtualboolisNumRegsMajorCostOfLSR() = 0;
1991virtualboolshouldDropLSRSolutionIfLessProfitable()const = 0;
1992virtualboolisProfitableLSRChainElement(Instruction *I) = 0;
1993virtualboolcanMacroFuseCmp() = 0;
1994virtualboolcanSaveCmp(Loop *L,BranchInst **BI,ScalarEvolution *SE,
1995LoopInfo *LI,DominatorTree *DT,AssumptionCache *AC,
1996TargetLibraryInfo *LibInfo) = 0;
1997virtualAddressingModeKind
1998getPreferredAddressingMode(constLoop *L,ScalarEvolution *SE)const = 0;
1999virtualboolisLegalMaskedStore(Type *DataType,Align Alignment) = 0;
2000virtualboolisLegalMaskedLoad(Type *DataType,Align Alignment) = 0;
2001virtualboolisLegalNTStore(Type *DataType,Align Alignment) = 0;
2002virtualboolisLegalNTLoad(Type *DataType,Align Alignment) = 0;
2003virtualboolisLegalBroadcastLoad(Type *ElementTy,
2004ElementCount NumElements)const = 0;
2005virtualboolisLegalMaskedScatter(Type *DataType,Align Alignment) = 0;
2006virtualboolisLegalMaskedGather(Type *DataType,Align Alignment) = 0;
2007virtualboolforceScalarizeMaskedGather(VectorType *DataType,
2008Align Alignment) = 0;
2009virtualboolforceScalarizeMaskedScatter(VectorType *DataType,
2010Align Alignment) = 0;
2011virtualboolisLegalMaskedCompressStore(Type *DataType,Align Alignment) = 0;
2012virtualboolisLegalMaskedExpandLoad(Type *DataType,Align Alignment) = 0;
2013virtualboolisLegalStridedLoadStore(Type *DataType,Align Alignment) = 0;
2014virtualboolisLegalInterleavedAccessType(VectorType *VTy,unsigned Factor,
2015Align Alignment,
2016unsigned AddrSpace) = 0;
2017
2018virtualboolisLegalMaskedVectorHistogram(Type *AddrType,Type *DataType) = 0;
2019virtualboolisLegalAltInstr(VectorType *VecTy,unsigned Opcode0,
2020unsigned Opcode1,
2021constSmallBitVector &OpcodeMask)const = 0;
2022virtualboolenableOrderedReductions() = 0;
2023virtualboolhasDivRemOp(Type *DataType,bool IsSigned) = 0;
2024virtualboolhasVolatileVariant(Instruction *I,unsigned AddrSpace) = 0;
2025virtualboolprefersVectorizedAddressing() = 0;
2026virtualInstructionCostgetScalingFactorCost(Type *Ty,GlobalValue *BaseGV,
2027StackOffset BaseOffset,
2028bool HasBaseReg, int64_t Scale,
2029unsigned AddrSpace) = 0;
2030virtualboolLSRWithInstrQueries() = 0;
2031virtualboolisTruncateFree(Type *Ty1,Type *Ty2) = 0;
2032virtualboolisProfitableToHoist(Instruction *I) = 0;
2033virtualbooluseAA() = 0;
2034virtualboolisTypeLegal(Type *Ty) = 0;
2035virtualunsignedgetRegUsageForType(Type *Ty) = 0;
2036virtualboolshouldBuildLookupTables() = 0;
2037virtualboolshouldBuildLookupTablesForConstant(Constant *C) = 0;
2038virtualboolshouldBuildRelLookupTables() = 0;
2039virtualbooluseColdCCForColdCall(Function &F) = 0;
2040virtualboolisTargetIntrinsicTriviallyScalarizable(Intrinsic::IDID) = 0;
2041virtualboolisTargetIntrinsicWithScalarOpAtArg(Intrinsic::IDID,
2042unsigned ScalarOpdIdx) = 0;
2043virtualboolisTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::IDID,
2044int OpdIdx) = 0;
2045virtualbool
2046isTargetIntrinsicWithStructReturnOverloadAtField(Intrinsic::IDID,
2047int RetIdx) = 0;
2048virtualInstructionCost
2049getScalarizationOverhead(VectorType *Ty,constAPInt &DemandedElts,
2050bool Insert,bool Extract,TargetCostKindCostKind,
2051ArrayRef<Value *> VL = {}) = 0;
2052virtualInstructionCost
2053getOperandsScalarizationOverhead(ArrayRef<const Value *> Args,
2054ArrayRef<Type *> Tys,
2055TargetCostKindCostKind) = 0;
2056virtualboolsupportsEfficientVectorElementLoadStore() = 0;
2057virtualboolsupportsTailCalls() = 0;
2058virtualboolsupportsTailCallFor(constCallBase *CB) = 0;
2059virtualboolenableAggressiveInterleaving(bool LoopHasReductions) = 0;
2060virtualMemCmpExpansionOptions
2061enableMemCmpExpansion(bool OptSize,bool IsZeroCmp)const = 0;
2062virtualboolenableSelectOptimize() = 0;
2063virtualboolshouldTreatInstructionLikeSelect(constInstruction *I) = 0;
2064virtualboolenableInterleavedAccessVectorization() = 0;
2065virtualboolenableMaskedInterleavedAccessVectorization() = 0;
2066virtualboolisFPVectorizationPotentiallyUnsafe() = 0;
2067virtualboolallowsMisalignedMemoryAccesses(LLVMContext &Context,
2068unsignedBitWidth,
2069unsignedAddressSpace,
2070Align Alignment,
2071unsigned *Fast) = 0;
2072virtualPopcntSupportKindgetPopcntSupport(unsigned IntTyWidthInBit) = 0;
2073virtualboolhaveFastSqrt(Type *Ty) = 0;
2074virtualboolisExpensiveToSpeculativelyExecute(constInstruction *I) = 0;
2075virtualboolisFCmpOrdCheaperThanFCmpZero(Type *Ty) = 0;
2076virtualInstructionCostgetFPOpCost(Type *Ty) = 0;
2077virtualInstructionCostgetIntImmCodeSizeCost(unsigned Opc,unsignedIdx,
2078constAPInt &Imm,Type *Ty) = 0;
2079virtualInstructionCostgetIntImmCost(constAPInt &Imm,Type *Ty,
2080TargetCostKindCostKind) = 0;
2081virtualInstructionCostgetIntImmCostInst(unsigned Opc,unsignedIdx,
2082constAPInt &Imm,Type *Ty,
2083TargetCostKindCostKind,
2084Instruction *Inst =nullptr) = 0;
2085virtualInstructionCostgetIntImmCostIntrin(Intrinsic::ID IID,unsignedIdx,
2086constAPInt &Imm,Type *Ty,
2087TargetCostKindCostKind) = 0;
2088virtualboolpreferToKeepConstantsAttached(constInstruction &Inst,
2089constFunction &Fn)const = 0;
2090virtualunsignedgetNumberOfRegisters(unsigned ClassID)const = 0;
2091virtualboolhasConditionalLoadStoreForType(Type *Ty =nullptr)const = 0;
2092virtualunsignedgetRegisterClassForType(boolVector,
2093Type *Ty =nullptr)const = 0;
2094virtualconstchar *getRegisterClassName(unsigned ClassID)const = 0;
2095virtualTypeSizegetRegisterBitWidth(RegisterKind K)const = 0;
2096virtualunsignedgetMinVectorRegisterBitWidth()const = 0;
2097virtual std::optional<unsigned>getMaxVScale()const = 0;
2098virtual std::optional<unsigned>getVScaleForTuning()const = 0;
2099virtualboolisVScaleKnownToBeAPowerOfTwo()const = 0;
2100virtualbool
2101shouldMaximizeVectorBandwidth(TargetTransformInfo::RegisterKind K)const = 0;
2102virtualElementCountgetMinimumVF(unsigned ElemWidth,
2103bool IsScalable)const = 0;
2104virtualunsignedgetMaximumVF(unsigned ElemWidth,unsigned Opcode)const = 0;
2105virtualunsignedgetStoreMinimumVF(unsigned VF,Type *ScalarMemTy,
2106Type *ScalarValTy)const = 0;
2107virtualboolshouldConsiderAddressTypePromotion(
2108constInstruction &I,bool &AllowPromotionWithoutCommonHeader) = 0;
2109virtualunsignedgetCacheLineSize()const = 0;
2110virtual std::optional<unsigned>getCacheSize(CacheLevel Level)const = 0;
2111virtual std::optional<unsigned>getCacheAssociativity(CacheLevel Level)
2112const = 0;
2113virtual std::optional<unsigned>getMinPageSize()const = 0;
2114
2115 /// \return How much before a load we should place the prefetch
2116 /// instruction. This is currently measured in number of
2117 /// instructions.
2118virtualunsignedgetPrefetchDistance()const = 0;
2119
2120 /// \return Some HW prefetchers can handle accesses up to a certain
2121 /// constant stride. This is the minimum stride in bytes where it
2122 /// makes sense to start adding SW prefetches. The default is 1,
2123 /// i.e. prefetch with any stride. Sometimes prefetching is beneficial
2124 /// even below the HW prefetcher limit, and the arguments provided are
2125 /// meant to serve as a basis for deciding this for a particular loop.
2126virtualunsignedgetMinPrefetchStride(unsigned NumMemAccesses,
2127unsigned NumStridedMemAccesses,
2128unsigned NumPrefetches,
2129bool HasCall)const = 0;
2130
2131 /// \return The maximum number of iterations to prefetch ahead. If
2132 /// the required number of iterations is more than this number, no
2133 /// prefetching is performed.
2134virtualunsignedgetMaxPrefetchIterationsAhead()const = 0;
2135
2136 /// \return True if prefetching should also be done for writes.
2137virtualboolenableWritePrefetching()const = 0;
2138
2139 /// \return if target want to issue a prefetch in address space \p AS.
2140virtualboolshouldPrefetchAddressSpace(unsigned AS)const = 0;
2141
2142 /// \return The cost of a partial reduction, which is a reduction from a
2143 /// vector to another vector with fewer elements of larger size. They are
2144 /// represented by the llvm.experimental.partial.reduce.add intrinsic, which
2145 /// takes an accumulator and a binary operation operand that itself is fed by
2146 /// two extends. An example of an operation that uses a partial reduction is a
2147 /// dot product, which reduces two vectors to another of 4 times fewer and 4
2148 /// times larger elements.
2149virtualInstructionCost
2150getPartialReductionCost(unsigned Opcode,Type *InputTypeA,Type *InputTypeB,
2151Type *AccumType,ElementCount VF,
2152PartialReductionExtendKind OpAExtend,
2153PartialReductionExtendKind OpBExtend,
2154 std::optional<unsigned> BinOp)const = 0;
2155
2156virtualunsignedgetMaxInterleaveFactor(ElementCount VF) = 0;
2157virtualInstructionCostgetArithmeticInstrCost(
2158unsigned Opcode,Type *Ty,TTI::TargetCostKindCostKind,
2159OperandValueInfo Opd1Info,OperandValueInfo Opd2Info,
2160ArrayRef<const Value *> Args,constInstruction *CxtI =nullptr) = 0;
2161virtualInstructionCostgetAltInstrCost(
2162VectorType *VecTy,unsigned Opcode0,unsigned Opcode1,
2163constSmallBitVector &OpcodeMask,
2164TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput)const = 0;
2165
2166virtualInstructionCost
2167getShuffleCost(ShuffleKind Kind,VectorType *Tp,ArrayRef<int> Mask,
2168TTI::TargetCostKindCostKind,intIndex,VectorType *SubTp,
2169ArrayRef<const Value *> Args,constInstruction *CxtI) = 0;
2170virtualInstructionCostgetCastInstrCost(unsigned Opcode,Type *Dst,
2171Type *Src,CastContextHint CCH,
2172TTI::TargetCostKindCostKind,
2173constInstruction *I) = 0;
2174virtualInstructionCostgetExtractWithExtendCost(unsigned Opcode,Type *Dst,
2175VectorType *VecTy,
2176unsignedIndex) = 0;
2177virtualInstructionCostgetCFInstrCost(unsigned Opcode,
2178TTI::TargetCostKindCostKind,
2179constInstruction *I =nullptr) = 0;
2180virtualInstructionCost
2181getCmpSelInstrCost(unsigned Opcode,Type *ValTy,Type *CondTy,
2182CmpInst::Predicate VecPred,TTI::TargetCostKindCostKind,
2183OperandValueInfo Op1Info,OperandValueInfo Op2Info,
2184constInstruction *I) = 0;
2185virtualInstructionCostgetVectorInstrCost(unsigned Opcode,Type *Val,
2186TTI::TargetCostKindCostKind,
2187unsignedIndex,Value *Op0,
2188Value *Op1) = 0;
2189
2190 /// \param ScalarUserAndIdx encodes the information about extracts from a
2191 /// vector with 'Scalar' being the value being extracted,'User' being the user
2192 /// of the extract(nullptr if user is not known before vectorization) and
2193 /// 'Idx' being the extract lane.
2194virtualInstructionCostgetVectorInstrCost(
2195unsigned Opcode,Type *Val,TTI::TargetCostKindCostKind,unsignedIndex,
2196Value *Scalar,
2197ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx) = 0;
2198
2199virtualInstructionCostgetVectorInstrCost(constInstruction &I,Type *Val,
2200TTI::TargetCostKindCostKind,
2201unsignedIndex) = 0;
2202
2203virtualInstructionCost
2204getReplicationShuffleCost(Type *EltTy,int ReplicationFactor,int VF,
2205constAPInt &DemandedDstElts,
2206TTI::TargetCostKindCostKind) = 0;
2207
2208virtualInstructionCost
2209getMemoryOpCost(unsigned Opcode,Type *Src,Align Alignment,
2210unsignedAddressSpace,TTI::TargetCostKindCostKind,
2211OperandValueInfo OpInfo,constInstruction *I) = 0;
2212virtualInstructionCostgetVPMemoryOpCost(unsigned Opcode,Type *Src,
2213Align Alignment,
2214unsignedAddressSpace,
2215TTI::TargetCostKindCostKind,
2216constInstruction *I) = 0;
2217virtualInstructionCost
2218getMaskedMemoryOpCost(unsigned Opcode,Type *Src,Align Alignment,
2219unsignedAddressSpace,
2220TTI::TargetCostKindCostKind) = 0;
2221virtualInstructionCost
2222getGatherScatterOpCost(unsigned Opcode,Type *DataTy,constValue *Ptr,
2223bool VariableMask,Align Alignment,
2224TTI::TargetCostKindCostKind,
2225constInstruction *I =nullptr) = 0;
2226virtualInstructionCost
2227getStridedMemoryOpCost(unsigned Opcode,Type *DataTy,constValue *Ptr,
2228bool VariableMask,Align Alignment,
2229TTI::TargetCostKindCostKind,
2230constInstruction *I =nullptr) = 0;
2231
2232virtualInstructionCostgetInterleavedMemoryOpCost(
2233unsigned Opcode,Type *VecTy,unsigned Factor,ArrayRef<unsigned> Indices,
2234Align Alignment,unsignedAddressSpace,TTI::TargetCostKindCostKind,
2235bool UseMaskForCond =false,bool UseMaskForGaps =false) = 0;
2236virtualInstructionCost
2237getArithmeticReductionCost(unsigned Opcode,VectorType *Ty,
2238 std::optional<FastMathFlags> FMF,
2239TTI::TargetCostKindCostKind) = 0;
2240virtualInstructionCost
2241getMinMaxReductionCost(Intrinsic::ID IID,VectorType *Ty,FastMathFlags FMF,
2242TTI::TargetCostKindCostKind) = 0;
2243virtualInstructionCostgetExtendedReductionCost(
2244unsigned Opcode,bool IsUnsigned,Type *ResTy,VectorType *Ty,
2245FastMathFlags FMF,
2246TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput) = 0;
2247virtualInstructionCostgetMulAccReductionCost(
2248bool IsUnsigned,Type *ResTy,VectorType *Ty,
2249TTI::TargetCostKindCostKind =TTI::TCK_RecipThroughput) = 0;
2250virtualInstructionCost
2251getIntrinsicInstrCost(constIntrinsicCostAttributes &ICA,
2252TTI::TargetCostKindCostKind) = 0;
2253virtualInstructionCostgetCallInstrCost(Function *F,Type *RetTy,
2254ArrayRef<Type *> Tys,
2255TTI::TargetCostKindCostKind) = 0;
2256virtualunsignedgetNumberOfParts(Type *Tp) = 0;
2257virtualInstructionCost
2258getAddressComputationCost(Type *Ty,ScalarEvolution *SE,constSCEV *Ptr) = 0;
2259virtualInstructionCost
2260getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) = 0;
2261virtualboolgetTgtMemIntrinsic(IntrinsicInst *Inst,
2262MemIntrinsicInfo &Info) = 0;
2263virtualunsignedgetAtomicMemIntrinsicMaxElementSize()const = 0;
2264virtualValue *getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst,
2265Type *ExpectedType) = 0;
2266virtualType *getMemcpyLoopLoweringType(
2267LLVMContext &Context,Value *Length,unsigned SrcAddrSpace,
2268unsigned DestAddrSpace,Align SrcAlign,Align DestAlign,
2269 std::optional<uint32_t> AtomicElementSize)const = 0;
2270
2271virtualvoidgetMemcpyLoopResidualLoweringType(
2272SmallVectorImpl<Type *> &OpsOut,LLVMContext &Context,
2273unsigned RemainingBytes,unsigned SrcAddrSpace,unsigned DestAddrSpace,
2274Align SrcAlign,Align DestAlign,
2275 std::optional<uint32_t> AtomicCpySize)const = 0;
2276virtualboolareInlineCompatible(constFunction *Caller,
2277constFunction *Callee)const = 0;
2278virtualunsignedgetInlineCallPenalty(constFunction *F,constCallBase &Call,
2279unsigned DefaultCallPenalty)const = 0;
2280virtualboolareTypesABICompatible(constFunction *Caller,
2281constFunction *Callee,
2282constArrayRef<Type *> &Types)const = 0;
2283virtualboolisIndexedLoadLegal(MemIndexedModeMode,Type *Ty)const = 0;
2284virtualboolisIndexedStoreLegal(MemIndexedModeMode,Type *Ty)const = 0;
2285virtualunsignedgetLoadStoreVecRegBitWidth(unsigned AddrSpace)const = 0;
2286virtualboolisLegalToVectorizeLoad(LoadInst *LI)const = 0;
2287virtualboolisLegalToVectorizeStore(StoreInst *SI)const = 0;
2288virtualboolisLegalToVectorizeLoadChain(unsigned ChainSizeInBytes,
2289Align Alignment,
2290unsigned AddrSpace)const = 0;
2291virtualboolisLegalToVectorizeStoreChain(unsigned ChainSizeInBytes,
2292Align Alignment,
2293unsigned AddrSpace)const = 0;
2294virtualboolisLegalToVectorizeReduction(constRecurrenceDescriptor &RdxDesc,
2295ElementCount VF)const = 0;
2296virtualboolisElementTypeLegalForScalableVector(Type *Ty)const = 0;
2297virtualunsignedgetLoadVectorFactor(unsigned VF,unsigned LoadSize,
2298unsigned ChainSizeInBytes,
2299VectorType *VecTy)const = 0;
2300virtualunsignedgetStoreVectorFactor(unsigned VF,unsigned StoreSize,
2301unsigned ChainSizeInBytes,
2302VectorType *VecTy)const = 0;
2303virtualboolpreferFixedOverScalableIfEqualCost()const = 0;
2304virtualboolpreferInLoopReduction(unsigned Opcode,Type *Ty,
2305ReductionFlags)const = 0;
2306virtualboolpreferPredicatedReductionSelect(unsigned Opcode,Type *Ty,
2307ReductionFlags)const = 0;
2308virtualboolpreferEpilogueVectorization()const = 0;
2309
2310virtualboolshouldExpandReduction(constIntrinsicInst *II)const = 0;
2311virtualReductionShuffle
2312getPreferredExpandedReductionShuffle(constIntrinsicInst *II)const = 0;
2313virtualunsignedgetGISelRematGlobalCost()const = 0;
2314virtualunsignedgetMinTripCountTailFoldingThreshold()const = 0;
2315virtualboolenableScalableVectorization()const = 0;
2316virtualboolsupportsScalableVectors()const = 0;
2317virtualboolhasActiveVectorLength(unsigned Opcode,Type *DataType,
2318Align Alignment)const = 0;
2319virtualbool
2320isProfitableToSinkOperands(Instruction *I,
2321SmallVectorImpl<Use *> &OpsToSink)const = 0;
2322
2323virtualboolisVectorShiftByScalarCheap(Type *Ty)const = 0;
2324virtualVPLegalization
2325getVPLegalizationStrategy(constVPIntrinsic &PI)const = 0;
2326virtualboolhasArmWideBranch(bool Thumb)const = 0;
2327virtualuint64_tgetFeatureMask(constFunction &F)const = 0;
2328virtualboolisMultiversionedFunction(constFunction &F)const = 0;
2329virtualunsignedgetMaxNumArgs()const = 0;
2330virtualunsignedgetNumBytesToPadGlobalArray(unsignedSize,
2331Type *ArrayType)const = 0;
2332};
2333
2334template <typename T>
2335classTargetTransformInfo::Model final :publicTargetTransformInfo::Concept {
2336T Impl;
2337
2338public:
2339 Model(T Impl) : Impl(std::move(Impl)) {}
2340 ~Model()override =default;
2341
2342constDataLayout &getDataLayout() const override{
2343return Impl.getDataLayout();
2344 }
2345
2346 InstructionCost
2347 getGEPCost(Type *PointeeType,const Value *Ptr,
2348 ArrayRef<const Value *>Operands, Type *AccessType,
2349TargetTransformInfo::TargetCostKindCostKind) override{
2350return Impl.getGEPCost(PointeeType,Ptr,Operands, AccessType,CostKind);
2351 }
2352 InstructionCost getPointersChainCost(ArrayRef<const Value *> Ptrs,
2353const Value *Base,
2354const PointersChainInfo &Info,
2355 Type *AccessTy,
2356TargetCostKindCostKind) override{
2357return Impl.getPointersChainCost(Ptrs,Base,Info, AccessTy,CostKind);
2358 }
2359unsigned getInliningThresholdMultiplier() const override{
2360return Impl.getInliningThresholdMultiplier();
2361 }
2362unsigned adjustInliningThreshold(const CallBase *CB) override{
2363return Impl.adjustInliningThreshold(CB);
2364 }
2365unsigned getInliningCostBenefitAnalysisSavingsMultiplier() const override{
2366return Impl.getInliningCostBenefitAnalysisSavingsMultiplier();
2367 }
2368unsigned getInliningCostBenefitAnalysisProfitableMultiplier() const override{
2369return Impl.getInliningCostBenefitAnalysisProfitableMultiplier();
2370 }
2371int getInliningLastCallToStaticBonus() const override{
2372return Impl.getInliningLastCallToStaticBonus();
2373 }
2374int getInlinerVectorBonusPercent() const override{
2375return Impl.getInlinerVectorBonusPercent();
2376 }
2377unsigned getCallerAllocaCost(const CallBase *CB,
2378const AllocaInst *AI) const override{
2379return Impl.getCallerAllocaCost(CB, AI);
2380 }
2381 InstructionCost getMemcpyCost(const Instruction *I) override{
2382return Impl.getMemcpyCost(I);
2383 }
2384
2385uint64_t getMaxMemIntrinsicInlineSizeThreshold() const override{
2386return Impl.getMaxMemIntrinsicInlineSizeThreshold();
2387 }
2388
2389 InstructionCost getInstructionCost(const User *U,
2390 ArrayRef<const Value *>Operands,
2391TargetCostKindCostKind) override{
2392return Impl.getInstructionCost(U,Operands,CostKind);
2393 }
2394 BranchProbability getPredictableBranchThreshold() override{
2395return Impl.getPredictableBranchThreshold();
2396 }
2397 InstructionCost getBranchMispredictPenalty() override{
2398return Impl.getBranchMispredictPenalty();
2399 }
2400bool hasBranchDivergence(const Function *F =nullptr) override{
2401return Impl.hasBranchDivergence(F);
2402 }
2403bool isSourceOfDivergence(const Value *V) override{
2404return Impl.isSourceOfDivergence(V);
2405 }
2406
2407bool isAlwaysUniform(const Value *V) override{
2408return Impl.isAlwaysUniform(V);
2409 }
2410
2411bool isValidAddrSpaceCast(unsigned FromAS,unsigned ToAS) const override{
2412return Impl.isValidAddrSpaceCast(FromAS, ToAS);
2413 }
2414
2415bool addrspacesMayAlias(unsigned AS0,unsigned AS1) const override{
2416return Impl.addrspacesMayAlias(AS0, AS1);
2417 }
2418
2419unsigned getFlatAddressSpace() override{return Impl.getFlatAddressSpace(); }
2420
2421bool collectFlatAddressOperands(SmallVectorImpl<int> &OpIndexes,
2422Intrinsic::ID IID) const override{
2423return Impl.collectFlatAddressOperands(OpIndexes, IID);
2424 }
2425
2426bool isNoopAddrSpaceCast(unsigned FromAS,unsigned ToAS) const override{
2427return Impl.isNoopAddrSpaceCast(FromAS, ToAS);
2428 }
2429
2430bool
2431 canHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS) const override{
2432return Impl.canHaveNonUndefGlobalInitializerInAddressSpace(AS);
2433 }
2434
2435unsigned getAssumedAddrSpace(const Value *V) const override{
2436return Impl.getAssumedAddrSpace(V);
2437 }
2438
2439bool isSingleThreaded() const override{return Impl.isSingleThreaded(); }
2440
2441 std::pair<const Value *, unsigned>
2442 getPredicatedAddrSpace(const Value *V) const override{
2443return Impl.getPredicatedAddrSpace(V);
2444 }
2445
2446Value *rewriteIntrinsicWithAddressSpace(IntrinsicInst *II, Value *OldV,
2447 Value *NewV) const override{
2448return Impl.rewriteIntrinsicWithAddressSpace(II, OldV, NewV);
2449 }
2450
2451bool isLoweredToCall(const Function *F) override{
2452return Impl.isLoweredToCall(F);
2453 }
2454void getUnrollingPreferences(Loop *L, ScalarEvolution &SE,
2455 UnrollingPreferences &UP,
2456 OptimizationRemarkEmitter *ORE) override{
2457return Impl.getUnrollingPreferences(L, SE, UP, ORE);
2458 }
2459void getPeelingPreferences(Loop *L, ScalarEvolution &SE,
2460 PeelingPreferences &PP) override{
2461return Impl.getPeelingPreferences(L, SE, PP);
2462 }
2463bool isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE,
2464 AssumptionCache &AC, TargetLibraryInfo *LibInfo,
2465 HardwareLoopInfo &HWLoopInfo) override{
2466return Impl.isHardwareLoopProfitable(L, SE, AC, LibInfo, HWLoopInfo);
2467 }
2468unsigned getEpilogueVectorizationMinVF() override{
2469return Impl.getEpilogueVectorizationMinVF();
2470 }
2471bool preferPredicateOverEpilogue(TailFoldingInfo *TFI) override{
2472return Impl.preferPredicateOverEpilogue(TFI);
2473 }
2474TailFoldingStyle
2475 getPreferredTailFoldingStyle(bool IVUpdateMayOverflow =true) override{
2476return Impl.getPreferredTailFoldingStyle(IVUpdateMayOverflow);
2477 }
2478 std::optional<Instruction *>
2479 instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) override{
2480return Impl.instCombineIntrinsic(IC,II);
2481 }
2482 std::optional<Value *>
2483 simplifyDemandedUseBitsIntrinsic(InstCombiner &IC, IntrinsicInst &II,
2484 APInt DemandedMask, KnownBits &Known,
2485bool &KnownBitsComputed) override{
2486return Impl.simplifyDemandedUseBitsIntrinsic(IC,II, DemandedMask, Known,
2487 KnownBitsComputed);
2488 }
2489 std::optional<Value *> simplifyDemandedVectorEltsIntrinsic(
2490 InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts,
2491 APInt &UndefElts2, APInt &UndefElts3,
2492 std::function<void(Instruction *,unsigned, APInt, APInt &)>
2493 SimplifyAndSetOp) override{
2494return Impl.simplifyDemandedVectorEltsIntrinsic(
2495 IC,II, DemandedElts, UndefElts, UndefElts2, UndefElts3,
2496 SimplifyAndSetOp);
2497 }
2498bool isLegalAddImmediate(int64_t Imm) override{
2499return Impl.isLegalAddImmediate(Imm);
2500 }
2501bool isLegalAddScalableImmediate(int64_t Imm) override{
2502return Impl.isLegalAddScalableImmediate(Imm);
2503 }
2504bool isLegalICmpImmediate(int64_t Imm) override{
2505return Impl.isLegalICmpImmediate(Imm);
2506 }
2507bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset,
2508bool HasBaseReg, int64_t Scale,unsigned AddrSpace,
2509 Instruction *I, int64_t ScalableOffset) override{
2510return Impl.isLegalAddressingMode(Ty, BaseGV, BaseOffset, HasBaseReg, Scale,
2511 AddrSpace,I, ScalableOffset);
2512 }
2513bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1,
2514const TargetTransformInfo::LSRCost &C2) override{
2515return Impl.isLSRCostLess(C1, C2);
2516 }
2517bool isNumRegsMajorCostOfLSR() override{
2518return Impl.isNumRegsMajorCostOfLSR();
2519 }
2520bool shouldDropLSRSolutionIfLessProfitable() const override{
2521return Impl.shouldDropLSRSolutionIfLessProfitable();
2522 }
2523bool isProfitableLSRChainElement(Instruction *I) override{
2524return Impl.isProfitableLSRChainElement(I);
2525 }
2526bool canMacroFuseCmp() override{return Impl.canMacroFuseCmp(); }
2527bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI,
2528 DominatorTree *DT, AssumptionCache *AC,
2529 TargetLibraryInfo *LibInfo) override{
2530return Impl.canSaveCmp(L, BI, SE, LI, DT, AC, LibInfo);
2531 }
2532AddressingModeKind
2533 getPreferredAddressingMode(const Loop *L,
2534 ScalarEvolution *SE) const override{
2535return Impl.getPreferredAddressingMode(L, SE);
2536 }
2537bool isLegalMaskedStore(Type *DataType, Align Alignment) override{
2538return Impl.isLegalMaskedStore(DataType, Alignment);
2539 }
2540bool isLegalMaskedLoad(Type *DataType, Align Alignment) override{
2541return Impl.isLegalMaskedLoad(DataType, Alignment);
2542 }
2543bool isLegalNTStore(Type *DataType, Align Alignment) override{
2544return Impl.isLegalNTStore(DataType, Alignment);
2545 }
2546bool isLegalNTLoad(Type *DataType, Align Alignment) override{
2547return Impl.isLegalNTLoad(DataType, Alignment);
2548 }
2549bool isLegalBroadcastLoad(Type *ElementTy,
2550 ElementCount NumElements) const override{
2551return Impl.isLegalBroadcastLoad(ElementTy, NumElements);
2552 }
2553bool isLegalMaskedScatter(Type *DataType, Align Alignment) override{
2554return Impl.isLegalMaskedScatter(DataType, Alignment);
2555 }
2556bool isLegalMaskedGather(Type *DataType, Align Alignment) override{
2557return Impl.isLegalMaskedGather(DataType, Alignment);
2558 }
2559bool forceScalarizeMaskedGather(VectorType *DataType,
2560 Align Alignment) override{
2561return Impl.forceScalarizeMaskedGather(DataType, Alignment);
2562 }
2563bool forceScalarizeMaskedScatter(VectorType *DataType,
2564 Align Alignment) override{
2565return Impl.forceScalarizeMaskedScatter(DataType, Alignment);
2566 }
2567bool isLegalMaskedCompressStore(Type *DataType, Align Alignment) override{
2568return Impl.isLegalMaskedCompressStore(DataType, Alignment);
2569 }
2570bool isLegalMaskedExpandLoad(Type *DataType, Align Alignment) override{
2571return Impl.isLegalMaskedExpandLoad(DataType, Alignment);
2572 }
2573bool isLegalStridedLoadStore(Type *DataType, Align Alignment) override{
2574return Impl.isLegalStridedLoadStore(DataType, Alignment);
2575 }
2576bool isLegalInterleavedAccessType(VectorType *VTy,unsigned Factor,
2577 Align Alignment,
2578unsigned AddrSpace) override{
2579return Impl.isLegalInterleavedAccessType(VTy, Factor, Alignment, AddrSpace);
2580 }
2581bool isLegalMaskedVectorHistogram(Type *AddrType, Type *DataType) override{
2582return Impl.isLegalMaskedVectorHistogram(AddrType, DataType);
2583 }
2584bool isLegalAltInstr(VectorType *VecTy,unsigned Opcode0,unsigned Opcode1,
2585const SmallBitVector &OpcodeMask) const override{
2586return Impl.isLegalAltInstr(VecTy, Opcode0, Opcode1, OpcodeMask);
2587 }
2588bool enableOrderedReductions() override{
2589return Impl.enableOrderedReductions();
2590 }
2591bool hasDivRemOp(Type *DataType,bool IsSigned) override{
2592return Impl.hasDivRemOp(DataType, IsSigned);
2593 }
2594bool hasVolatileVariant(Instruction *I,unsigned AddrSpace) override{
2595return Impl.hasVolatileVariant(I, AddrSpace);
2596 }
2597bool prefersVectorizedAddressing() override{
2598return Impl.prefersVectorizedAddressing();
2599 }
2600 InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV,
2601 StackOffset BaseOffset,bool HasBaseReg,
2602 int64_t Scale,
2603unsigned AddrSpace) override{
2604return Impl.getScalingFactorCost(Ty, BaseGV, BaseOffset, HasBaseReg, Scale,
2605 AddrSpace);
2606 }
2607bool LSRWithInstrQueries() override{return Impl.LSRWithInstrQueries(); }
2608bool isTruncateFree(Type *Ty1, Type *Ty2) override{
2609return Impl.isTruncateFree(Ty1, Ty2);
2610 }
2611bool isProfitableToHoist(Instruction *I) override{
2612return Impl.isProfitableToHoist(I);
2613 }
2614bool useAA() override{return Impl.useAA(); }
2615bool isTypeLegal(Type *Ty) override{return Impl.isTypeLegal(Ty); }
2616unsigned getRegUsageForType(Type *Ty) override{
2617return Impl.getRegUsageForType(Ty);
2618 }
2619bool shouldBuildLookupTables() override{
2620return Impl.shouldBuildLookupTables();
2621 }
2622bool shouldBuildLookupTablesForConstant(Constant *C) override{
2623return Impl.shouldBuildLookupTablesForConstant(C);
2624 }
2625bool shouldBuildRelLookupTables() override{
2626return Impl.shouldBuildRelLookupTables();
2627 }
2628bool useColdCCForColdCall(Function &F) override{
2629return Impl.useColdCCForColdCall(F);
2630 }
2631bool isTargetIntrinsicTriviallyScalarizable(Intrinsic::IDID) override{
2632return Impl.isTargetIntrinsicTriviallyScalarizable(ID);
2633 }
2634
2635bool isTargetIntrinsicWithScalarOpAtArg(Intrinsic::IDID,
2636unsigned ScalarOpdIdx) override{
2637return Impl.isTargetIntrinsicWithScalarOpAtArg(ID, ScalarOpdIdx);
2638 }
2639
2640bool isTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::IDID,
2641int OpdIdx) override{
2642return Impl.isTargetIntrinsicWithOverloadTypeAtArg(ID, OpdIdx);
2643 }
2644
2645bool isTargetIntrinsicWithStructReturnOverloadAtField(Intrinsic::IDID,
2646int RetIdx) override{
2647return Impl.isTargetIntrinsicWithStructReturnOverloadAtField(ID, RetIdx);
2648 }
2649
2650 InstructionCost getScalarizationOverhead(VectorType *Ty,
2651const APInt &DemandedElts,
2652bool Insert,bool Extract,
2653TargetCostKindCostKind,
2654 ArrayRef<Value *> VL = {})override {
2655return Impl.getScalarizationOverhead(Ty, DemandedElts, Insert, Extract,
2656CostKind, VL);
2657 }
2658 InstructionCost
2659 getOperandsScalarizationOverhead(ArrayRef<const Value *> Args,
2660 ArrayRef<Type *> Tys,
2661TargetCostKindCostKind) override{
2662return Impl.getOperandsScalarizationOverhead(Args, Tys,CostKind);
2663 }
2664
2665bool supportsEfficientVectorElementLoadStore() override{
2666return Impl.supportsEfficientVectorElementLoadStore();
2667 }
2668
2669bool supportsTailCalls() override{return Impl.supportsTailCalls(); }
2670bool supportsTailCallFor(const CallBase *CB) override{
2671return Impl.supportsTailCallFor(CB);
2672 }
2673
2674bool enableAggressiveInterleaving(bool LoopHasReductions) override{
2675return Impl.enableAggressiveInterleaving(LoopHasReductions);
2676 }
2677 MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize,
2678bool IsZeroCmp) const override{
2679return Impl.enableMemCmpExpansion(OptSize, IsZeroCmp);
2680 }
2681bool enableSelectOptimize() override{
2682return Impl.enableSelectOptimize();
2683 }
2684bool shouldTreatInstructionLikeSelect(const Instruction *I) override{
2685return Impl.shouldTreatInstructionLikeSelect(I);
2686 }
2687bool enableInterleavedAccessVectorization() override{
2688return Impl.enableInterleavedAccessVectorization();
2689 }
2690bool enableMaskedInterleavedAccessVectorization() override{
2691return Impl.enableMaskedInterleavedAccessVectorization();
2692 }
2693bool isFPVectorizationPotentiallyUnsafe() override{
2694return Impl.isFPVectorizationPotentiallyUnsafe();
2695 }
2696bool allowsMisalignedMemoryAccesses(LLVMContext &Context,unsignedBitWidth,
2697unsignedAddressSpace, Align Alignment,
2698unsigned *Fast) override{
2699return Impl.allowsMisalignedMemoryAccesses(Context,BitWidth,AddressSpace,
2700 Alignment,Fast);
2701 }
2702PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) override{
2703return Impl.getPopcntSupport(IntTyWidthInBit);
2704 }
2705bool haveFastSqrt(Type *Ty) override{return Impl.haveFastSqrt(Ty); }
2706
2707bool isExpensiveToSpeculativelyExecute(const Instruction*I) override{
2708return Impl.isExpensiveToSpeculativelyExecute(I);
2709 }
2710
2711bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) override{
2712return Impl.isFCmpOrdCheaperThanFCmpZero(Ty);
2713 }
2714
2715 InstructionCost getFPOpCost(Type *Ty) override{
2716return Impl.getFPOpCost(Ty);
2717 }
2718
2719 InstructionCost getIntImmCodeSizeCost(unsigned Opc,unsignedIdx,
2720const APInt &Imm, Type *Ty) override{
2721return Impl.getIntImmCodeSizeCost(Opc,Idx, Imm, Ty);
2722 }
2723 InstructionCost getIntImmCost(const APInt &Imm, Type *Ty,
2724TargetCostKindCostKind) override{
2725return Impl.getIntImmCost(Imm, Ty,CostKind);
2726 }
2727 InstructionCost getIntImmCostInst(unsigned Opc,unsignedIdx,
2728const APInt &Imm, Type *Ty,
2729TargetCostKindCostKind,
2730 Instruction *Inst =nullptr) override{
2731return Impl.getIntImmCostInst(Opc,Idx, Imm, Ty,CostKind, Inst);
2732 }
2733 InstructionCost getIntImmCostIntrin(Intrinsic::ID IID,unsignedIdx,
2734const APInt &Imm, Type *Ty,
2735TargetCostKindCostKind) override{
2736return Impl.getIntImmCostIntrin(IID,Idx, Imm, Ty,CostKind);
2737 }
2738bool preferToKeepConstantsAttached(const Instruction &Inst,
2739const Function &Fn) const override{
2740return Impl.preferToKeepConstantsAttached(Inst, Fn);
2741 }
2742unsigned getNumberOfRegisters(unsigned ClassID) const override{
2743return Impl.getNumberOfRegisters(ClassID);
2744 }
2745bool hasConditionalLoadStoreForType(Type *Ty =nullptr) const override{
2746return Impl.hasConditionalLoadStoreForType(Ty);
2747 }
2748unsigned getRegisterClassForType(boolVector,
2749 Type *Ty =nullptr) const override{
2750return Impl.getRegisterClassForType(Vector, Ty);
2751 }
2752constchar *getRegisterClassName(unsigned ClassID) const override{
2753return Impl.getRegisterClassName(ClassID);
2754 }
2755 TypeSize getRegisterBitWidth(RegisterKind K) const override{
2756return Impl.getRegisterBitWidth(K);
2757 }
2758unsigned getMinVectorRegisterBitWidth() const override{
2759return Impl.getMinVectorRegisterBitWidth();
2760 }
2761 std::optional<unsigned>getMaxVScale() const override{
2762return Impl.getMaxVScale();
2763 }
2764 std::optional<unsigned> getVScaleForTuning() const override{
2765return Impl.getVScaleForTuning();
2766 }
2767bool isVScaleKnownToBeAPowerOfTwo() const override{
2768return Impl.isVScaleKnownToBeAPowerOfTwo();
2769 }
2770bool shouldMaximizeVectorBandwidth(
2771TargetTransformInfo::RegisterKind K) const override{
2772return Impl.shouldMaximizeVectorBandwidth(K);
2773 }
2774 ElementCount getMinimumVF(unsigned ElemWidth,
2775bool IsScalable) const override{
2776return Impl.getMinimumVF(ElemWidth, IsScalable);
2777 }
2778unsigned getMaximumVF(unsigned ElemWidth,unsigned Opcode) const override{
2779return Impl.getMaximumVF(ElemWidth, Opcode);
2780 }
2781unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy,
2782 Type *ScalarValTy) const override{
2783return Impl.getStoreMinimumVF(VF, ScalarMemTy, ScalarValTy);
2784 }
2785bool shouldConsiderAddressTypePromotion(
2786const Instruction &I,bool &AllowPromotionWithoutCommonHeader) override{
2787return Impl.shouldConsiderAddressTypePromotion(
2788I, AllowPromotionWithoutCommonHeader);
2789 }
2790unsigned getCacheLineSize() const override{return Impl.getCacheLineSize(); }
2791 std::optional<unsigned> getCacheSize(CacheLevel Level) const override{
2792return Impl.getCacheSize(Level);
2793 }
2794 std::optional<unsigned>
2795 getCacheAssociativity(CacheLevel Level) const override{
2796return Impl.getCacheAssociativity(Level);
2797 }
2798
2799 std::optional<unsigned> getMinPageSize() const override{
2800return Impl.getMinPageSize();
2801 }
2802
2803 /// Return the preferred prefetch distance in terms of instructions.
2804 ///
2805unsigned getPrefetchDistance() const override{
2806return Impl.getPrefetchDistance();
2807 }
2808
2809 /// Return the minimum stride necessary to trigger software
2810 /// prefetching.
2811 ///
2812unsigned getMinPrefetchStride(unsigned NumMemAccesses,
2813unsigned NumStridedMemAccesses,
2814unsigned NumPrefetches,
2815bool HasCall) const override{
2816return Impl.getMinPrefetchStride(NumMemAccesses, NumStridedMemAccesses,
2817 NumPrefetches, HasCall);
2818 }
2819
2820 /// Return the maximum prefetch distance in terms of loop
2821 /// iterations.
2822 ///
2823unsigned getMaxPrefetchIterationsAhead() const override{
2824return Impl.getMaxPrefetchIterationsAhead();
2825 }
2826
2827 /// \return True if prefetching should also be done for writes.
2828bool enableWritePrefetching() const override{
2829return Impl.enableWritePrefetching();
2830 }
2831
2832 /// \return if target want to issue a prefetch in address space \p AS.
2833bool shouldPrefetchAddressSpace(unsigned AS) const override{
2834return Impl.shouldPrefetchAddressSpace(AS);
2835 }
2836
2837 InstructionCost getPartialReductionCost(
2838unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType,
2839 ElementCount VF,PartialReductionExtendKind OpAExtend,
2840PartialReductionExtendKind OpBExtend,
2841 std::optional<unsigned> BinOp = std::nullopt) const override{
2842return Impl.getPartialReductionCost(Opcode, InputTypeA, InputTypeB,
2843 AccumType, VF, OpAExtend, OpBExtend,
2844 BinOp);
2845 }
2846
2847unsigned getMaxInterleaveFactor(ElementCount VF) override{
2848return Impl.getMaxInterleaveFactor(VF);
2849 }
2850unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI,
2851unsigned &JTSize,
2852 ProfileSummaryInfo *PSI,
2853 BlockFrequencyInfo *BFI) override{
2854return Impl.getEstimatedNumberOfCaseClusters(SI, JTSize, PSI, BFI);
2855 }
2856 InstructionCost getArithmeticInstrCost(
2857unsigned Opcode, Type *Ty,TTI::TargetCostKindCostKind,
2858 OperandValueInfo Opd1Info, OperandValueInfo Opd2Info,
2859 ArrayRef<const Value *> Args,
2860const Instruction *CxtI =nullptr) override{
2861return Impl.getArithmeticInstrCost(Opcode, Ty,CostKind, Opd1Info, Opd2Info,
2862 Args, CxtI);
2863 }
2864 InstructionCost getAltInstrCost(VectorType *VecTy,unsigned Opcode0,
2865unsigned Opcode1,
2866const SmallBitVector &OpcodeMask,
2867TTI::TargetCostKindCostKind) const override{
2868return Impl.getAltInstrCost(VecTy, Opcode0, Opcode1, OpcodeMask,CostKind);
2869 }
2870
2871 InstructionCost getShuffleCost(ShuffleKind Kind,VectorType *Tp,
2872 ArrayRef<int> Mask,
2873TTI::TargetCostKindCostKind,intIndex,
2874VectorType *SubTp,
2875 ArrayRef<const Value *> Args,
2876const Instruction *CxtI) override{
2877return Impl.getShuffleCost(Kind, Tp, Mask,CostKind,Index, SubTp, Args,
2878 CxtI);
2879 }
2880 InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src,
2881CastContextHint CCH,
2882TTI::TargetCostKindCostKind,
2883const Instruction *I) override{
2884return Impl.getCastInstrCost(Opcode, Dst, Src, CCH,CostKind,I);
2885 }
2886 InstructionCost getExtractWithExtendCost(unsigned Opcode, Type *Dst,
2887VectorType *VecTy,
2888unsignedIndex) override{
2889return Impl.getExtractWithExtendCost(Opcode, Dst, VecTy,Index);
2890 }
2891 InstructionCost getCFInstrCost(unsigned Opcode,TTI::TargetCostKindCostKind,
2892const Instruction *I =nullptr) override{
2893return Impl.getCFInstrCost(Opcode,CostKind,I);
2894 }
2895 InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy,
2896CmpInst::Predicate VecPred,
2897TTI::TargetCostKindCostKind,
2898 OperandValueInfo Op1Info,
2899 OperandValueInfo Op2Info,
2900const Instruction *I) override{
2901return Impl.getCmpSelInstrCost(Opcode, ValTy, CondTy, VecPred,CostKind,
2902 Op1Info, Op2Info,I);
2903 }
2904 InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val,
2905TTI::TargetCostKindCostKind,
2906unsignedIndex, Value *Op0,
2907 Value *Op1) override{
2908return Impl.getVectorInstrCost(Opcode, Val,CostKind,Index, Op0, Op1);
2909 }
2910 InstructionCost getVectorInstrCost(
2911unsigned Opcode, Type *Val,TTI::TargetCostKindCostKind,unsignedIndex,
2912 Value *Scalar,
2913 ArrayRef<std::tuple<Value *, User *, int>> ScalarUserAndIdx) override{
2914return Impl.getVectorInstrCost(Opcode, Val,CostKind,Index, Scalar,
2915 ScalarUserAndIdx);
2916 }
2917 InstructionCost getVectorInstrCost(const Instruction &I, Type *Val,
2918TTI::TargetCostKindCostKind,
2919unsignedIndex) override{
2920return Impl.getVectorInstrCost(I, Val,CostKind,Index);
2921 }
2922 InstructionCost
2923 getReplicationShuffleCost(Type *EltTy,int ReplicationFactor,int VF,
2924const APInt &DemandedDstElts,
2925TTI::TargetCostKindCostKind) override{
2926return Impl.getReplicationShuffleCost(EltTy, ReplicationFactor, VF,
2927 DemandedDstElts,CostKind);
2928 }
2929 InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
2930unsignedAddressSpace,
2931TTI::TargetCostKindCostKind,
2932 OperandValueInfo OpInfo,
2933const Instruction *I) override{
2934return Impl.getMemoryOpCost(Opcode, Src, Alignment,AddressSpace,CostKind,
2935 OpInfo,I);
2936 }
2937 InstructionCost getVPMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment,
2938unsignedAddressSpace,
2939TTI::TargetCostKindCostKind,
2940const Instruction *I) override{
2941return Impl.getVPMemoryOpCost(Opcode, Src, Alignment,AddressSpace,
2942CostKind,I);
2943 }
2944 InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src,
2945 Align Alignment,unsignedAddressSpace,
2946TTI::TargetCostKindCostKind) override{
2947return Impl.getMaskedMemoryOpCost(Opcode, Src, Alignment,AddressSpace,
2948CostKind);
2949 }
2950 InstructionCost
2951 getGatherScatterOpCost(unsigned Opcode, Type *DataTy,const Value *Ptr,
2952bool VariableMask, Align Alignment,
2953TTI::TargetCostKindCostKind,
2954const Instruction *I =nullptr) override{
2955return Impl.getGatherScatterOpCost(Opcode, DataTy,Ptr, VariableMask,
2956 Alignment,CostKind,I);
2957 }
2958 InstructionCost
2959 getStridedMemoryOpCost(unsigned Opcode, Type *DataTy,const Value *Ptr,
2960bool VariableMask, Align Alignment,
2961TTI::TargetCostKindCostKind,
2962const Instruction *I =nullptr) override{
2963return Impl.getStridedMemoryOpCost(Opcode, DataTy,Ptr, VariableMask,
2964 Alignment,CostKind,I);
2965 }
2966 InstructionCost getInterleavedMemoryOpCost(
2967unsigned Opcode, Type *VecTy,unsigned Factor, ArrayRef<unsigned> Indices,
2968 Align Alignment,unsignedAddressSpace,TTI::TargetCostKindCostKind,
2969bool UseMaskForCond,bool UseMaskForGaps) override{
2970return Impl.getInterleavedMemoryOpCost(Opcode, VecTy, Factor, Indices,
2971 Alignment,AddressSpace,CostKind,
2972 UseMaskForCond, UseMaskForGaps);
2973 }
2974 InstructionCost
2975 getArithmeticReductionCost(unsigned Opcode,VectorType *Ty,
2976 std::optional<FastMathFlags> FMF,
2977TTI::TargetCostKindCostKind) override{
2978return Impl.getArithmeticReductionCost(Opcode, Ty, FMF,CostKind);
2979 }
2980 InstructionCost
2981 getMinMaxReductionCost(Intrinsic::ID IID,VectorType *Ty, FastMathFlags FMF,
2982TTI::TargetCostKindCostKind) override{
2983return Impl.getMinMaxReductionCost(IID, Ty, FMF,CostKind);
2984 }
2985 InstructionCost
2986 getExtendedReductionCost(unsigned Opcode,bool IsUnsigned, Type *ResTy,
2987VectorType *Ty, FastMathFlags FMF,
2988TTI::TargetCostKindCostKind) override{
2989return Impl.getExtendedReductionCost(Opcode, IsUnsigned, ResTy, Ty, FMF,
2990CostKind);
2991 }
2992 InstructionCost
2993 getMulAccReductionCost(bool IsUnsigned, Type *ResTy,VectorType *Ty,
2994TTI::TargetCostKindCostKind) override{
2995return Impl.getMulAccReductionCost(IsUnsigned, ResTy, Ty,CostKind);
2996 }
2997 InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA,
2998TTI::TargetCostKindCostKind) override{
2999return Impl.getIntrinsicInstrCost(ICA,CostKind);
3000 }
3001 InstructionCost getCallInstrCost(Function *F, Type *RetTy,
3002 ArrayRef<Type *> Tys,
3003TTI::TargetCostKindCostKind) override{
3004return Impl.getCallInstrCost(F,RetTy, Tys,CostKind);
3005 }
3006unsigned getNumberOfParts(Type *Tp) override{
3007return Impl.getNumberOfParts(Tp);
3008 }
3009 InstructionCost getAddressComputationCost(Type *Ty, ScalarEvolution *SE,
3010const SCEV *Ptr) override{
3011return Impl.getAddressComputationCost(Ty, SE,Ptr);
3012 }
3013 InstructionCost getCostOfKeepingLiveOverCall(ArrayRef<Type *> Tys) override{
3014return Impl.getCostOfKeepingLiveOverCall(Tys);
3015 }
3016bool getTgtMemIntrinsic(IntrinsicInst *Inst,
3017 MemIntrinsicInfo &Info) override{
3018return Impl.getTgtMemIntrinsic(Inst,Info);
3019 }
3020unsigned getAtomicMemIntrinsicMaxElementSize() const override{
3021return Impl.getAtomicMemIntrinsicMaxElementSize();
3022 }
3023Value *getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst,
3024 Type *ExpectedType) override{
3025return Impl.getOrCreateResultFromMemIntrinsic(Inst, ExpectedType);
3026 }
3027Type *getMemcpyLoopLoweringType(
3028 LLVMContext &Context, Value *Length,unsigned SrcAddrSpace,
3029unsigned DestAddrSpace, Align SrcAlign, Align DestAlign,
3030 std::optional<uint32_t> AtomicElementSize) const override{
3031return Impl.getMemcpyLoopLoweringType(Context,Length, SrcAddrSpace,
3032 DestAddrSpace, SrcAlign, DestAlign,
3033 AtomicElementSize);
3034 }
3035void getMemcpyLoopResidualLoweringType(
3036 SmallVectorImpl<Type *> &OpsOut, LLVMContext &Context,
3037unsigned RemainingBytes,unsigned SrcAddrSpace,unsigned DestAddrSpace,
3038 Align SrcAlign, Align DestAlign,
3039 std::optional<uint32_t> AtomicCpySize) const override{
3040 Impl.getMemcpyLoopResidualLoweringType(OpsOut, Context, RemainingBytes,
3041 SrcAddrSpace, DestAddrSpace,
3042 SrcAlign, DestAlign, AtomicCpySize);
3043 }
3044boolareInlineCompatible(const Function *Caller,
3045const Function *Callee) const override{
3046return Impl.areInlineCompatible(Caller, Callee);
3047 }
3048unsigned getInlineCallPenalty(const Function *F,const CallBase &Call,
3049unsigned DefaultCallPenalty) const override{
3050return Impl.getInlineCallPenalty(F, Call, DefaultCallPenalty);
3051 }
3052bool areTypesABICompatible(const Function *Caller,const Function *Callee,
3053const ArrayRef<Type *> &Types) const override{
3054return Impl.areTypesABICompatible(Caller, Callee, Types);
3055 }
3056bool isIndexedLoadLegal(MemIndexedModeMode, Type *Ty) const override{
3057return Impl.isIndexedLoadLegal(Mode, Ty, getDataLayout());
3058 }
3059bool isIndexedStoreLegal(MemIndexedModeMode, Type *Ty) const override{
3060return Impl.isIndexedStoreLegal(Mode, Ty, getDataLayout());
3061 }
3062unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const override{
3063return Impl.getLoadStoreVecRegBitWidth(AddrSpace);
3064 }
3065bool isLegalToVectorizeLoad(LoadInst *LI) const override{
3066return Impl.isLegalToVectorizeLoad(LI);
3067 }
3068bool isLegalToVectorizeStore(StoreInst *SI) const override{
3069return Impl.isLegalToVectorizeStore(SI);
3070 }
3071bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment,
3072unsigned AddrSpace) const override{
3073return Impl.isLegalToVectorizeLoadChain(ChainSizeInBytes, Alignment,
3074 AddrSpace);
3075 }
3076bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment,
3077unsigned AddrSpace) const override{
3078return Impl.isLegalToVectorizeStoreChain(ChainSizeInBytes, Alignment,
3079 AddrSpace);
3080 }
3081bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc,
3082 ElementCount VF) const override{
3083return Impl.isLegalToVectorizeReduction(RdxDesc, VF);
3084 }
3085bool isElementTypeLegalForScalableVector(Type *Ty) const override{
3086return Impl.isElementTypeLegalForScalableVector(Ty);
3087 }
3088unsigned getLoadVectorFactor(unsigned VF,unsigned LoadSize,
3089unsigned ChainSizeInBytes,
3090VectorType *VecTy) const override{
3091return Impl.getLoadVectorFactor(VF, LoadSize, ChainSizeInBytes, VecTy);
3092 }
3093unsigned getStoreVectorFactor(unsigned VF,unsigned StoreSize,
3094unsigned ChainSizeInBytes,
3095VectorType *VecTy) const override{
3096return Impl.getStoreVectorFactor(VF, StoreSize, ChainSizeInBytes, VecTy);
3097 }
3098bool preferFixedOverScalableIfEqualCost() const override{
3099return Impl.preferFixedOverScalableIfEqualCost();
3100 }
3101bool preferInLoopReduction(unsigned Opcode, Type *Ty,
3102 ReductionFlags Flags) const override{
3103return Impl.preferInLoopReduction(Opcode, Ty, Flags);
3104 }
3105bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty,
3106 ReductionFlags Flags) const override{
3107return Impl.preferPredicatedReductionSelect(Opcode, Ty, Flags);
3108 }
3109bool preferEpilogueVectorization() const override{
3110return Impl.preferEpilogueVectorization();
3111 }
3112
3113bool shouldExpandReduction(const IntrinsicInst *II) const override{
3114return Impl.shouldExpandReduction(II);
3115 }
3116
3117ReductionShuffle
3118 getPreferredExpandedReductionShuffle(const IntrinsicInst *II) const override{
3119return Impl.getPreferredExpandedReductionShuffle(II);
3120 }
3121
3122unsigned getGISelRematGlobalCost() const override{
3123return Impl.getGISelRematGlobalCost();
3124 }
3125
3126unsigned getMinTripCountTailFoldingThreshold() const override{
3127return Impl.getMinTripCountTailFoldingThreshold();
3128 }
3129
3130bool supportsScalableVectors() const override{
3131return Impl.supportsScalableVectors();
3132 }
3133
3134bool enableScalableVectorization() const override{
3135return Impl.enableScalableVectorization();
3136 }
3137
3138bool hasActiveVectorLength(unsigned Opcode, Type *DataType,
3139 Align Alignment) const override{
3140return Impl.hasActiveVectorLength(Opcode, DataType, Alignment);
3141 }
3142
3143bool isProfitableToSinkOperands(Instruction *I,
3144 SmallVectorImpl<Use *> &Ops) const override{
3145return Impl.isProfitableToSinkOperands(I, Ops);
3146 };
3147
3148bool isVectorShiftByScalarCheap(Type *Ty) const override{
3149return Impl.isVectorShiftByScalarCheap(Ty);
3150 }
3151
3152VPLegalization
3153 getVPLegalizationStrategy(const VPIntrinsic &PI) const override{
3154return Impl.getVPLegalizationStrategy(PI);
3155 }
3156
3157bool hasArmWideBranch(bool Thumb) const override{
3158return Impl.hasArmWideBranch(Thumb);
3159 }
3160
3161uint64_t getFeatureMask(const Function &F) const override{
3162return Impl.getFeatureMask(F);
3163 }
3164
3165bool isMultiversionedFunction(const Function &F) const override{
3166return Impl.isMultiversionedFunction(F);
3167 }
3168
3169unsigned getMaxNumArgs() const override{
3170return Impl.getMaxNumArgs();
3171 }
3172
3173unsigned getNumBytesToPadGlobalArray(unsignedSize,
3174 Type *ArrayType) const override{
3175return Impl.getNumBytesToPadGlobalArray(Size,ArrayType);
3176 }
3177};
3178
3179template <typename T>
3180TargetTransformInfo::TargetTransformInfo(T Impl)
3181 : TTIImpl(new Model<T>(Impl)) {}
3182
3183/// Analysis pass providing the \c TargetTransformInfo.
3184///
3185/// The core idea of the TargetIRAnalysis is to expose an interface through
3186/// which LLVM targets can analyze and provide information about the middle
3187/// end's target-independent IR. This supports use cases such as target-aware
3188/// cost modeling of IR constructs.
3189///
3190/// This is a function analysis because much of the cost modeling for targets
3191/// is done in a subtarget specific way and LLVM supports compiling different
3192/// functions targeting different subtargets in order to support runtime
3193/// dispatch according to the observed subtarget.
3194classTargetIRAnalysis :publicAnalysisInfoMixin<TargetIRAnalysis> {
3195public:
3196typedefTargetTransformInfoResult;
3197
3198 /// Default construct a target IR analysis.
3199 ///
3200 /// This will use the module's datalayout to construct a baseline
3201 /// conservative TTI result.
3202TargetIRAnalysis();
3203
3204 /// Construct an IR analysis pass around a target-provide callback.
3205 ///
3206 /// The callback will be called with a particular function for which the TTI
3207 /// is needed and must return a TTI object for that function.
3208TargetIRAnalysis(std::function<Result(constFunction &)> TTICallback);
3209
3210// Value semantics. We spell out the constructors for MSVC.
3211TargetIRAnalysis(constTargetIRAnalysis &Arg)
3212 : TTICallback(Arg.TTICallback) {}
3213TargetIRAnalysis(TargetIRAnalysis &&Arg)
3214 : TTICallback(std::move(Arg.TTICallback)) {}
3215TargetIRAnalysis &operator=(constTargetIRAnalysis &RHS) {
3216 TTICallback =RHS.TTICallback;
3217return *this;
3218 }
3219TargetIRAnalysis &operator=(TargetIRAnalysis &&RHS) {
3220 TTICallback = std::move(RHS.TTICallback);
3221return *this;
3222 }
3223
3224Resultrun(constFunction &F,FunctionAnalysisManager &);
3225
3226private:
3227friendAnalysisInfoMixin<TargetIRAnalysis>;
3228staticAnalysisKey Key;
3229
3230 /// The callback used to produce a result.
3231 ///
3232 /// We use a completely opaque callback so that targets can provide whatever
3233 /// mechanism they desire for constructing the TTI for a given function.
3234 ///
3235 /// FIXME: Should we really use std::function? It's relatively inefficient.
3236 /// It might be possible to arrange for even stateful callbacks to outlive
3237 /// the analysis and thus use a function_ref which would be lighter weight.
3238 /// This may also be less error prone as the callback is likely to reference
3239 /// the external TargetMachine, and that reference needs to never dangle.
3240 std::function<Result(constFunction &)> TTICallback;
3241
3242 /// Helper function used as the callback in the default constructor.
3243staticResult getDefaultTTI(constFunction &F);
3244};
3245
3246/// Wrapper pass for TargetTransformInfo.
3247///
3248/// This pass can be constructed from a TTI object which it stores internally
3249/// and is queried by passes.
3250classTargetTransformInfoWrapperPass :publicImmutablePass {
3251TargetIRAnalysis TIRA;
3252 std::optional<TargetTransformInfo>TTI;
3253
3254virtualvoid anchor();
3255
3256public:
3257staticcharID;
3258
3259 /// We must provide a default constructor for the pass but it should
3260 /// never be used.
3261 ///
3262 /// Use the constructor below or call one of the creation routines.
3263TargetTransformInfoWrapperPass();
3264
3265explicitTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA);
3266
3267TargetTransformInfo &getTTI(constFunction &F);
3268};
3269
3270/// Create an analysis pass wrapper around a TTI object.
3271///
3272/// This analysis pass just holds the TTI instance and makes it available to
3273/// clients.
3274ImmutablePass *createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA);
3275
3276}// namespace llvm
3277
3278#endif
Arguments
AMDGPU Lower Kernel Arguments
Definition:AMDGPULowerKernelArguments.cpp:504
APInt.h
This file implements a class to represent arbitrary precision integral constant values and operations...
DL
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
Definition:ARMSLSHardening.cpp:73
ArrayRef.h
AtomicOrdering.h
Atomic ordering constants.
BranchProbability.h
Type
RelocType Type
Definition:COFFYAML.cpp:410
Info
Analysis containing CSE Info
Definition:CSEInfo.cpp:27
CostKind
static cl::opt< TargetTransformInfo::TargetCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(TargetTransformInfo::TCK_RecipThroughput), cl::values(clEnumValN(TargetTransformInfo::TCK_RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(TargetTransformInfo::TCK_Latency, "latency", "Instruction latency"), clEnumValN(TargetTransformInfo::TCK_CodeSize, "code-size", "Code size"), clEnumValN(TargetTransformInfo::TCK_SizeAndLatency, "size-latency", "Code size and latency")))
RetTy
return RetTy
Definition:DeadArgumentElimination.cpp:361
Idx
Returns the sub type a function will return at a given Idx Should correspond to the result type of an ExtractValue instruction executed with just that one unsigned Idx
Definition:DeadArgumentElimination.cpp:353
Index
uint32_t Index
Definition:ELFObjHandler.cpp:83
Size
uint64_t Size
Definition:ELFObjHandler.cpp:81
FMF.h
ForceNestedLoop
static cl::opt< bool > ForceNestedLoop("force-nested-hardware-loop", cl::Hidden, cl::init(false), cl::desc("Force allowance of nested hardware loops"))
ForceHardwareLoopPHI
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"))
PassManager.h
This header defines various interfaces for pass management in LLVM.
InstrTypes.h
InstructionCost.h
This file defines an InstructionCost class that is used when calculating the cost of an instruction,...
getMaxVScale
std::optional< unsigned > getMaxVScale(const Function &F, const TargetTransformInfo &TTI)
Definition:LoopVectorize.cpp:2295
F
#define F(x, y, z)
Definition:MD5.cpp:55
I
#define I(x, y, z)
Definition:MD5.cpp:58
Operands
mir Rename Register Operands
Definition:MIRNamerPass.cpp:74
InstCombiner
Machine InstCombiner
Definition:MachineCombiner.cpp:134
II
uint64_t IntrinsicInst * II
Definition:NVVMIntrRange.cpp:51
Pass.h
Mode
static cl::opt< RegAllocEvictionAdvisorAnalysis::AdvisorMode > Mode("regalloc-enable-advisor", cl::Hidden, cl::init(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default), cl::desc("Enable regalloc advisor mode"), cl::values(clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Default, "default", "Default"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Release, "release", "precompiled"), clEnumValN(RegAllocEvictionAdvisorAnalysis::AdvisorMode::Development, "development", "for training")))
Ptr
@ Ptr
Definition:TargetLibraryInfo.cpp:77
RHS
Value * RHS
Definition:X86PartialReduction.cpp:74
ArrayType
Definition:ItaniumDemangle.h:785
T
VectorType
Definition:ItaniumDemangle.h:1173
bool
llvm::APInt
Class for arbitrary precision integers.
Definition:APInt.h:78
llvm::AllocaInst
an instruction to allocate memory on the stack
Definition:Instructions.h:63
llvm::AnalysisManager::Invalidator
API to communicate dependencies between analyses during invalidation.
Definition:PassManager.h:292
llvm::AnalysisManager
A container for analyses that lazily runs them and caches their results.
Definition:PassManager.h:253
llvm::ArrayRef
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
Definition:ArrayRef.h:41
llvm::ArrayType
Class to represent array types.
Definition:DerivedTypes.h:395
llvm::AssumptionCache
A cache of @llvm.assume calls within a function.
Definition:AssumptionCache.h:42
llvm::BasicBlock
LLVM Basic Block Representation.
Definition:BasicBlock.h:61
llvm::BlockFrequencyInfo
BlockFrequencyInfo pass uses BlockFrequencyInfoImpl implementation to estimate IR basic block frequen...
Definition:BlockFrequencyInfo.h:37
llvm::BranchInst
Conditional or Unconditional Branch instruction.
Definition:Instructions.h:3016
llvm::BranchProbability
Definition:BranchProbability.h:30
llvm::CallBase
Base class for all callable instructions (InvokeInst and CallInst) Holds everything related to callin...
Definition:InstrTypes.h:1112
llvm::CmpInst::Predicate
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
Definition:InstrTypes.h:673
llvm::Constant
This is an important base class in LLVM.
Definition:Constant.h:42
llvm::DataLayout
A parsed version of the target data layout string in and methods for querying it.
Definition:DataLayout.h:63
llvm::DominatorTree
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition:Dominators.h:162
llvm::ElementCount
Definition:TypeSize.h:300
llvm::FastMathFlags
Convenience struct for specifying and reasoning about fast-math flags.
Definition:FMF.h:20
llvm::Function
Definition:Function.h:63
llvm::GlobalValue
Definition:GlobalValue.h:48
llvm::ImmutablePass
ImmutablePass class - This class is used to provide information that does not need to be run.
Definition:Pass.h:281
llvm::InstCombiner
The core instruction combiner logic.
Definition:InstCombiner.h:48
llvm::InstructionCost
Definition:InstructionCost.h:29
llvm::InstructionCost::getInvalid
static InstructionCost getInvalid(CostType Val=0)
Definition:InstructionCost.h:73
llvm::InstructionCost::isValid
bool isValid() const
Definition:InstructionCost.h:79
llvm::Instruction
Definition:Instruction.h:68
llvm::IntegerType
Class to represent integer types.
Definition:DerivedTypes.h:42
llvm::InterleavedAccessInfo
Drive the analysis of interleaved memory accesses in the loop.
Definition:VectorUtils.h:630
llvm::IntrinsicCostAttributes
Definition:TargetTransformInfo.h:119
llvm::IntrinsicCostAttributes::getFlags
FastMathFlags getFlags() const
Definition:TargetTransformInfo.h:153
llvm::IntrinsicCostAttributes::getArgTypes
const SmallVectorImpl< Type * > & getArgTypes() const
Definition:TargetTransformInfo.h:156
llvm::IntrinsicCostAttributes::getReturnType
Type * getReturnType() const
Definition:TargetTransformInfo.h:152
llvm::IntrinsicCostAttributes::skipScalarizationCost
bool skipScalarizationCost() const
Definition:TargetTransformInfo.h:162
llvm::IntrinsicCostAttributes::getArgs
const SmallVectorImpl< const Value * > & getArgs() const
Definition:TargetTransformInfo.h:155
llvm::IntrinsicCostAttributes::getScalarizationCost
InstructionCost getScalarizationCost() const
Definition:TargetTransformInfo.h:154
llvm::IntrinsicCostAttributes::getInst
const IntrinsicInst * getInst() const
Definition:TargetTransformInfo.h:151
llvm::IntrinsicCostAttributes::getID
Intrinsic::ID getID() const
Definition:TargetTransformInfo.h:150
llvm::IntrinsicCostAttributes::isTypeBasedOnly
bool isTypeBasedOnly() const
Definition:TargetTransformInfo.h:158
llvm::IntrinsicInst
A wrapper class for inspecting calls to intrinsic functions.
Definition:IntrinsicInst.h:48
llvm::LLVMContext
This is an important class for using LLVM in a threaded context.
Definition:LLVMContext.h:67
llvm::LoadInst
An instruction for reading from memory.
Definition:Instructions.h:176
llvm::LoopInfo
Definition:LoopInfo.h:407
llvm::LoopVectorizationLegality
LoopVectorizationLegality checks if it is legal to vectorize a loop, and to what vectorization factor...
Definition:LoopVectorizationLegality.h:252
llvm::Loop
Represents a single loop in the control flow graph.
Definition:LoopInfo.h:39
llvm::OptimizationRemarkEmitter
The optimization diagnostic interface.
Definition:OptimizationRemarkEmitter.h:32
llvm::PreservedAnalyses
A set of analyses that are preserved following a run of a transformation pass.
Definition:Analysis.h:111
llvm::ProfileSummaryInfo
Analysis providing profile information.
Definition:ProfileSummaryInfo.h:41
llvm::RecurrenceDescriptor
The RecurrenceDescriptor is used to identify recurrences variables in a loop.
Definition:IVDescriptors.h:77
llvm::SCEV
This class represents an analyzed expression in the program.
Definition:ScalarEvolution.h:71
llvm::ScalarEvolution
The main scalar evolution driver.
Definition:ScalarEvolution.h:447
llvm::SmallBitVector
This is a 'bitvector' (really, a variable-sized bit array), optimized for the case when the array is ...
Definition:SmallBitVector.h:35
llvm::SmallVectorImpl
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Definition:SmallVector.h:573
llvm::SmallVector
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
Definition:SmallVector.h:1196
llvm::StackOffset
StackOffset holds a fixed and a scalable offset in bytes.
Definition:TypeSize.h:33
llvm::StoreInst
An instruction for storing to memory.
Definition:Instructions.h:292
llvm::SwitchInst
Multiway switch.
Definition:Instructions.h:3154
llvm::TargetIRAnalysis
Analysis pass providing the TargetTransformInfo.
Definition:TargetTransformInfo.h:3194
llvm::TargetIRAnalysis::TargetIRAnalysis
TargetIRAnalysis(const TargetIRAnalysis &Arg)
Definition:TargetTransformInfo.h:3211
llvm::TargetIRAnalysis::operator=
TargetIRAnalysis & operator=(const TargetIRAnalysis &RHS)
Definition:TargetTransformInfo.h:3215
llvm::TargetIRAnalysis::run
Result run(const Function &F, FunctionAnalysisManager &)
Definition:TargetTransformInfo.cpp:1452
llvm::TargetIRAnalysis::Result
TargetTransformInfo Result
Definition:TargetTransformInfo.h:3196
llvm::TargetIRAnalysis::TargetIRAnalysis
TargetIRAnalysis()
Default construct a target IR analysis.
Definition:TargetTransformInfo.cpp:1446
llvm::TargetIRAnalysis::operator=
TargetIRAnalysis & operator=(TargetIRAnalysis &&RHS)
Definition:TargetTransformInfo.h:3219
llvm::TargetIRAnalysis::TargetIRAnalysis
TargetIRAnalysis(TargetIRAnalysis &&Arg)
Definition:TargetTransformInfo.h:3213
llvm::TargetLibraryInfo
Provides information about what library functions are available for the current target.
Definition:TargetLibraryInfo.h:280
llvm::TargetTransformInfoWrapperPass
Wrapper pass for TargetTransformInfo.
Definition:TargetTransformInfo.h:3250
llvm::TargetTransformInfoWrapperPass::TargetTransformInfoWrapperPass
TargetTransformInfoWrapperPass()
We must provide a default constructor for the pass but it should never be used.
Definition:TargetTransformInfo.cpp:1470
llvm::TargetTransformInfoWrapperPass::getTTI
TargetTransformInfo & getTTI(const Function &F)
Definition:TargetTransformInfo.cpp:1483
llvm::TargetTransformInfoWrapperPass::ID
static char ID
Definition:TargetTransformInfo.h:3257
llvm::TargetTransformInfo::Concept
Definition:TargetTransformInfo.h:1906
llvm::TargetTransformInfo::Concept::preferFixedOverScalableIfEqualCost
virtual bool preferFixedOverScalableIfEqualCost() const =0
llvm::TargetTransformInfo::Concept::simplifyDemandedUseBitsIntrinsic
virtual std::optional< Value * > simplifyDemandedUseBitsIntrinsic(InstCombiner &IC, IntrinsicInst &II, APInt DemandedMask, KnownBits &Known, bool &KnownBitsComputed)=0
llvm::TargetTransformInfo::Concept::getAddressComputationCost
virtual InstructionCost getAddressComputationCost(Type *Ty, ScalarEvolution *SE, const SCEV *Ptr)=0
llvm::TargetTransformInfo::Concept::getRegisterBitWidth
virtual TypeSize getRegisterBitWidth(RegisterKind K) const =0
llvm::TargetTransformInfo::Concept::getDataLayout
virtual const DataLayout & getDataLayout() const =0
llvm::TargetTransformInfo::Concept::getBranchMispredictPenalty
virtual InstructionCost getBranchMispredictPenalty()=0
llvm::TargetTransformInfo::Concept::isProfitableLSRChainElement
virtual bool isProfitableLSRChainElement(Instruction *I)=0
llvm::TargetTransformInfo::Concept::getGatherScatterOpCost
virtual InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)=0
llvm::TargetTransformInfo::Concept::getIntImmCostInst
virtual InstructionCost getIntImmCostInst(unsigned Opc, unsigned Idx, const APInt &Imm, Type *Ty, TargetCostKind CostKind, Instruction *Inst=nullptr)=0
llvm::TargetTransformInfo::Concept::getIntrinsicInstrCost
virtual InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::getFeatureMask
virtual uint64_t getFeatureMask(const Function &F) const =0
llvm::TargetTransformInfo::Concept::getUnrollingPreferences
virtual void getUnrollingPreferences(Loop *L, ScalarEvolution &, UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE)=0
llvm::TargetTransformInfo::Concept::isLegalNTStore
virtual bool isLegalNTStore(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::adjustInliningThreshold
virtual unsigned adjustInliningThreshold(const CallBase *CB)=0
llvm::TargetTransformInfo::Concept::getCmpSelInstrCost
virtual InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind, OperandValueInfo Op1Info, OperandValueInfo Op2Info, const Instruction *I)=0
llvm::TargetTransformInfo::Concept::isExpensiveToSpeculativelyExecute
virtual bool isExpensiveToSpeculativelyExecute(const Instruction *I)=0
llvm::TargetTransformInfo::Concept::shouldMaximizeVectorBandwidth
virtual bool shouldMaximizeVectorBandwidth(TargetTransformInfo::RegisterKind K) const =0
llvm::TargetTransformInfo::Concept::isLegalInterleavedAccessType
virtual bool isLegalInterleavedAccessType(VectorType *VTy, unsigned Factor, Align Alignment, unsigned AddrSpace)=0
llvm::TargetTransformInfo::Concept::instCombineIntrinsic
virtual std::optional< Instruction * > instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II)=0
llvm::TargetTransformInfo::Concept::preferPredicatedReductionSelect
virtual bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty, ReductionFlags) const =0
llvm::TargetTransformInfo::Concept::getVPLegalizationStrategy
virtual VPLegalization getVPLegalizationStrategy(const VPIntrinsic &PI) const =0
llvm::TargetTransformInfo::Concept::isLegalNTLoad
virtual bool isLegalNTLoad(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::enableOrderedReductions
virtual bool enableOrderedReductions()=0
llvm::TargetTransformInfo::Concept::getPopcntSupport
virtual PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit)=0
llvm::TargetTransformInfo::Concept::getNumberOfRegisters
virtual unsigned getNumberOfRegisters(unsigned ClassID) const =0
llvm::TargetTransformInfo::Concept::getPredicatedAddrSpace
virtual std::pair< const Value *, unsigned > getPredicatedAddrSpace(const Value *V) const =0
llvm::TargetTransformInfo::Concept::isLegalMaskedGather
virtual bool isLegalMaskedGather(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::areTypesABICompatible
virtual bool areTypesABICompatible(const Function *Caller, const Function *Callee, const ArrayRef< Type * > &Types) const =0
llvm::TargetTransformInfo::Concept::supportsTailCalls
virtual bool supportsTailCalls()=0
llvm::TargetTransformInfo::Concept::getIntImmCost
virtual InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::shouldPrefetchAddressSpace
virtual bool shouldPrefetchAddressSpace(unsigned AS) const =0
llvm::TargetTransformInfo::Concept::isFCmpOrdCheaperThanFCmpZero
virtual bool isFCmpOrdCheaperThanFCmpZero(Type *Ty)=0
llvm::TargetTransformInfo::Concept::getMinVectorRegisterBitWidth
virtual unsigned getMinVectorRegisterBitWidth() const =0
llvm::TargetTransformInfo::Concept::getAltInstrCost
virtual InstructionCost getAltInstrCost(VectorType *VecTy, unsigned Opcode0, unsigned Opcode1, const SmallBitVector &OpcodeMask, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput) const =0
llvm::TargetTransformInfo::Concept::getVScaleForTuning
virtual std::optional< unsigned > getVScaleForTuning() const =0
llvm::TargetTransformInfo::Concept::getIntImmCostIntrin
virtual InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::getMinMaxReductionCost
virtual InstructionCost getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::supportsEfficientVectorElementLoadStore
virtual bool supportsEfficientVectorElementLoadStore()=0
llvm::TargetTransformInfo::Concept::getRegUsageForType
virtual unsigned getRegUsageForType(Type *Ty)=0
llvm::TargetTransformInfo::Concept::hasArmWideBranch
virtual bool hasArmWideBranch(bool Thumb) const =0
llvm::TargetTransformInfo::Concept::enableMemCmpExpansion
virtual MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const =0
llvm::TargetTransformInfo::Concept::getMulAccReductionCost
virtual InstructionCost getMulAccReductionCost(bool IsUnsigned, Type *ResTy, VectorType *Ty, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput)=0
llvm::TargetTransformInfo::Concept::getArithmeticInstrCost
virtual InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind, OperandValueInfo Opd1Info, OperandValueInfo Opd2Info, ArrayRef< const Value * > Args, const Instruction *CxtI=nullptr)=0
llvm::TargetTransformInfo::Concept::getAssumedAddrSpace
virtual unsigned getAssumedAddrSpace(const Value *V) const =0
llvm::TargetTransformInfo::Concept::isTruncateFree
virtual bool isTruncateFree(Type *Ty1, Type *Ty2)=0
llvm::TargetTransformInfo::Concept::isTargetIntrinsicTriviallyScalarizable
virtual bool isTargetIntrinsicTriviallyScalarizable(Intrinsic::ID ID)=0
llvm::TargetTransformInfo::Concept::collectFlatAddressOperands
virtual bool collectFlatAddressOperands(SmallVectorImpl< int > &OpIndexes, Intrinsic::ID IID) const =0
llvm::TargetTransformInfo::Concept::getGEPCost
virtual InstructionCost getGEPCost(Type *PointeeType, const Value *Ptr, ArrayRef< const Value * > Operands, Type *AccessType, TTI::TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::shouldBuildLookupTables
virtual bool shouldBuildLookupTables()=0
llvm::TargetTransformInfo::Concept::isLegalBroadcastLoad
virtual bool isLegalBroadcastLoad(Type *ElementTy, ElementCount NumElements) const =0
llvm::TargetTransformInfo::Concept::isLegalToVectorizeStore
virtual bool isLegalToVectorizeStore(StoreInst *SI) const =0
llvm::TargetTransformInfo::Concept::isLegalMaskedVectorHistogram
virtual bool isLegalMaskedVectorHistogram(Type *AddrType, Type *DataType)=0
llvm::TargetTransformInfo::Concept::isVectorShiftByScalarCheap
virtual bool isVectorShiftByScalarCheap(Type *Ty) const =0
llvm::TargetTransformInfo::Concept::getGISelRematGlobalCost
virtual unsigned getGISelRematGlobalCost() const =0
llvm::TargetTransformInfo::Concept::getCallerAllocaCost
virtual unsigned getCallerAllocaCost(const CallBase *CB, const AllocaInst *AI) const =0
llvm::TargetTransformInfo::Concept::getScalingFactorCost
virtual InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, StackOffset BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace)=0
llvm::TargetTransformInfo::Concept::getMemcpyLoopLoweringType
virtual Type * getMemcpyLoopLoweringType(LLVMContext &Context, Value *Length, unsigned SrcAddrSpace, unsigned DestAddrSpace, Align SrcAlign, Align DestAlign, std::optional< uint32_t > AtomicElementSize) const =0
llvm::TargetTransformInfo::Concept::forceScalarizeMaskedScatter
virtual bool forceScalarizeMaskedScatter(VectorType *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::supportsTailCallFor
virtual bool supportsTailCallFor(const CallBase *CB)=0
llvm::TargetTransformInfo::Concept::getMaxVScale
virtual std::optional< unsigned > getMaxVScale() const =0
llvm::TargetTransformInfo::Concept::getInstructionCost
virtual InstructionCost getInstructionCost(const User *U, ArrayRef< const Value * > Operands, TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::isLegalToVectorizeReduction
virtual bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc, ElementCount VF) const =0
llvm::TargetTransformInfo::Concept::getMaxNumArgs
virtual unsigned getMaxNumArgs() const =0
llvm::TargetTransformInfo::Concept::shouldExpandReduction
virtual bool shouldExpandReduction(const IntrinsicInst *II) const =0
llvm::TargetTransformInfo::Concept::enableWritePrefetching
virtual bool enableWritePrefetching() const =0
llvm::TargetTransformInfo::Concept::useColdCCForColdCall
virtual bool useColdCCForColdCall(Function &F)=0
llvm::TargetTransformInfo::Concept::getInlineCallPenalty
virtual unsigned getInlineCallPenalty(const Function *F, const CallBase &Call, unsigned DefaultCallPenalty) const =0
llvm::TargetTransformInfo::Concept::preferInLoopReduction
virtual bool preferInLoopReduction(unsigned Opcode, Type *Ty, ReductionFlags) const =0
llvm::TargetTransformInfo::Concept::getInlinerVectorBonusPercent
virtual int getInlinerVectorBonusPercent() const =0
llvm::TargetTransformInfo::Concept::getMaxPrefetchIterationsAhead
virtual unsigned getMaxPrefetchIterationsAhead() const =0
llvm::TargetTransformInfo::Concept::isLegalMaskedScatter
virtual bool isLegalMaskedScatter(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::isIndexedLoadLegal
virtual bool isIndexedLoadLegal(MemIndexedMode Mode, Type *Ty) const =0
llvm::TargetTransformInfo::Concept::getCacheLineSize
virtual unsigned getCacheLineSize() const =0
llvm::TargetTransformInfo::Concept::isLegalToVectorizeStoreChain
virtual bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const =0
llvm::TargetTransformInfo::Concept::getStoreVectorFactor
virtual unsigned getStoreVectorFactor(unsigned VF, unsigned StoreSize, unsigned ChainSizeInBytes, VectorType *VecTy) const =0
llvm::TargetTransformInfo::Concept::getPreferredExpandedReductionShuffle
virtual ReductionShuffle getPreferredExpandedReductionShuffle(const IntrinsicInst *II) const =0
llvm::TargetTransformInfo::Concept::getPreferredAddressingMode
virtual AddressingModeKind getPreferredAddressingMode(const Loop *L, ScalarEvolution *SE) const =0
llvm::TargetTransformInfo::Concept::shouldBuildLookupTablesForConstant
virtual bool shouldBuildLookupTablesForConstant(Constant *C)=0
llvm::TargetTransformInfo::Concept::preferPredicateOverEpilogue
virtual bool preferPredicateOverEpilogue(TailFoldingInfo *TFI)=0
llvm::TargetTransformInfo::Concept::isProfitableToHoist
virtual bool isProfitableToHoist(Instruction *I)=0
llvm::TargetTransformInfo::Concept::getScalarizationOverhead
virtual InstructionCost getScalarizationOverhead(VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract, TargetCostKind CostKind, ArrayRef< Value * > VL={})=0
llvm::TargetTransformInfo::Concept::isLegalMaskedExpandLoad
virtual bool isLegalMaskedExpandLoad(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::getFPOpCost
virtual InstructionCost getFPOpCost(Type *Ty)=0
llvm::TargetTransformInfo::Concept::getMinTripCountTailFoldingThreshold
virtual unsigned getMinTripCountTailFoldingThreshold() const =0
llvm::TargetTransformInfo::Concept::enableMaskedInterleavedAccessVectorization
virtual bool enableMaskedInterleavedAccessVectorization()=0
llvm::TargetTransformInfo::Concept::getRegisterClassForType
virtual unsigned getRegisterClassForType(bool Vector, Type *Ty=nullptr) const =0
llvm::TargetTransformInfo::Concept::isTypeLegal
virtual bool isTypeLegal(Type *Ty)=0
llvm::TargetTransformInfo::Concept::getPredictableBranchThreshold
virtual BranchProbability getPredictableBranchThreshold()=0
llvm::TargetTransformInfo::Concept::enableScalableVectorization
virtual bool enableScalableVectorization() const =0
llvm::TargetTransformInfo::Concept::getTgtMemIntrinsic
virtual bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info)=0
llvm::TargetTransformInfo::Concept::isValidAddrSpaceCast
virtual bool isValidAddrSpaceCast(unsigned FromAS, unsigned ToAS) const =0
llvm::TargetTransformInfo::Concept::getRegisterClassName
virtual const char * getRegisterClassName(unsigned ClassID) const =0
llvm::TargetTransformInfo::Concept::getMaxInterleaveFactor
virtual unsigned getMaxInterleaveFactor(ElementCount VF)=0
llvm::TargetTransformInfo::Concept::enableAggressiveInterleaving
virtual bool enableAggressiveInterleaving(bool LoopHasReductions)=0
llvm::TargetTransformInfo::Concept::isLegalAltInstr
virtual bool isLegalAltInstr(VectorType *VecTy, unsigned Opcode0, unsigned Opcode1, const SmallBitVector &OpcodeMask) const =0
llvm::TargetTransformInfo::Concept::haveFastSqrt
virtual bool haveFastSqrt(Type *Ty)=0
llvm::TargetTransformInfo::Concept::isLegalMaskedCompressStore
virtual bool isLegalMaskedCompressStore(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::getCacheSize
virtual std::optional< unsigned > getCacheSize(CacheLevel Level) const =0
llvm::TargetTransformInfo::Concept::getCallInstrCost
virtual InstructionCost getCallInstrCost(Function *F, Type *RetTy, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::getPointersChainCost
virtual InstructionCost getPointersChainCost(ArrayRef< const Value * > Ptrs, const Value *Base, const TTI::PointersChainInfo &Info, Type *AccessTy, TTI::TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::getPeelingPreferences
virtual void getPeelingPreferences(Loop *L, ScalarEvolution &SE, PeelingPreferences &PP)=0
llvm::TargetTransformInfo::Concept::getCacheAssociativity
virtual std::optional< unsigned > getCacheAssociativity(CacheLevel Level) const =0
llvm::TargetTransformInfo::Concept::supportsScalableVectors
virtual bool supportsScalableVectors() const =0
llvm::TargetTransformInfo::Concept::getMemcpyLoopResidualLoweringType
virtual void getMemcpyLoopResidualLoweringType(SmallVectorImpl< Type * > &OpsOut, LLVMContext &Context, unsigned RemainingBytes, unsigned SrcAddrSpace, unsigned DestAddrSpace, Align SrcAlign, Align DestAlign, std::optional< uint32_t > AtomicCpySize) const =0
llvm::TargetTransformInfo::Concept::isTargetIntrinsicWithScalarOpAtArg
virtual bool isTargetIntrinsicWithScalarOpAtArg(Intrinsic::ID ID, unsigned ScalarOpdIdx)=0
llvm::TargetTransformInfo::Concept::forceScalarizeMaskedGather
virtual bool forceScalarizeMaskedGather(VectorType *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::getNumberOfParts
virtual unsigned getNumberOfParts(Type *Tp)=0
llvm::TargetTransformInfo::Concept::isLegalICmpImmediate
virtual bool isLegalICmpImmediate(int64_t Imm)=0
llvm::TargetTransformInfo::Concept::~Concept
virtual ~Concept()=0
llvm::TargetTransformInfo::Concept::getEstimatedNumberOfCaseClusters
virtual unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI, unsigned &JTSize, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI)=0
llvm::TargetTransformInfo::Concept::getCFInstrCost
virtual InstructionCost getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)=0
llvm::TargetTransformInfo::Concept::isElementTypeLegalForScalableVector
virtual bool isElementTypeLegalForScalableVector(Type *Ty) const =0
llvm::TargetTransformInfo::Concept::getPreferredTailFoldingStyle
virtual TailFoldingStyle getPreferredTailFoldingStyle(bool IVUpdateMayOverflow=true)=0
llvm::TargetTransformInfo::Concept::hasDivRemOp
virtual bool hasDivRemOp(Type *DataType, bool IsSigned)=0
llvm::TargetTransformInfo::Concept::getMinPrefetchStride
virtual unsigned getMinPrefetchStride(unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const =0
llvm::TargetTransformInfo::Concept::shouldBuildRelLookupTables
virtual bool shouldBuildRelLookupTables()=0
llvm::TargetTransformInfo::Concept::getOperandsScalarizationOverhead
virtual InstructionCost getOperandsScalarizationOverhead(ArrayRef< const Value * > Args, ArrayRef< Type * > Tys, TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::isLoweredToCall
virtual bool isLoweredToCall(const Function *F)=0
llvm::TargetTransformInfo::Concept::isSourceOfDivergence
virtual bool isSourceOfDivergence(const Value *V)=0
llvm::TargetTransformInfo::Concept::isLegalAddScalableImmediate
virtual bool isLegalAddScalableImmediate(int64_t Imm)=0
llvm::TargetTransformInfo::Concept::canHaveNonUndefGlobalInitializerInAddressSpace
virtual bool canHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS) const =0
llvm::TargetTransformInfo::Concept::getInliningCostBenefitAnalysisSavingsMultiplier
virtual unsigned getInliningCostBenefitAnalysisSavingsMultiplier() const =0
llvm::TargetTransformInfo::Concept::isLegalMaskedLoad
virtual bool isLegalMaskedLoad(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::getNumBytesToPadGlobalArray
virtual unsigned getNumBytesToPadGlobalArray(unsigned Size, Type *ArrayType) const =0
llvm::TargetTransformInfo::Concept::getExtendedReductionCost
virtual InstructionCost getExtendedReductionCost(unsigned Opcode, bool IsUnsigned, Type *ResTy, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput)=0
llvm::TargetTransformInfo::Concept::isFPVectorizationPotentiallyUnsafe
virtual bool isFPVectorizationPotentiallyUnsafe()=0
llvm::TargetTransformInfo::Concept::getOrCreateResultFromMemIntrinsic
virtual Value * getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst, Type *ExpectedType)=0
llvm::TargetTransformInfo::Concept::getLoadVectorFactor
virtual unsigned getLoadVectorFactor(unsigned VF, unsigned LoadSize, unsigned ChainSizeInBytes, VectorType *VecTy) const =0
llvm::TargetTransformInfo::Concept::getIntImmCodeSizeCost
virtual InstructionCost getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, const APInt &Imm, Type *Ty)=0
llvm::TargetTransformInfo::Concept::hasConditionalLoadStoreForType
virtual bool hasConditionalLoadStoreForType(Type *Ty=nullptr) const =0
llvm::TargetTransformInfo::Concept::getPartialReductionCost
virtual InstructionCost getPartialReductionCost(unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType, ElementCount VF, PartialReductionExtendKind OpAExtend, PartialReductionExtendKind OpBExtend, std::optional< unsigned > BinOp) const =0
llvm::TargetTransformInfo::Concept::getCastInstrCost
virtual InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, CastContextHint CCH, TTI::TargetCostKind CostKind, const Instruction *I)=0
llvm::TargetTransformInfo::Concept::isProfitableToSinkOperands
virtual bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl< Use * > &OpsToSink) const =0
llvm::TargetTransformInfo::Concept::hasBranchDivergence
virtual bool hasBranchDivergence(const Function *F=nullptr)=0
llvm::TargetTransformInfo::Concept::getArithmeticReductionCost
virtual InstructionCost getArithmeticReductionCost(unsigned Opcode, VectorType *Ty, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::isMultiversionedFunction
virtual bool isMultiversionedFunction(const Function &F) const =0
llvm::TargetTransformInfo::Concept::getInliningThresholdMultiplier
virtual unsigned getInliningThresholdMultiplier() const =0
llvm::TargetTransformInfo::Concept::getReplicationShuffleCost
virtual InstructionCost getReplicationShuffleCost(Type *EltTy, int ReplicationFactor, int VF, const APInt &DemandedDstElts, TTI::TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::useAA
virtual bool useAA()=0
llvm::TargetTransformInfo::Concept::isLegalMaskedStore
virtual bool isLegalMaskedStore(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::getVectorInstrCost
virtual InstructionCost getVectorInstrCost(const Instruction &I, Type *Val, TTI::TargetCostKind CostKind, unsigned Index)=0
llvm::TargetTransformInfo::Concept::isLegalToVectorizeLoad
virtual bool isLegalToVectorizeLoad(LoadInst *LI) const =0
llvm::TargetTransformInfo::Concept::isLegalToVectorizeLoadChain
virtual bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const =0
llvm::TargetTransformInfo::Concept::getLoadStoreVecRegBitWidth
virtual unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const =0
llvm::TargetTransformInfo::Concept::isTargetIntrinsicWithOverloadTypeAtArg
virtual bool isTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::ID ID, int OpdIdx)=0
llvm::TargetTransformInfo::Concept::isLSRCostLess
virtual bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2)=0
llvm::TargetTransformInfo::Concept::shouldDropLSRSolutionIfLessProfitable
virtual bool shouldDropLSRSolutionIfLessProfitable() const =0
llvm::TargetTransformInfo::Concept::isNoopAddrSpaceCast
virtual bool isNoopAddrSpaceCast(unsigned FromAS, unsigned ToAS) const =0
llvm::TargetTransformInfo::Concept::getInterleavedMemoryOpCost
virtual InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, bool UseMaskForCond=false, bool UseMaskForGaps=false)=0
llvm::TargetTransformInfo::Concept::prefersVectorizedAddressing
virtual bool prefersVectorizedAddressing()=0
llvm::TargetTransformInfo::Concept::getMaxMemIntrinsicInlineSizeThreshold
virtual uint64_t getMaxMemIntrinsicInlineSizeThreshold() const =0
llvm::TargetTransformInfo::Concept::getShuffleCost
virtual InstructionCost getShuffleCost(ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask, TTI::TargetCostKind CostKind, int Index, VectorType *SubTp, ArrayRef< const Value * > Args, const Instruction *CxtI)=0
llvm::TargetTransformInfo::Concept::getMemoryOpCost
virtual InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, OperandValueInfo OpInfo, const Instruction *I)=0
llvm::TargetTransformInfo::Concept::canSaveCmp
virtual bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, DominatorTree *DT, AssumptionCache *AC, TargetLibraryInfo *LibInfo)=0
llvm::TargetTransformInfo::Concept::getMaskedMemoryOpCost
virtual InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind)=0
llvm::TargetTransformInfo::Concept::isHardwareLoopProfitable
virtual bool isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo)=0
llvm::TargetTransformInfo::Concept::isAlwaysUniform
virtual bool isAlwaysUniform(const Value *V)=0
llvm::TargetTransformInfo::Concept::getMinPageSize
virtual std::optional< unsigned > getMinPageSize() const =0
llvm::TargetTransformInfo::Concept::canMacroFuseCmp
virtual bool canMacroFuseCmp()=0
llvm::TargetTransformInfo::Concept::getMemcpyCost
virtual InstructionCost getMemcpyCost(const Instruction *I)=0
llvm::TargetTransformInfo::Concept::getMinimumVF
virtual ElementCount getMinimumVF(unsigned ElemWidth, bool IsScalable) const =0
llvm::TargetTransformInfo::Concept::areInlineCompatible
virtual bool areInlineCompatible(const Function *Caller, const Function *Callee) const =0
llvm::TargetTransformInfo::Concept::addrspacesMayAlias
virtual bool addrspacesMayAlias(unsigned AS0, unsigned AS1) const =0
llvm::TargetTransformInfo::Concept::getExtractWithExtendCost
virtual InstructionCost getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index)=0
llvm::TargetTransformInfo::Concept::getEpilogueVectorizationMinVF
virtual unsigned getEpilogueVectorizationMinVF()=0
llvm::TargetTransformInfo::Concept::simplifyDemandedVectorEltsIntrinsic
virtual std::optional< Value * > simplifyDemandedVectorEltsIntrinsic(InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts, APInt &UndefElts2, APInt &UndefElts3, std::function< void(Instruction *, unsigned, APInt, APInt &)> SimplifyAndSetOp)=0
llvm::TargetTransformInfo::Concept::getStridedMemoryOpCost
virtual InstructionCost getStridedMemoryOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind, const Instruction *I=nullptr)=0
llvm::TargetTransformInfo::Concept::getFlatAddressSpace
virtual unsigned getFlatAddressSpace()=0
llvm::TargetTransformInfo::Concept::getVectorInstrCost
virtual InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Op0, Value *Op1)=0
llvm::TargetTransformInfo::Concept::getVectorInstrCost
virtual InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index, Value *Scalar, ArrayRef< std::tuple< Value *, User *, int > > ScalarUserAndIdx)=0
llvm::TargetTransformInfo::Concept::getPrefetchDistance
virtual unsigned getPrefetchDistance() const =0
llvm::TargetTransformInfo::Concept::enableSelectOptimize
virtual bool enableSelectOptimize()=0
llvm::TargetTransformInfo::Concept::LSRWithInstrQueries
virtual bool LSRWithInstrQueries()=0
llvm::TargetTransformInfo::Concept::shouldTreatInstructionLikeSelect
virtual bool shouldTreatInstructionLikeSelect(const Instruction *I)=0
llvm::TargetTransformInfo::Concept::hasVolatileVariant
virtual bool hasVolatileVariant(Instruction *I, unsigned AddrSpace)=0
llvm::TargetTransformInfo::Concept::preferToKeepConstantsAttached
virtual bool preferToKeepConstantsAttached(const Instruction &Inst, const Function &Fn) const =0
llvm::TargetTransformInfo::Concept::isNumRegsMajorCostOfLSR
virtual bool isNumRegsMajorCostOfLSR()=0
llvm::TargetTransformInfo::Concept::isLegalStridedLoadStore
virtual bool isLegalStridedLoadStore(Type *DataType, Align Alignment)=0
llvm::TargetTransformInfo::Concept::isSingleThreaded
virtual bool isSingleThreaded() const =0
llvm::TargetTransformInfo::Concept::isLegalAddImmediate
virtual bool isLegalAddImmediate(int64_t Imm)=0
llvm::TargetTransformInfo::Concept::rewriteIntrinsicWithAddressSpace
virtual Value * rewriteIntrinsicWithAddressSpace(IntrinsicInst *II, Value *OldV, Value *NewV) const =0
llvm::TargetTransformInfo::Concept::isLegalAddressingMode
virtual bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace, Instruction *I, int64_t ScalableOffset)=0
llvm::TargetTransformInfo::Concept::shouldConsiderAddressTypePromotion
virtual bool shouldConsiderAddressTypePromotion(const Instruction &I, bool &AllowPromotionWithoutCommonHeader)=0
llvm::TargetTransformInfo::Concept::getStoreMinimumVF
virtual unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy, Type *ScalarValTy) const =0
llvm::TargetTransformInfo::Concept::isVScaleKnownToBeAPowerOfTwo
virtual bool isVScaleKnownToBeAPowerOfTwo() const =0
llvm::TargetTransformInfo::Concept::getCostOfKeepingLiveOverCall
virtual InstructionCost getCostOfKeepingLiveOverCall(ArrayRef< Type * > Tys)=0
llvm::TargetTransformInfo::Concept::hasActiveVectorLength
virtual bool hasActiveVectorLength(unsigned Opcode, Type *DataType, Align Alignment) const =0
llvm::TargetTransformInfo::Concept::enableInterleavedAccessVectorization
virtual bool enableInterleavedAccessVectorization()=0
llvm::TargetTransformInfo::Concept::isTargetIntrinsicWithStructReturnOverloadAtField
virtual bool isTargetIntrinsicWithStructReturnOverloadAtField(Intrinsic::ID ID, int RetIdx)=0
llvm::TargetTransformInfo::Concept::getAtomicMemIntrinsicMaxElementSize
virtual unsigned getAtomicMemIntrinsicMaxElementSize() const =0
llvm::TargetTransformInfo::Concept::preferEpilogueVectorization
virtual bool preferEpilogueVectorization() const =0
llvm::TargetTransformInfo::Concept::getVPMemoryOpCost
virtual InstructionCost getVPMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind, const Instruction *I)=0
llvm::TargetTransformInfo::Concept::getInliningLastCallToStaticBonus
virtual int getInliningLastCallToStaticBonus() const =0
llvm::TargetTransformInfo::Concept::getMaximumVF
virtual unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const =0
llvm::TargetTransformInfo::Concept::isIndexedStoreLegal
virtual bool isIndexedStoreLegal(MemIndexedMode Mode, Type *Ty) const =0
llvm::TargetTransformInfo::Concept::allowsMisalignedMemoryAccesses
virtual bool allowsMisalignedMemoryAccesses(LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace, Align Alignment, unsigned *Fast)=0
llvm::TargetTransformInfo::Concept::getInliningCostBenefitAnalysisProfitableMultiplier
virtual unsigned getInliningCostBenefitAnalysisProfitableMultiplier() const =0
llvm::TargetTransformInfo
This pass provides access to the codegen interfaces that are needed for IR-level transformations.
Definition:TargetTransformInfo.h:212
llvm::TargetTransformInfo::getTgtMemIntrinsic
bool getTgtMemIntrinsic(IntrinsicInst *Inst, MemIntrinsicInfo &Info) const
Definition:TargetTransformInfo.cpp:1251
llvm::TargetTransformInfo::isLegalToVectorizeLoad
bool isLegalToVectorizeLoad(LoadInst *LI) const
Definition:TargetTransformInfo.cpp:1316
llvm::TargetTransformInfo::getVScaleForTuning
std::optional< unsigned > getVScaleForTuning() const
Definition:TargetTransformInfo.cpp:789
llvm::TargetTransformInfo::ReductionShuffle
ReductionShuffle
Definition:TargetTransformInfo.h:1788
llvm::TargetTransformInfo::ReductionShuffle::Pairwise
@ Pairwise
llvm::TargetTransformInfo::ReductionShuffle::SplitHalf
@ SplitHalf
llvm::TargetTransformInfo::getCastContextHint
static CastContextHint getCastContextHint(const Instruction *I)
Calculates a CastContextHint from I.
Definition:TargetTransformInfo.cpp:996
llvm::TargetTransformInfo::getMaxNumArgs
unsigned getMaxNumArgs() const
Definition:TargetTransformInfo.cpp:1394
llvm::TargetTransformInfo::addrspacesMayAlias
bool addrspacesMayAlias(unsigned AS0, unsigned AS1) const
Return false if a AS0 address cannot possibly alias a AS1 address.
Definition:TargetTransformInfo.cpp:310
llvm::TargetTransformInfo::isLegalMaskedScatter
bool isLegalMaskedScatter(Type *DataType, Align Alignment) const
Return true if the target supports masked scatter.
Definition:TargetTransformInfo.cpp:501
llvm::TargetTransformInfo::getStridedMemoryOpCost
InstructionCost getStridedMemoryOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, const Instruction *I=nullptr) const
Definition:TargetTransformInfo.cpp:1156
llvm::TargetTransformInfo::shouldBuildLookupTables
bool shouldBuildLookupTables() const
Return true if switches should be turned into lookup tables for the target.
Definition:TargetTransformInfo.cpp:591
llvm::TargetTransformInfo::isLegalToVectorizeStore
bool isLegalToVectorizeStore(StoreInst *SI) const
Definition:TargetTransformInfo.cpp:1320
llvm::TargetTransformInfo::enableAggressiveInterleaving
bool enableAggressiveInterleaving(bool LoopHasReductions) const
Don't restrict interleaved unrolling to small loops.
Definition:TargetTransformInfo.cpp:653
llvm::TargetTransformInfo::getFeatureMask
uint64_t getFeatureMask(const Function &F) const
Returns a bitmask constructed from the target-features or fmv-features metadata of a function.
Definition:TargetTransformInfo.cpp:1386
llvm::TargetTransformInfo::isMultiversionedFunction
bool isMultiversionedFunction(const Function &F) const
Returns true if this is an instance of a function with multiple versions.
Definition:TargetTransformInfo.cpp:1390
llvm::TargetTransformInfo::isFCmpOrdCheaperThanFCmpZero
bool isFCmpOrdCheaperThanFCmpZero(Type *Ty) const
Return true if it is faster to check if a floating-point value is NaN (or not-NaN) versus a compariso...
Definition:TargetTransformInfo.cpp:708
llvm::TargetTransformInfo::preferInLoopReduction
bool preferInLoopReduction(unsigned Opcode, Type *Ty, ReductionFlags Flags) const
Definition:TargetTransformInfo.cpp:1363
llvm::TargetTransformInfo::supportsEfficientVectorElementLoadStore
bool supportsEfficientVectorElementLoadStore() const
If target has efficient vector element load/store instructions, it can return true here so that inser...
Definition:TargetTransformInfo.cpp:641
llvm::TargetTransformInfo::isAlwaysUniform
bool isAlwaysUniform(const Value *V) const
Definition:TargetTransformInfo.cpp:301
llvm::TargetTransformInfo::getAssumedAddrSpace
unsigned getAssumedAddrSpace(const Value *V) const
Definition:TargetTransformInfo.cpp:334
llvm::TargetTransformInfo::shouldDropLSRSolutionIfLessProfitable
bool shouldDropLSRSolutionIfLessProfitable() const
Return true if LSR should drop a found solution if it's calculated to be less profitable than the bas...
Definition:TargetTransformInfo.cpp:441
llvm::TargetTransformInfo::isLSRCostLess
bool isLSRCostLess(const TargetTransformInfo::LSRCost &C1, const TargetTransformInfo::LSRCost &C2) const
Return true if LSR cost of C1 is lower than C2.
Definition:TargetTransformInfo.cpp:432
llvm::TargetTransformInfo::getPrefetchDistance
unsigned getPrefetchDistance() const
Definition:TargetTransformInfo.cpp:843
llvm::TargetTransformInfo::getMemcpyLoopLoweringType
Type * getMemcpyLoopLoweringType(LLVMContext &Context, Value *Length, unsigned SrcAddrSpace, unsigned DestAddrSpace, Align SrcAlign, Align DestAlign, std::optional< uint32_t > AtomicElementSize=std::nullopt) const
Definition:TargetTransformInfo.cpp:1265
llvm::TargetTransformInfo::isLegalMaskedExpandLoad
bool isLegalMaskedExpandLoad(Type *DataType, Align Alignment) const
Return true if the target supports masked expand load.
Definition:TargetTransformInfo.cpp:521
llvm::TargetTransformInfo::prefersVectorizedAddressing
bool prefersVectorizedAddressing() const
Return true if target doesn't mind addresses in vectors.
Definition:TargetTransformInfo.cpp:556
llvm::TargetTransformInfo::getCmpSelInstrCost
InstructionCost getCmpSelInstrCost(unsigned Opcode, Type *ValTy, Type *CondTy, CmpInst::Predicate VecPred, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, OperandValueInfo Op1Info={OK_AnyValue, OP_None}, OperandValueInfo Op2Info={OK_AnyValue, OP_None}, const Instruction *I=nullptr) const
Definition:TargetTransformInfo.cpp:1067
llvm::TargetTransformInfo::hasBranchDivergence
bool hasBranchDivergence(const Function *F=nullptr) const
Return true if branch divergence exists.
Definition:TargetTransformInfo.cpp:289
llvm::TargetTransformInfo::enableMemCmpExpansion
MemCmpExpansionOptions enableMemCmpExpansion(bool OptSize, bool IsZeroCmp) const
Definition:TargetTransformInfo.cpp:659
llvm::TargetTransformInfo::getAddressComputationCost
InstructionCost getAddressComputationCost(Type *Ty, ScalarEvolution *SE=nullptr, const SCEV *Ptr=nullptr) const
Definition:TargetTransformInfo.cpp:1198
llvm::TargetTransformInfo::invalidate
bool invalidate(Function &, const PreservedAnalyses &, FunctionAnalysisManager::Invalidator &)
Handle the invalidation of this information.
Definition:TargetTransformInfo.h:247
llvm::TargetTransformInfo::getUnrollingPreferences
void getUnrollingPreferences(Loop *L, ScalarEvolution &, UnrollingPreferences &UP, OptimizationRemarkEmitter *ORE) const
Get target-customized preferences for the generic loop unrolling transformation.
Definition:TargetTransformInfo.cpp:399
llvm::TargetTransformInfo::shouldBuildLookupTablesForConstant
bool shouldBuildLookupTablesForConstant(Constant *C) const
Return true if switches should be turned into lookup tables containing this constant value for the ta...
Definition:TargetTransformInfo.cpp:595
llvm::TargetTransformInfo::getOperandsScalarizationOverhead
InstructionCost getOperandsScalarizationOverhead(ArrayRef< const Value * > Args, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind) const
Estimate the overhead of scalarizing an instructions unique non-constant operands.
Definition:TargetTransformInfo.cpp:635
llvm::TargetTransformInfo::supportsTailCallFor
bool supportsTailCallFor(const CallBase *CB) const
If target supports tail call on CB.
Definition:TargetTransformInfo.cpp:649
llvm::TargetTransformInfo::instCombineIntrinsic
std::optional< Instruction * > instCombineIntrinsic(InstCombiner &IC, IntrinsicInst &II) const
Targets can implement their own combinations for target-specific intrinsics.
Definition:TargetTransformInfo.cpp:377
llvm::TargetTransformInfo::isProfitableLSRChainElement
bool isProfitableLSRChainElement(Instruction *I) const
Definition:TargetTransformInfo.cpp:445
llvm::TargetTransformInfo::getRegisterBitWidth
TypeSize getRegisterBitWidth(RegisterKind K) const
Definition:TargetTransformInfo.cpp:776
llvm::TargetTransformInfo::getInlineCallPenalty
unsigned getInlineCallPenalty(const Function *F, const CallBase &Call, unsigned DefaultCallPenalty) const
Returns a penalty for invoking call Call in F.
Definition:TargetTransformInfo.cpp:1290
llvm::TargetTransformInfo::isExpensiveToSpeculativelyExecute
bool isExpensiveToSpeculativelyExecute(const Instruction *I) const
Return true if the cost of the instruction is too high to speculatively execute and should be kept be...
Definition:TargetTransformInfo.cpp:703
llvm::TargetTransformInfo::isLegalMaskedGather
bool isLegalMaskedGather(Type *DataType, Align Alignment) const
Return true if the target supports masked gather.
Definition:TargetTransformInfo.cpp:490
llvm::TargetTransformInfo::getMemoryOpCost
InstructionCost getMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, OperandValueInfo OpdInfo={OK_AnyValue, OP_None}, const Instruction *I=nullptr) const
Definition:TargetTransformInfo.cpp:1125
llvm::TargetTransformInfo::getMaxVScale
std::optional< unsigned > getMaxVScale() const
Definition:TargetTransformInfo.cpp:785
llvm::TargetTransformInfo::getReplicationShuffleCost
InstructionCost getReplicationShuffleCost(Type *EltTy, int ReplicationFactor, int VF, const APInt &DemandedDstElts, TTI::TargetCostKind CostKind) const
Definition:TargetTransformInfo.cpp:1116
llvm::TargetTransformInfo::getInterleavedMemoryOpCost
InstructionCost getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, unsigned Factor, ArrayRef< unsigned > Indices, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, bool UseMaskForCond=false, bool UseMaskForGaps=false) const
Definition:TargetTransformInfo.cpp:1165
llvm::TargetTransformInfo::isSingleThreaded
bool isSingleThreaded() const
Definition:TargetTransformInfo.cpp:338
llvm::TargetTransformInfo::simplifyDemandedVectorEltsIntrinsic
std::optional< Value * > simplifyDemandedVectorEltsIntrinsic(InstCombiner &IC, IntrinsicInst &II, APInt DemandedElts, APInt &UndefElts, APInt &UndefElts2, APInt &UndefElts3, std::function< void(Instruction *, unsigned, APInt, APInt &)> SimplifyAndSetOp) const
Can be used to implement target-specific instruction combining.
Definition:TargetTransformInfo.cpp:389
llvm::TargetTransformInfo::enableOrderedReductions
bool enableOrderedReductions() const
Return true if we should be enabling ordered reductions for the target.
Definition:TargetTransformInfo.cpp:543
llvm::TargetTransformInfo::getInstructionCost
InstructionCost getInstructionCost(const User *U, TargetCostKind CostKind) const
This is a helper function which calls the three-argument getInstructionCost with Operands which are t...
Definition:TargetTransformInfo.h:417
llvm::TargetTransformInfo::getInliningCostBenefitAnalysisProfitableMultiplier
unsigned getInliningCostBenefitAnalysisProfitableMultiplier() const
Definition:TargetTransformInfo.cpp:225
llvm::TargetTransformInfo::getIntrinsicInstrCost
InstructionCost getIntrinsicInstrCost(const IntrinsicCostAttributes &ICA, TTI::TargetCostKind CostKind) const
Definition:TargetTransformInfo.cpp:1177
llvm::TargetTransformInfo::getArithmeticReductionCost
InstructionCost getArithmeticReductionCost(unsigned Opcode, VectorType *Ty, std::optional< FastMathFlags > FMF, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput) const
Calculate the cost of vector reduction intrinsics.
Definition:TargetTransformInfo.cpp:1215
llvm::TargetTransformInfo::getAtomicMemIntrinsicMaxElementSize
unsigned getAtomicMemIntrinsicMaxElementSize() const
Definition:TargetTransformInfo.cpp:1256
llvm::TargetTransformInfo::getCastInstrCost
InstructionCost getCastInstrCost(unsigned Opcode, Type *Dst, Type *Src, TTI::CastContextHint CCH, TTI::TargetCostKind CostKind=TTI::TCK_SizeAndLatency, const Instruction *I=nullptr) const
Definition:TargetTransformInfo.cpp:1039
llvm::TargetTransformInfo::LSRWithInstrQueries
bool LSRWithInstrQueries() const
Return true if the loop strength reduce pass should make Instruction* based TTI queries to isLegalAdd...
Definition:TargetTransformInfo.cpp:569
llvm::TargetTransformInfo::getStoreVectorFactor
unsigned getStoreVectorFactor(unsigned VF, unsigned StoreSize, unsigned ChainSizeInBytes, VectorType *VecTy) const
Definition:TargetTransformInfo.cpp:1352
llvm::TargetTransformInfo::getVPLegalizationStrategy
VPLegalization getVPLegalizationStrategy(const VPIntrinsic &PI) const
Definition:TargetTransformInfo.cpp:1378
llvm::TargetTransformInfo::getPartialReductionExtendKind
static PartialReductionExtendKind getPartialReductionExtendKind(Instruction *I)
Get the kind of extension that an instruction represents.
Definition:TargetTransformInfo.cpp:987
llvm::TargetTransformInfo::enableWritePrefetching
bool enableWritePrefetching() const
Definition:TargetTransformInfo.cpp:858
llvm::TargetTransformInfo::shouldTreatInstructionLikeSelect
bool shouldTreatInstructionLikeSelect(const Instruction *I) const
Should the Select Optimization pass treat the given instruction like a select, potentially converting...
Definition:TargetTransformInfo.cpp:667
llvm::TargetTransformInfo::isNoopAddrSpaceCast
bool isNoopAddrSpaceCast(unsigned FromAS, unsigned ToAS) const
Definition:TargetTransformInfo.cpp:324
llvm::TargetTransformInfo::shouldMaximizeVectorBandwidth
bool shouldMaximizeVectorBandwidth(TargetTransformInfo::RegisterKind K) const
Definition:TargetTransformInfo.cpp:797
llvm::TargetTransformInfo::getPreferredTailFoldingStyle
TailFoldingStyle getPreferredTailFoldingStyle(bool IVUpdateMayOverflow=true) const
Query the target what the preferred style of tail folding is.
Definition:TargetTransformInfo.cpp:371
llvm::TargetTransformInfo::getGEPCost
InstructionCost getGEPCost(Type *PointeeType, const Value *Ptr, ArrayRef< const Value * > Operands, Type *AccessType=nullptr, TargetCostKind CostKind=TCK_SizeAndLatency) const
Estimate the cost of a GEP operation when lowered.
Definition:TargetTransformInfo.cpp:248
llvm::TargetTransformInfo::isLegalToVectorizeStoreChain
bool isLegalToVectorizeStoreChain(unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const
Definition:TargetTransformInfo.cpp:1330
llvm::TargetTransformInfo::isLegalInterleavedAccessType
bool isLegalInterleavedAccessType(VectorType *VTy, unsigned Factor, Align Alignment, unsigned AddrSpace) const
Return true is the target supports interleaved access for the given vector type VTy,...
Definition:TargetTransformInfo.cpp:531
llvm::TargetTransformInfo::getRegUsageForType
unsigned getRegUsageForType(Type *Ty) const
Returns the estimated number of registers required to represent Ty.
Definition:TargetTransformInfo.cpp:587
llvm::TargetTransformInfo::isLegalBroadcastLoad
bool isLegalBroadcastLoad(Type *ElementTy, ElementCount NumElements) const
\Returns true if the target supports broadcasting a load to a vector of type <NumElements x ElementTy...
Definition:TargetTransformInfo.cpp:485
llvm::TargetTransformInfo::isIndexedStoreLegal
bool isIndexedStoreLegal(enum MemIndexedMode Mode, Type *Ty) const
Definition:TargetTransformInfo.cpp:1307
llvm::TargetTransformInfo::getPredicatedAddrSpace
std::pair< const Value *, unsigned > getPredicatedAddrSpace(const Value *V) const
Definition:TargetTransformInfo.cpp:343
llvm::TargetTransformInfo::getLoadStoreVecRegBitWidth
unsigned getLoadStoreVecRegBitWidth(unsigned AddrSpace) const
Definition:TargetTransformInfo.cpp:1312
llvm::TargetTransformInfo::getPreferredExpandedReductionShuffle
ReductionShuffle getPreferredExpandedReductionShuffle(const IntrinsicInst *II) const
Definition:TargetTransformInfo.cpp:1403
llvm::TargetTransformInfo::getExtendedReductionCost
InstructionCost getExtendedReductionCost(unsigned Opcode, bool IsUnsigned, Type *ResTy, VectorType *Ty, FastMathFlags FMF, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput) const
Calculate the cost of an extended reduction pattern, similar to getArithmeticReductionCost of a reduc...
Definition:TargetTransformInfo.cpp:1233
llvm::TargetTransformInfo::getOperandInfo
static OperandValueInfo getOperandInfo(const Value *V)
Collect properties of V used in cost analysis, e.g. OP_PowerOf2.
Definition:TargetTransformInfo.cpp:880
llvm::TargetTransformInfo::getMulAccReductionCost
InstructionCost getMulAccReductionCost(bool IsUnsigned, Type *ResTy, VectorType *Ty, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput) const
Calculate the cost of an extended reduction pattern, similar to getArithmeticReductionCost of an Add ...
Definition:TargetTransformInfo.cpp:1240
llvm::TargetTransformInfo::getRegisterClassForType
unsigned getRegisterClassForType(bool Vector, Type *Ty=nullptr) const
Definition:TargetTransformInfo.cpp:767
llvm::TargetTransformInfo::isLegalAddressingMode
bool isLegalAddressingMode(Type *Ty, GlobalValue *BaseGV, int64_t BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace=0, Instruction *I=nullptr, int64_t ScalableOffset=0) const
Return true if the addressing mode represented by AM is legal for this target, for a load/store of th...
Definition:TargetTransformInfo.cpp:422
llvm::TargetTransformInfo::getPopcntSupport
PopcntSupportKind getPopcntSupport(unsigned IntTyWidthInBit) const
Return hardware support for population count.
Definition:TargetTransformInfo.cpp:695
llvm::TargetTransformInfo::getEstimatedNumberOfCaseClusters
unsigned getEstimatedNumberOfCaseClusters(const SwitchInst &SI, unsigned &JTSize, ProfileSummaryInfo *PSI, BlockFrequencyInfo *BFI) const
Definition:TargetTransformInfo.cpp:263
llvm::TargetTransformInfo::isElementTypeLegalForScalableVector
bool isElementTypeLegalForScalableVector(Type *Ty) const
Definition:TargetTransformInfo.cpp:1341
llvm::TargetTransformInfo::forceScalarizeMaskedGather
bool forceScalarizeMaskedGather(VectorType *Type, Align Alignment) const
Return true if the target forces scalarizing of llvm.masked.gather intrinsics.
Definition:TargetTransformInfo.cpp:506
llvm::TargetTransformInfo::getMaxPrefetchIterationsAhead
unsigned getMaxPrefetchIterationsAhead() const
Definition:TargetTransformInfo.cpp:854
llvm::TargetTransformInfo::canHaveNonUndefGlobalInitializerInAddressSpace
bool canHaveNonUndefGlobalInitializerInAddressSpace(unsigned AS) const
Return true if globals in this address space can have initializers other than undef.
Definition:TargetTransformInfo.cpp:329
llvm::TargetTransformInfo::getMinimumVF
ElementCount getMinimumVF(unsigned ElemWidth, bool IsScalable) const
Definition:TargetTransformInfo.cpp:802
llvm::TargetTransformInfo::getIntImmCostIntrin
InstructionCost getIntImmCostIntrin(Intrinsic::ID IID, unsigned Idx, const APInt &Imm, Type *Ty, TargetCostKind CostKind) const
Definition:TargetTransformInfo.cpp:745
llvm::TargetTransformInfo::enableMaskedInterleavedAccessVectorization
bool enableMaskedInterleavedAccessVectorization() const
Enable matching of interleaved access groups that contain predicated accesses or gaps and therefore v...
Definition:TargetTransformInfo.cpp:676
llvm::TargetTransformInfo::getIntImmCostInst
InstructionCost getIntImmCostInst(unsigned Opc, unsigned Idx, const APInt &Imm, Type *Ty, TargetCostKind CostKind, Instruction *Inst=nullptr) const
Return the expected cost of materialization for the given integer immediate of the specified type for...
Definition:TargetTransformInfo.cpp:735
llvm::TargetTransformInfo::isLegalStridedLoadStore
bool isLegalStridedLoadStore(Type *DataType, Align Alignment) const
Return true if the target supports strided load.
Definition:TargetTransformInfo.cpp:526
llvm::TargetTransformInfo::operator=
TargetTransformInfo & operator=(TargetTransformInfo &&RHS)
Definition:TargetTransformInfo.cpp:210
llvm::TargetTransformInfo::getMinMaxReductionCost
InstructionCost getMinMaxReductionCost(Intrinsic::ID IID, VectorType *Ty, FastMathFlags FMF=FastMathFlags(), TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput) const
Definition:TargetTransformInfo.cpp:1224
llvm::TargetTransformInfo::TargetCostKind
TargetCostKind
The kind of cost model.
Definition:TargetTransformInfo.h:263
llvm::TargetTransformInfo::TCK_RecipThroughput
@ TCK_RecipThroughput
Reciprocal throughput.
Definition:TargetTransformInfo.h:264
llvm::TargetTransformInfo::TCK_CodeSize
@ TCK_CodeSize
Instruction code size.
Definition:TargetTransformInfo.h:266
llvm::TargetTransformInfo::TCK_SizeAndLatency
@ TCK_SizeAndLatency
The weighted sum of size and latency.
Definition:TargetTransformInfo.h:267
llvm::TargetTransformInfo::TCK_Latency
@ TCK_Latency
The latency of instruction.
Definition:TargetTransformInfo.h:265
llvm::TargetTransformInfo::getArithmeticInstrCost
InstructionCost getArithmeticInstrCost(unsigned Opcode, Type *Ty, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, TTI::OperandValueInfo Opd1Info={TTI::OK_AnyValue, TTI::OP_None}, TTI::OperandValueInfo Opd2Info={TTI::OK_AnyValue, TTI::OP_None}, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr, const TargetLibraryInfo *TLibInfo=nullptr) const
This is an approximation of reciprocal throughput of a math/logic op.
Definition:TargetTransformInfo.cpp:940
llvm::TargetTransformInfo::areTypesABICompatible
bool areTypesABICompatible(const Function *Caller, const Function *Callee, const ArrayRef< Type * > &Types) const
Definition:TargetTransformInfo.cpp:1296
llvm::TargetTransformInfo::enableSelectOptimize
bool enableSelectOptimize() const
Should the Select Optimization pass be enabled and ran.
Definition:TargetTransformInfo.cpp:663
llvm::TargetTransformInfo::collectFlatAddressOperands
bool collectFlatAddressOperands(SmallVectorImpl< int > &OpIndexes, Intrinsic::ID IID) const
Return any intrinsic address operand indexes which may be rewritten if they use a flat address space ...
Definition:TargetTransformInfo.cpp:319
llvm::TargetTransformInfo::OperandValueProperties
OperandValueProperties
Additional properties of an operand's values.
Definition:TargetTransformInfo.h:1126
llvm::TargetTransformInfo::OP_NegatedPowerOf2
@ OP_NegatedPowerOf2
Definition:TargetTransformInfo.h:1129
llvm::TargetTransformInfo::OP_None
@ OP_None
Definition:TargetTransformInfo.h:1127
llvm::TargetTransformInfo::OP_PowerOf2
@ OP_PowerOf2
Definition:TargetTransformInfo.h:1128
llvm::TargetTransformInfo::getInliningLastCallToStaticBonus
int getInliningLastCallToStaticBonus() const
Definition:TargetTransformInfo.cpp:230
llvm::TargetTransformInfo::getPointersChainCost
InstructionCost getPointersChainCost(ArrayRef< const Value * > Ptrs, const Value *Base, const PointersChainInfo &Info, Type *AccessTy, TargetCostKind CostKind=TTI::TCK_RecipThroughput) const
Estimate the cost of a chain of pointers (typically pointer operands of a chain of loads or stores wi...
Definition:TargetTransformInfo.cpp:254
llvm::TargetTransformInfo::isVScaleKnownToBeAPowerOfTwo
bool isVScaleKnownToBeAPowerOfTwo() const
Definition:TargetTransformInfo.cpp:793
llvm::TargetTransformInfo::isIndexedLoadLegal
bool isIndexedLoadLegal(enum MemIndexedMode Mode, Type *Ty) const
Definition:TargetTransformInfo.cpp:1302
llvm::TargetTransformInfo::getMaximumVF
unsigned getMaximumVF(unsigned ElemWidth, unsigned Opcode) const
Definition:TargetTransformInfo.cpp:807
llvm::TargetTransformInfo::isSourceOfDivergence
bool isSourceOfDivergence(const Value *V) const
Returns whether V is a source of divergence.
Definition:TargetTransformInfo.cpp:293
llvm::TargetTransformInfo::isLegalICmpImmediate
bool isLegalICmpImmediate(int64_t Imm) const
Return true if the specified immediate is legal icmp immediate, that is the target has icmp instructi...
Definition:TargetTransformInfo.cpp:418
llvm::TargetTransformInfo::isTypeLegal
bool isTypeLegal(Type *Ty) const
Return true if this type is legal.
Definition:TargetTransformInfo.cpp:583
llvm::TargetTransformInfo::requiresOrderedReduction
static bool requiresOrderedReduction(std::optional< FastMathFlags > FMF)
A helper function to determine the type of reduction algorithm used for a given Opcode and set of Fas...
Definition:TargetTransformInfo.h:1552
llvm::TargetTransformInfo::isLegalToVectorizeReduction
bool isLegalToVectorizeReduction(const RecurrenceDescriptor &RdxDesc, ElementCount VF) const
Definition:TargetTransformInfo.cpp:1336
llvm::TargetTransformInfo::getCacheAssociativity
std::optional< unsigned > getCacheAssociativity(CacheLevel Level) const
Definition:TargetTransformInfo.cpp:834
llvm::TargetTransformInfo::isLegalNTLoad
bool isLegalNTLoad(Type *DataType, Align Alignment) const
Return true if the target supports nontemporal load.
Definition:TargetTransformInfo.cpp:481
llvm::TargetTransformInfo::getMemcpyCost
InstructionCost getMemcpyCost(const Instruction *I) const
Definition:TargetTransformInfo.cpp:1205
llvm::TargetTransformInfo::adjustInliningThreshold
unsigned adjustInliningThreshold(const CallBase *CB) const
Definition:TargetTransformInfo.cpp:235
llvm::TargetTransformInfo::isLegalAddImmediate
bool isLegalAddImmediate(int64_t Imm) const
Return true if the specified immediate is legal add immediate, that is the target has add instruction...
Definition:TargetTransformInfo.cpp:410
llvm::TargetTransformInfo::isTargetIntrinsicWithStructReturnOverloadAtField
bool isTargetIntrinsicWithStructReturnOverloadAtField(Intrinsic::ID ID, int RetIdx) const
Identifies if the vector form of the intrinsic that returns a struct is overloaded at the struct elem...
Definition:TargetTransformInfo.cpp:623
llvm::TargetTransformInfo::getVPMemoryOpCost
InstructionCost getVPMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, const Instruction *I=nullptr) const
llvm::TargetTransformInfo::getLoadVectorFactor
unsigned getLoadVectorFactor(unsigned VF, unsigned LoadSize, unsigned ChainSizeInBytes, VectorType *VecTy) const
Definition:TargetTransformInfo.cpp:1345
llvm::TargetTransformInfo::getMaskedMemoryOpCost
InstructionCost getMaskedMemoryOpCost(unsigned Opcode, Type *Src, Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput) const
Definition:TargetTransformInfo.cpp:1137
llvm::TargetTransformInfo::canSaveCmp
bool canSaveCmp(Loop *L, BranchInst **BI, ScalarEvolution *SE, LoopInfo *LI, DominatorTree *DT, AssumptionCache *AC, TargetLibraryInfo *LibInfo) const
Return true if the target can save a compare for loop count, for example hardware loop saves a compar...
Definition:TargetTransformInfo.cpp:453
llvm::TargetTransformInfo::isTargetIntrinsicTriviallyScalarizable
bool isTargetIntrinsicTriviallyScalarizable(Intrinsic::ID ID) const
Definition:TargetTransformInfo.cpp:608
llvm::TargetTransformInfo::rewriteIntrinsicWithAddressSpace
Value * rewriteIntrinsicWithAddressSpace(IntrinsicInst *II, Value *OldV, Value *NewV) const
Rewrite intrinsic call II such that OldV will be replaced with NewV, which has a different address sp...
Definition:TargetTransformInfo.cpp:347
llvm::TargetTransformInfo::getCostOfKeepingLiveOverCall
InstructionCost getCostOfKeepingLiveOverCall(ArrayRef< Type * > Tys) const
Definition:TargetTransformInfo.cpp:1247
llvm::TargetTransformInfo::RegisterKind
RegisterKind
Definition:TargetTransformInfo.h:1180
llvm::TargetTransformInfo::RGK_FixedWidthVector
@ RGK_FixedWidthVector
Definition:TargetTransformInfo.h:1180
llvm::TargetTransformInfo::RGK_ScalableVector
@ RGK_ScalableVector
Definition:TargetTransformInfo.h:1180
llvm::TargetTransformInfo::RGK_Scalar
@ RGK_Scalar
Definition:TargetTransformInfo.h:1180
llvm::TargetTransformInfo::getMinPrefetchStride
unsigned getMinPrefetchStride(unsigned NumMemAccesses, unsigned NumStridedMemAccesses, unsigned NumPrefetches, bool HasCall) const
Some HW prefetchers can handle accesses up to a certain constant stride.
Definition:TargetTransformInfo.cpp:847
llvm::TargetTransformInfo::preferPredicatedReductionSelect
bool preferPredicatedReductionSelect(unsigned Opcode, Type *Ty, ReductionFlags Flags) const
Definition:TargetTransformInfo.cpp:1368
llvm::TargetTransformInfo::getShuffleCost
InstructionCost getShuffleCost(ShuffleKind Kind, VectorType *Tp, ArrayRef< int > Mask={}, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, int Index=0, VectorType *SubTp=nullptr, ArrayRef< const Value * > Args={}, const Instruction *CxtI=nullptr) const
Definition:TargetTransformInfo.cpp:976
llvm::TargetTransformInfo::shouldPrefetchAddressSpace
bool shouldPrefetchAddressSpace(unsigned AS) const
Definition:TargetTransformInfo.cpp:862
llvm::TargetTransformInfo::getIntImmCost
InstructionCost getIntImmCost(const APInt &Imm, Type *Ty, TargetCostKind CostKind) const
Return the expected cost of materializing for the given integer immediate of the specified type.
Definition:TargetTransformInfo.cpp:728
llvm::TargetTransformInfo::getMinVectorRegisterBitWidth
unsigned getMinVectorRegisterBitWidth() const
Definition:TargetTransformInfo.cpp:781
llvm::TargetTransformInfo::isLegalNTStore
bool isLegalNTStore(Type *DataType, Align Alignment) const
Return true if the target supports nontemporal store.
Definition:TargetTransformInfo.cpp:476
llvm::TargetTransformInfo::getFlatAddressSpace
unsigned getFlatAddressSpace() const
Returns the address space ID for a target's 'flat' address space.
Definition:TargetTransformInfo.cpp:315
llvm::TargetTransformInfo::preferToKeepConstantsAttached
bool preferToKeepConstantsAttached(const Instruction &Inst, const Function &Fn) const
It can be advantageous to detach complex constants from their uses to make their generation cheaper.
Definition:TargetTransformInfo.cpp:754
llvm::TargetTransformInfo::hasArmWideBranch
bool hasArmWideBranch(bool Thumb) const
Definition:TargetTransformInfo.cpp:1382
llvm::TargetTransformInfo::getRegisterClassName
const char * getRegisterClassName(unsigned ClassID) const
Definition:TargetTransformInfo.cpp:772
llvm::TargetTransformInfo::preferEpilogueVectorization
bool preferEpilogueVectorization() const
Return true if the loop vectorizer should consider vectorizing an otherwise scalar epilogue loop.
Definition:TargetTransformInfo.cpp:1373
llvm::TargetTransformInfo::shouldConsiderAddressTypePromotion
bool shouldConsiderAddressTypePromotion(const Instruction &I, bool &AllowPromotionWithoutCommonHeader) const
Definition:TargetTransformInfo.cpp:817
llvm::TargetTransformInfo::useAA
bool useAA() const
Definition:TargetTransformInfo.cpp:581
llvm::TargetTransformInfo::getPredictableBranchThreshold
BranchProbability getPredictableBranchThreshold() const
If a branch or a select condition is skewed in one direction by more than this factor,...
Definition:TargetTransformInfo.cpp:279
llvm::TargetTransformInfo::getCallerAllocaCost
unsigned getCallerAllocaCost(const CallBase *CB, const AllocaInst *AI) const
Definition:TargetTransformInfo.cpp:239
llvm::TargetTransformInfo::getCacheLineSize
unsigned getCacheLineSize() const
Definition:TargetTransformInfo.cpp:823
llvm::TargetTransformInfo::allowsMisalignedMemoryAccesses
bool allowsMisalignedMemoryAccesses(LLVMContext &Context, unsigned BitWidth, unsigned AddressSpace=0, Align Alignment=Align(1), unsigned *Fast=nullptr) const
Determine if the target supports unaligned memory accesses.
Definition:TargetTransformInfo.cpp:685
llvm::TargetTransformInfo::getGatherScatterOpCost
InstructionCost getGatherScatterOpCost(unsigned Opcode, Type *DataTy, const Value *Ptr, bool VariableMask, Align Alignment, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput, const Instruction *I=nullptr) const
Definition:TargetTransformInfo.cpp:1146
llvm::TargetTransformInfo::getInlinerVectorBonusPercent
int getInlinerVectorBonusPercent() const
Definition:TargetTransformInfo.cpp:244
llvm::TargetTransformInfo::hasActiveVectorLength
bool hasActiveVectorLength(unsigned Opcode, Type *DataType, Align Alignment) const
Definition:TargetTransformInfo.cpp:1424
llvm::TargetTransformInfo::getEpilogueVectorizationMinVF
unsigned getEpilogueVectorizationMinVF() const
Definition:TargetTransformInfo.cpp:362
llvm::TargetTransformInfo::PopcntSupportKind
PopcntSupportKind
Flags indicating the kind of support for population count.
Definition:TargetTransformInfo.h:719
llvm::TargetTransformInfo::PSK_SlowHardware
@ PSK_SlowHardware
Definition:TargetTransformInfo.h:719
llvm::TargetTransformInfo::PSK_Software
@ PSK_Software
Definition:TargetTransformInfo.h:719
llvm::TargetTransformInfo::PSK_FastHardware
@ PSK_FastHardware
Definition:TargetTransformInfo.h:719
llvm::TargetTransformInfo::getIntImmCodeSizeCost
InstructionCost getIntImmCodeSizeCost(unsigned Opc, unsigned Idx, const APInt &Imm, Type *Ty) const
Return the expected cost for the given integer when optimising for size.
Definition:TargetTransformInfo.cpp:718
llvm::TargetTransformInfo::getPreferredAddressingMode
AddressingModeKind getPreferredAddressingMode(const Loop *L, ScalarEvolution *SE) const
Return the preferred addressing mode LSR should make efforts to generate.
Definition:TargetTransformInfo.cpp:461
llvm::TargetTransformInfo::isLoweredToCall
bool isLoweredToCall(const Function *F) const
Test whether calls to a function lower to actual program function calls.
Definition:TargetTransformInfo.cpp:352
llvm::TargetTransformInfo::isLegalToVectorizeLoadChain
bool isLegalToVectorizeLoadChain(unsigned ChainSizeInBytes, Align Alignment, unsigned AddrSpace) const
Definition:TargetTransformInfo.cpp:1324
llvm::TargetTransformInfo::isHardwareLoopProfitable
bool isHardwareLoopProfitable(Loop *L, ScalarEvolution &SE, AssumptionCache &AC, TargetLibraryInfo *LibInfo, HardwareLoopInfo &HWLoopInfo) const
Query the target whether it would be profitable to convert the given loop into a hardware loop.
Definition:TargetTransformInfo.cpp:356
llvm::TargetTransformInfo::getInliningThresholdMultiplier
unsigned getInliningThresholdMultiplier() const
Definition:TargetTransformInfo.cpp:215
llvm::TargetTransformInfo::getBranchMispredictPenalty
InstructionCost getBranchMispredictPenalty() const
Returns estimated penalty of a branch misprediction in latency.
Definition:TargetTransformInfo.cpp:285
llvm::TargetTransformInfo::getNumberOfRegisters
unsigned getNumberOfRegisters(unsigned ClassID) const
Definition:TargetTransformInfo.cpp:759
llvm::TargetTransformInfo::isLegalAltInstr
bool isLegalAltInstr(VectorType *VecTy, unsigned Opcode0, unsigned Opcode1, const SmallBitVector &OpcodeMask) const
Return true if this is an alternating opcode pattern that can be lowered to a single instruction on t...
Definition:TargetTransformInfo.cpp:495
llvm::TargetTransformInfo::isProfitableToHoist
bool isProfitableToHoist(Instruction *I) const
Return true if it is profitable to hoist instruction in the then/else to before if.
Definition:TargetTransformInfo.cpp:577
llvm::TargetTransformInfo::supportsScalableVectors
bool supportsScalableVectors() const
Definition:TargetTransformInfo.cpp:1416
llvm::TargetTransformInfo::hasVolatileVariant
bool hasVolatileVariant(Instruction *I, unsigned AddrSpace) const
Return true if the given instruction (assumed to be a memory access instruction) has a volatile varia...
Definition:TargetTransformInfo.cpp:551
llvm::TargetTransformInfo::isLegalMaskedCompressStore
bool isLegalMaskedCompressStore(Type *DataType, Align Alignment) const
Return true if the target supports masked compress store.
Definition:TargetTransformInfo.cpp:516
llvm::TargetTransformInfo::getMinPageSize
std::optional< unsigned > getMinPageSize() const
Definition:TargetTransformInfo.cpp:838
llvm::TargetTransformInfo::isFPVectorizationPotentiallyUnsafe
bool isFPVectorizationPotentiallyUnsafe() const
Indicate that it is potentially unsafe to automatically vectorize floating-point operations because t...
Definition:TargetTransformInfo.cpp:680
llvm::TargetTransformInfo::isLegalMaskedStore
bool isLegalMaskedStore(Type *DataType, Align Alignment) const
Return true if the target supports masked store.
Definition:TargetTransformInfo.cpp:466
llvm::TargetTransformInfo::shouldBuildRelLookupTables
bool shouldBuildRelLookupTables() const
Return true if lookup tables should be turned into relative lookup tables.
Definition:TargetTransformInfo.cpp:600
llvm::TargetTransformInfo::PartialReductionExtendKind
PartialReductionExtendKind
Definition:TargetTransformInfo.h:214
llvm::TargetTransformInfo::PR_SignExtend
@ PR_SignExtend
Definition:TargetTransformInfo.h:214
llvm::TargetTransformInfo::PR_ZeroExtend
@ PR_ZeroExtend
Definition:TargetTransformInfo.h:214
llvm::TargetTransformInfo::PR_None
@ PR_None
Definition:TargetTransformInfo.h:214
llvm::TargetTransformInfo::getStoreMinimumVF
unsigned getStoreMinimumVF(unsigned VF, Type *ScalarMemTy, Type *ScalarValTy) const
Definition:TargetTransformInfo.cpp:812
llvm::TargetTransformInfo::getCacheSize
std::optional< unsigned > getCacheSize(CacheLevel Level) const
Definition:TargetTransformInfo.cpp:829
llvm::TargetTransformInfo::simplifyDemandedUseBitsIntrinsic
std::optional< Value * > simplifyDemandedUseBitsIntrinsic(InstCombiner &IC, IntrinsicInst &II, APInt DemandedMask, KnownBits &Known, bool &KnownBitsComputed) const
Can be used to implement target-specific instruction combining.
Definition:TargetTransformInfo.cpp:382
llvm::TargetTransformInfo::isLegalAddScalableImmediate
bool isLegalAddScalableImmediate(int64_t Imm) const
Return true if adding the specified scalable immediate is legal, that is the target has add instructi...
Definition:TargetTransformInfo.cpp:414
llvm::TargetTransformInfo::isTargetIntrinsicWithScalarOpAtArg
bool isTargetIntrinsicWithScalarOpAtArg(Intrinsic::ID ID, unsigned ScalarOpdIdx) const
Identifies if the vector form of the intrinsic has a scalar operand.
Definition:TargetTransformInfo.cpp:613
llvm::TargetTransformInfo::hasDivRemOp
bool hasDivRemOp(Type *DataType, bool IsSigned) const
Return true if the target has a unified operation to calculate division and remainder.
Definition:TargetTransformInfo.cpp:547
llvm::TargetTransformInfo::getAltInstrCost
InstructionCost getAltInstrCost(VectorType *VecTy, unsigned Opcode0, unsigned Opcode1, const SmallBitVector &OpcodeMask, TTI::TargetCostKind CostKind=TTI::TCK_RecipThroughput) const
Returns the cost estimation for alternating opcode pattern that can be lowered to a single instructio...
Definition:TargetTransformInfo.cpp:967
llvm::TargetTransformInfo::TargetCostConstants
TargetCostConstants
Underlying constants for 'cost' values in this interface.
Definition:TargetTransformInfo.h:288
llvm::TargetTransformInfo::TCC_Expensive
@ TCC_Expensive
The cost of a 'div' instruction on x86.
Definition:TargetTransformInfo.h:291
llvm::TargetTransformInfo::TCC_Free
@ TCC_Free
Expected to fold away in lowering.
Definition:TargetTransformInfo.h:289
llvm::TargetTransformInfo::TCC_Basic
@ TCC_Basic
The cost of a typical 'add' instruction.
Definition:TargetTransformInfo.h:290
llvm::TargetTransformInfo::getScalarizationOverhead
InstructionCost getScalarizationOverhead(VectorType *Ty, const APInt &DemandedElts, bool Insert, bool Extract, TTI::TargetCostKind CostKind, ArrayRef< Value * > VL={}) const
Estimate the overhead of scalarizing an instruction.
Definition:TargetTransformInfo.cpp:628
llvm::TargetTransformInfo::enableInterleavedAccessVectorization
bool enableInterleavedAccessVectorization() const
Enable matching of interleaved access groups.
Definition:TargetTransformInfo.cpp:672
llvm::TargetTransformInfo::getMinTripCountTailFoldingThreshold
unsigned getMinTripCountTailFoldingThreshold() const
Definition:TargetTransformInfo.cpp:1412
llvm::TargetTransformInfo::getInstructionCost
InstructionCost getInstructionCost(const User *U, ArrayRef< const Value * > Operands, TargetCostKind CostKind) const
Estimate the cost of a given IR user when lowered.
Definition:TargetTransformInfo.cpp:270
llvm::TargetTransformInfo::getMaxInterleaveFactor
unsigned getMaxInterleaveFactor(ElementCount VF) const
Definition:TargetTransformInfo.cpp:875
llvm::TargetTransformInfo::enableScalableVectorization
bool enableScalableVectorization() const
Definition:TargetTransformInfo.cpp:1420
llvm::TargetTransformInfo::isVectorShiftByScalarCheap
bool isVectorShiftByScalarCheap(Type *Ty) const
Return true if it's significantly cheaper to shift a vector by a uniform scalar than by an amount whi...
Definition:TargetTransformInfo.cpp:1434
llvm::TargetTransformInfo::isNumRegsMajorCostOfLSR
bool isNumRegsMajorCostOfLSR() const
Return true if LSR major cost is number of registers.
Definition:TargetTransformInfo.cpp:437
llvm::TargetTransformInfo::getInliningCostBenefitAnalysisSavingsMultiplier
unsigned getInliningCostBenefitAnalysisSavingsMultiplier() const
Definition:TargetTransformInfo.cpp:220
llvm::TargetTransformInfo::isLegalMaskedVectorHistogram
bool isLegalMaskedVectorHistogram(Type *AddrType, Type *DataType) const
Definition:TargetTransformInfo.cpp:538
llvm::TargetTransformInfo::getExtractWithExtendCost
InstructionCost getExtractWithExtendCost(unsigned Opcode, Type *Dst, VectorType *VecTy, unsigned Index) const
Definition:TargetTransformInfo.cpp:1050
llvm::TargetTransformInfo::getGISelRematGlobalCost
unsigned getGISelRematGlobalCost() const
Definition:TargetTransformInfo.cpp:1408
llvm::TargetTransformInfo::getNumBytesToPadGlobalArray
unsigned getNumBytesToPadGlobalArray(unsigned Size, Type *ArrayType) const
Definition:TargetTransformInfo.cpp:1439
llvm::TargetTransformInfo::MemIndexedMode
MemIndexedMode
The type of load/store indexing.
Definition:TargetTransformInfo.h:1696
llvm::TargetTransformInfo::MIM_Unindexed
@ MIM_Unindexed
No indexing.
Definition:TargetTransformInfo.h:1697
llvm::TargetTransformInfo::MIM_PostInc
@ MIM_PostInc
Post-incrementing.
Definition:TargetTransformInfo.h:1700
llvm::TargetTransformInfo::MIM_PostDec
@ MIM_PostDec
Post-decrementing.
Definition:TargetTransformInfo.h:1701
llvm::TargetTransformInfo::MIM_PreDec
@ MIM_PreDec
Pre-decrementing.
Definition:TargetTransformInfo.h:1699
llvm::TargetTransformInfo::MIM_PreInc
@ MIM_PreInc
Pre-incrementing.
Definition:TargetTransformInfo.h:1698
llvm::TargetTransformInfo::areInlineCompatible
bool areInlineCompatible(const Function *Caller, const Function *Callee) const
Definition:TargetTransformInfo.cpp:1284
llvm::TargetTransformInfo::useColdCCForColdCall
bool useColdCCForColdCall(Function &F) const
Return true if the input function which is cold at all call sites, should use coldcc calling conventi...
Definition:TargetTransformInfo.cpp:604
llvm::TargetTransformInfo::getFPOpCost
InstructionCost getFPOpCost(Type *Ty) const
Return the expected cost of supporting the floating point operation of the specified type.
Definition:TargetTransformInfo.cpp:712
llvm::TargetTransformInfo::supportsTailCalls
bool supportsTailCalls() const
If the target supports tail calls.
Definition:TargetTransformInfo.cpp:645
llvm::TargetTransformInfo::canMacroFuseCmp
bool canMacroFuseCmp() const
Return true if the target can fuse a compare and branch.
Definition:TargetTransformInfo.cpp:449
llvm::TargetTransformInfo::getOrCreateResultFromMemIntrinsic
Value * getOrCreateResultFromMemIntrinsic(IntrinsicInst *Inst, Type *ExpectedType) const
Definition:TargetTransformInfo.cpp:1260
llvm::TargetTransformInfo::isValidAddrSpaceCast
bool isValidAddrSpaceCast(unsigned FromAS, unsigned ToAS) const
Query the target whether the specified address space cast from FromAS to ToAS is valid.
Definition:TargetTransformInfo.cpp:305
llvm::TargetTransformInfo::getNumberOfParts
unsigned getNumberOfParts(Type *Tp) const
Definition:TargetTransformInfo.cpp:1193
llvm::TargetTransformInfo::AddressingModeKind
AddressingModeKind
Definition:TargetTransformInfo.h:780
llvm::TargetTransformInfo::AMK_PostIndexed
@ AMK_PostIndexed
Definition:TargetTransformInfo.h:782
llvm::TargetTransformInfo::AMK_PreIndexed
@ AMK_PreIndexed
Definition:TargetTransformInfo.h:781
llvm::TargetTransformInfo::AMK_None
@ AMK_None
Definition:TargetTransformInfo.h:783
llvm::TargetTransformInfo::hasConditionalLoadStoreForType
bool hasConditionalLoadStoreForType(Type *Ty=nullptr) const
Definition:TargetTransformInfo.cpp:763
llvm::TargetTransformInfo::getPartialReductionCost
InstructionCost getPartialReductionCost(unsigned Opcode, Type *InputTypeA, Type *InputTypeB, Type *AccumType, ElementCount VF, PartialReductionExtendKind OpAExtend, PartialReductionExtendKind OpBExtend, std::optional< unsigned > BinOp=std::nullopt) const
Definition:TargetTransformInfo.cpp:866
llvm::TargetTransformInfo::getScalingFactorCost
InstructionCost getScalingFactorCost(Type *Ty, GlobalValue *BaseGV, StackOffset BaseOffset, bool HasBaseReg, int64_t Scale, unsigned AddrSpace=0) const
Return the cost of the scaling factor used in the addressing mode represented by AM for this target,...
Definition:TargetTransformInfo.cpp:560
llvm::TargetTransformInfo::isTruncateFree
bool isTruncateFree(Type *Ty1, Type *Ty2) const
Return true if it's free to truncate a value of type Ty1 to type Ty2.
Definition:TargetTransformInfo.cpp:573
llvm::TargetTransformInfo::isProfitableToSinkOperands
bool isProfitableToSinkOperands(Instruction *I, SmallVectorImpl< Use * > &Ops) const
Return true if sinking I's operands to the same basic block as I is profitable, e....
Definition:TargetTransformInfo.cpp:1429
llvm::TargetTransformInfo::getMemcpyLoopResidualLoweringType
void getMemcpyLoopResidualLoweringType(SmallVectorImpl< Type * > &OpsOut, LLVMContext &Context, unsigned RemainingBytes, unsigned SrcAddrSpace, unsigned DestAddrSpace, Align SrcAlign, Align DestAlign, std::optional< uint32_t > AtomicCpySize=std::nullopt) const
Definition:TargetTransformInfo.cpp:1274
llvm::TargetTransformInfo::preferPredicateOverEpilogue
bool preferPredicateOverEpilogue(TailFoldingInfo *TFI) const
Query the target whether it would be prefered to create a predicated vector loop, which can avoid the...
Definition:TargetTransformInfo.cpp:366
llvm::TargetTransformInfo::forceScalarizeMaskedScatter
bool forceScalarizeMaskedScatter(VectorType *Type, Align Alignment) const
Return true if the target forces scalarizing of llvm.masked.scatter intrinsics.
Definition:TargetTransformInfo.cpp:511
llvm::TargetTransformInfo::isTargetIntrinsicWithOverloadTypeAtArg
bool isTargetIntrinsicWithOverloadTypeAtArg(Intrinsic::ID ID, int OpdIdx) const
Identifies if the vector form of the intrinsic is overloaded on the type of the operand at index OpdI...
Definition:TargetTransformInfo.cpp:618
llvm::TargetTransformInfo::haveFastSqrt
bool haveFastSqrt(Type *Ty) const
Return true if the hardware has a fast square-root instruction.
Definition:TargetTransformInfo.cpp:699
llvm::TargetTransformInfo::shouldExpandReduction
bool shouldExpandReduction(const IntrinsicInst *II) const
Definition:TargetTransformInfo.cpp:1398
llvm::TargetTransformInfo::TargetTransformInfo
TargetTransformInfo(T Impl)
Construct a TTI object using a type implementing the Concept API below.
Definition:TargetTransformInfo.h:3180
llvm::TargetTransformInfo::getMaxMemIntrinsicInlineSizeThreshold
uint64_t getMaxMemIntrinsicInlineSizeThreshold() const
Returns the maximum memset / memcpy size in bytes that still makes it profitable to inline the call.
Definition:TargetTransformInfo.cpp:1211
llvm::TargetTransformInfo::getVectorInstrCost
InstructionCost getVectorInstrCost(unsigned Opcode, Type *Val, TTI::TargetCostKind CostKind, unsigned Index=-1, Value *Op0=nullptr, Value *Op1=nullptr) const
Definition:TargetTransformInfo.cpp:1079
llvm::TargetTransformInfo::ShuffleKind
ShuffleKind
The various kinds of shuffle patterns for vector queries.
Definition:TargetTransformInfo.h:1098
llvm::TargetTransformInfo::SK_InsertSubvector
@ SK_InsertSubvector
InsertSubvector. Index indicates start offset.
Definition:TargetTransformInfo.h:1105
llvm::TargetTransformInfo::SK_Select
@ SK_Select
Selects elements from the corresponding lane of either source operand.
Definition:TargetTransformInfo.h:1101
llvm::TargetTransformInfo::SK_PermuteSingleSrc
@ SK_PermuteSingleSrc
Shuffle elements of single source vector with any shuffle mask.
Definition:TargetTransformInfo.h:1109
llvm::TargetTransformInfo::SK_Transpose
@ SK_Transpose
Transpose two vectors.
Definition:TargetTransformInfo.h:1104
llvm::TargetTransformInfo::SK_Splice
@ SK_Splice
Concatenates elements from the first input vector with elements of the second input vector.
Definition:TargetTransformInfo.h:1111
llvm::TargetTransformInfo::SK_Broadcast
@ SK_Broadcast
Broadcast element 0 to all other elements.
Definition:TargetTransformInfo.h:1099
llvm::TargetTransformInfo::SK_PermuteTwoSrc
@ SK_PermuteTwoSrc
Merge elements from two source vectors into one with any shuffle mask.
Definition:TargetTransformInfo.h:1107
llvm::TargetTransformInfo::SK_Reverse
@ SK_Reverse
Reverse the order of the vector.
Definition:TargetTransformInfo.h:1100
llvm::TargetTransformInfo::SK_ExtractSubvector
@ SK_ExtractSubvector
ExtractSubvector Index indicates start offset.
Definition:TargetTransformInfo.h:1106
llvm::TargetTransformInfo::getPeelingPreferences
void getPeelingPreferences(Loop *L, ScalarEvolution &SE, PeelingPreferences &PP) const
Get target-customized preferences for the generic loop peeling transformation.
Definition:TargetTransformInfo.cpp:405
llvm::TargetTransformInfo::getCallInstrCost
InstructionCost getCallInstrCost(Function *F, Type *RetTy, ArrayRef< Type * > Tys, TTI::TargetCostKind CostKind=TTI::TCK_SizeAndLatency) const
Definition:TargetTransformInfo.cpp:1185
llvm::TargetTransformInfo::getCFInstrCost
InstructionCost getCFInstrCost(unsigned Opcode, TTI::TargetCostKind CostKind=TTI::TCK_SizeAndLatency, const Instruction *I=nullptr) const
Definition:TargetTransformInfo.cpp:1058
llvm::TargetTransformInfo::CastContextHint
CastContextHint
Represents a hint about the context in which a cast is used.
Definition:TargetTransformInfo.h:1389
llvm::TargetTransformInfo::CastContextHint::Reversed
@ Reversed
The cast is used with a reversed load/store.
llvm::TargetTransformInfo::CastContextHint::Masked
@ Masked
The cast is used with a masked load/store.
llvm::TargetTransformInfo::CastContextHint::None
@ None
The cast is not used with a load/store of any kind.
llvm::TargetTransformInfo::CastContextHint::Normal
@ Normal
The cast is used with a normal load/store.
llvm::TargetTransformInfo::CastContextHint::Interleave
@ Interleave
The cast is used with an interleaved load/store.
llvm::TargetTransformInfo::CastContextHint::GatherScatter
@ GatherScatter
The cast is used with a gather/scatter.
llvm::TargetTransformInfo::~TargetTransformInfo
~TargetTransformInfo()
llvm::TargetTransformInfo::OperandValueKind
OperandValueKind
Additional information about an operand's possible values.
Definition:TargetTransformInfo.h:1118
llvm::TargetTransformInfo::OK_UniformConstantValue
@ OK_UniformConstantValue
Definition:TargetTransformInfo.h:1121
llvm::TargetTransformInfo::OK_UniformValue
@ OK_UniformValue
Definition:TargetTransformInfo.h:1120
llvm::TargetTransformInfo::OK_AnyValue
@ OK_AnyValue
Definition:TargetTransformInfo.h:1119
llvm::TargetTransformInfo::OK_NonUniformConstantValue
@ OK_NonUniformConstantValue
Definition:TargetTransformInfo.h:1122
llvm::TargetTransformInfo::CacheLevel
CacheLevel
The possible cache levels.
Definition:TargetTransformInfo.h:1239
llvm::TargetTransformInfo::CacheLevel::L1D
@ L1D
llvm::TargetTransformInfo::CacheLevel::L2D
@ L2D
llvm::TargetTransformInfo::preferFixedOverScalableIfEqualCost
bool preferFixedOverScalableIfEqualCost() const
Definition:TargetTransformInfo.cpp:1359
llvm::TargetTransformInfo::isLegalMaskedLoad
bool isLegalMaskedLoad(Type *DataType, Align Alignment) const
Return true if the target supports masked load.
Definition:TargetTransformInfo.cpp:471
llvm::TypeSize
Definition:TypeSize.h:334
llvm::Type
The instances of the Type class are immutable: once they are created, they are never changed.
Definition:Type.h:45
llvm::User
Definition:User.h:44
llvm::VPIntrinsic
This is the common base class for vector predication intrinsics.
Definition:IntrinsicInst.h:566
llvm::Value
LLVM Value Representation.
Definition:Value.h:74
llvm::VectorType
Base class of all SIMD vector types.
Definition:DerivedTypes.h:427
uint64_t
uint8_t
unsigned
llvm::AMDGPU::HSAMD::Kernel::Key::Args
constexpr char Args[]
Key for Kernel::Metadata::mArgs.
Definition:AMDGPUMetadata.h:395
llvm::AttributeFuncs::areInlineCompatible
bool areInlineCompatible(const Function &Caller, const Function &Callee)
Definition:Attributes.cpp:2645
llvm::CallingConv::Fast
@ Fast
Attempts to make calls as fast as possible (e.g.
Definition:CallingConv.h:41
llvm::CallingConv::C
@ C
The default llvm calling convention, compatible with C.
Definition:CallingConv.h:34
llvm::CallingConv::ID
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition:CallingConv.h:24
llvm::Intrinsic::ID
unsigned ID
Definition:GenericSSAContext.h:28
llvm::NVPTXAS::AddressSpace
AddressSpace
Definition:NVPTXAddrSpace.h:20
llvm::TargetStackID::Value
Value
Definition:TargetFrameLowering.h:29
llvm::codeview::ClassOptions::Intrinsic
@ Intrinsic
llvm::codeview::PublicSymFlags::Function
@ Function
llvm::msgpack::Type
Type
MessagePack types as defined in the standard, with the exception of Integer being divided into a sign...
Definition:MsgPackReader.h:53
llvm::sampleprof::Base
@ Base
Definition:Discriminator.h:58
llvm
This is an optimization pass for GlobalISel generic memory operations.
Definition:AddressRanges.h:18
llvm::Length
@ Length
Definition:DWP.cpp:480
llvm::None
@ None
Definition:CodeGenData.h:106
llvm::AtomicOrdering
AtomicOrdering
Atomic ordering for LLVM's memory model.
Definition:AtomicOrdering.h:56
llvm::AtomicOrdering::Unordered
@ Unordered
llvm::AtomicOrdering::NotAtomic
@ NotAtomic
llvm::TTI
TargetTransformInfo TTI
Definition:TargetTransformInfo.h:208
llvm::createTargetTransformInfoWrapperPass
ImmutablePass * createTargetTransformInfoWrapperPass(TargetIRAnalysis TIRA)
Create an analysis pass wrapper around a TTI object.
Definition:TargetTransformInfo.cpp:1490
llvm::BitWidth
constexpr unsigned BitWidth
Definition:BitmaskEnum.h:217
llvm::move
OutputIt move(R &&Range, OutputIt Out)
Provide wrappers to std::move which take ranges instead of having to pass begin/end explicitly.
Definition:STLExtras.h:1873
llvm::TailFoldingStyle
TailFoldingStyle
Definition:TargetTransformInfo.h:165
llvm::TailFoldingStyle::DataAndControlFlowWithoutRuntimeCheck
@ DataAndControlFlowWithoutRuntimeCheck
Use predicate to control both data and control flow, but modify the trip count so that a runtime over...
llvm::TailFoldingStyle::DataWithEVL
@ DataWithEVL
Use predicated EVL instructions for tail-folding.
llvm::TailFoldingStyle::DataAndControlFlow
@ DataAndControlFlow
Use predicate to control both data and control flow.
llvm::TailFoldingStyle::DataWithoutLaneMask
@ DataWithoutLaneMask
Same as Data, but avoids using the get.active.lane.mask intrinsic to calculate the mask and instead i...
llvm::VFParamKind::Vector
@ Vector
llvm::Data
@ Data
Definition:SIMachineScheduler.h:55
std
Implement std::hash so that hash_code can be used in STL containers.
Definition:BitVector.h:858
llvm::Align
This struct is a compact representation of a valid (non-zero power of two) alignment.
Definition:Alignment.h:39
llvm::AnalysisInfoMixin
A CRTP mix-in that provides informational APIs needed for analysis passes.
Definition:PassManager.h:92
llvm::AnalysisKey
A special type used by analysis passes to provide an address that identifies that particular analysis...
Definition:Analysis.h:28
llvm::HardwareLoopInfo
Attributes of a target dependent hardware loop.
Definition:TargetTransformInfo.h:96
llvm::HardwareLoopInfo::L
Loop * L
Definition:TargetTransformInfo.h:99
llvm::HardwareLoopInfo::ExitBranch
BranchInst * ExitBranch
Definition:TargetTransformInfo.h:101
llvm::HardwareLoopInfo::ExitBlock
BasicBlock * ExitBlock
Definition:TargetTransformInfo.h:100
llvm::HardwareLoopInfo::LoopDecrement
Value * LoopDecrement
Definition:TargetTransformInfo.h:104
llvm::HardwareLoopInfo::canAnalyze
bool canAnalyze(LoopInfo &LI)
Definition:TargetTransformInfo.cpp:60
llvm::HardwareLoopInfo::CounterInReg
bool CounterInReg
Definition:TargetTransformInfo.h:108
llvm::HardwareLoopInfo::ExitCount
const SCEV * ExitCount
Definition:TargetTransformInfo.h:102
llvm::HardwareLoopInfo::CountType
IntegerType * CountType
Definition:TargetTransformInfo.h:103
llvm::HardwareLoopInfo::IsNestingLegal
bool IsNestingLegal
Definition:TargetTransformInfo.h:106
llvm::HardwareLoopInfo::HardwareLoopInfo
HardwareLoopInfo()=delete
llvm::HardwareLoopInfo::PerformEntryTest
bool PerformEntryTest
Definition:TargetTransformInfo.h:110
llvm::HardwareLoopInfo::isHardwareLoopCandidate
bool isHardwareLoopCandidate(ScalarEvolution &SE, LoopInfo &LI, DominatorTree &DT, bool ForceNestedLoop=false, bool ForceHardwareLoopPHI=false)
Definition:TargetTransformInfo.cpp:123
llvm::KnownBits
Definition:KnownBits.h:23
llvm::MemIntrinsicInfo
Information about a load/store intrinsic defined by the target.
Definition:TargetTransformInfo.h:71
llvm::MemIntrinsicInfo::MatchingId
unsigned short MatchingId
Definition:TargetTransformInfo.h:82
llvm::MemIntrinsicInfo::ReadMem
bool ReadMem
Definition:TargetTransformInfo.h:84
llvm::MemIntrinsicInfo::IsVolatile
bool IsVolatile
Definition:TargetTransformInfo.h:86
llvm::MemIntrinsicInfo::WriteMem
bool WriteMem
Definition:TargetTransformInfo.h:85
llvm::MemIntrinsicInfo::PtrVal
Value * PtrVal
This is the pointer that the intrinsic is loading from or storing to.
Definition:TargetTransformInfo.h:76
llvm::MemIntrinsicInfo::Ordering
AtomicOrdering Ordering
Definition:TargetTransformInfo.h:79
llvm::MemIntrinsicInfo::isUnordered
bool isUnordered() const
Definition:TargetTransformInfo.h:88
llvm::TailFoldingInfo
Definition:TargetTransformInfo.h:198
llvm::TailFoldingInfo::IAI
InterleavedAccessInfo * IAI
Definition:TargetTransformInfo.h:201
llvm::TailFoldingInfo::TailFoldingInfo
TailFoldingInfo(TargetLibraryInfo *TLI, LoopVectorizationLegality *LVL, InterleavedAccessInfo *IAI)
Definition:TargetTransformInfo.h:202
llvm::TailFoldingInfo::TLI
TargetLibraryInfo * TLI
Definition:TargetTransformInfo.h:199
llvm::TailFoldingInfo::LVL
LoopVectorizationLegality * LVL
Definition:TargetTransformInfo.h:200
llvm::TargetTransformInfo::LSRCost
Definition:TargetTransformInfo.h:522
llvm::TargetTransformInfo::LSRCost::NumIVMuls
unsigned NumIVMuls
Definition:TargetTransformInfo.h:528
llvm::TargetTransformInfo::LSRCost::ScaleCost
unsigned ScaleCost
Definition:TargetTransformInfo.h:532
llvm::TargetTransformInfo::LSRCost::Insns
unsigned Insns
TODO: Some of these could be merged.
Definition:TargetTransformInfo.h:525
llvm::TargetTransformInfo::LSRCost::ImmCost
unsigned ImmCost
Definition:TargetTransformInfo.h:530
llvm::TargetTransformInfo::LSRCost::AddRecCost
unsigned AddRecCost
Definition:TargetTransformInfo.h:527
llvm::TargetTransformInfo::LSRCost::NumRegs
unsigned NumRegs
Definition:TargetTransformInfo.h:526
llvm::TargetTransformInfo::LSRCost::NumBaseAdds
unsigned NumBaseAdds
Definition:TargetTransformInfo.h:529
llvm::TargetTransformInfo::LSRCost::SetupCost
unsigned SetupCost
Definition:TargetTransformInfo.h:531
llvm::TargetTransformInfo::MemCmpExpansionOptions
Returns options for expansion of memcmp. IsZeroCmp is.
Definition:TargetTransformInfo.h:962
llvm::TargetTransformInfo::MemCmpExpansionOptions::LoadSizes
SmallVector< unsigned, 8 > LoadSizes
Definition:TargetTransformInfo.h:970
llvm::TargetTransformInfo::MemCmpExpansionOptions::NumLoadsPerBlock
unsigned NumLoadsPerBlock
Definition:TargetTransformInfo.h:980
llvm::TargetTransformInfo::MemCmpExpansionOptions::AllowOverlappingLoads
bool AllowOverlappingLoads
Definition:TargetTransformInfo.h:985
llvm::TargetTransformInfo::MemCmpExpansionOptions::MaxNumLoads
unsigned MaxNumLoads
Definition:TargetTransformInfo.h:967
llvm::TargetTransformInfo::MemCmpExpansionOptions::AllowedTailExpansions
SmallVector< unsigned, 4 > AllowedTailExpansions
Definition:TargetTransformInfo.h:996
llvm::TargetTransformInfo::OperandValueInfo
Definition:TargetTransformInfo.h:1135
llvm::TargetTransformInfo::OperandValueInfo::isConstant
bool isConstant() const
Definition:TargetTransformInfo.h:1139
llvm::TargetTransformInfo::OperandValueInfo::isNegatedPowerOf2
bool isNegatedPowerOf2() const
Definition:TargetTransformInfo.h:1148
llvm::TargetTransformInfo::OperandValueInfo::Kind
OperandValueKind Kind
Definition:TargetTransformInfo.h:1136
llvm::TargetTransformInfo::OperandValueInfo::getNoProps
OperandValueInfo getNoProps() const
Definition:TargetTransformInfo.h:1152
llvm::TargetTransformInfo::OperandValueInfo::isPowerOf2
bool isPowerOf2() const
Definition:TargetTransformInfo.h:1145
llvm::TargetTransformInfo::OperandValueInfo::isUniform
bool isUniform() const
Definition:TargetTransformInfo.h:1142
llvm::TargetTransformInfo::OperandValueInfo::Properties
OperandValueProperties Properties
Definition:TargetTransformInfo.h:1137
llvm::TargetTransformInfo::PeelingPreferences
Definition:TargetTransformInfo.h:663
llvm::TargetTransformInfo::PeelingPreferences::AllowPeeling
bool AllowPeeling
Allow peeling off loop iterations.
Definition:TargetTransformInfo.h:669
llvm::TargetTransformInfo::PeelingPreferences::AllowLoopNestsPeeling
bool AllowLoopNestsPeeling
Allow peeling off loop iterations for loop nests.
Definition:TargetTransformInfo.h:671
llvm::TargetTransformInfo::PeelingPreferences::PeelProfiledIterations
bool PeelProfiledIterations
Allow peeling basing on profile.
Definition:TargetTransformInfo.h:676
llvm::TargetTransformInfo::PeelingPreferences::PeelCount
unsigned PeelCount
A forced peeling factor (the number of bodied of the original loop that should be peeled off before t...
Definition:TargetTransformInfo.h:667
llvm::TargetTransformInfo::PointersChainInfo
Describe known properties for a set of pointers.
Definition:TargetTransformInfo.h:311
llvm::TargetTransformInfo::PointersChainInfo::IsKnownStride
unsigned IsKnownStride
True if distance between any two neigbouring pointers is a known value.
Definition:TargetTransformInfo.h:318
llvm::TargetTransformInfo::PointersChainInfo::getKnownStride
static PointersChainInfo getKnownStride()
Definition:TargetTransformInfo.h:329
llvm::TargetTransformInfo::PointersChainInfo::isUnitStride
bool isUnitStride() const
Definition:TargetTransformInfo.h:322
llvm::TargetTransformInfo::PointersChainInfo::Reserved
unsigned Reserved
Definition:TargetTransformInfo.h:319
llvm::TargetTransformInfo::PointersChainInfo::isSameBase
bool isSameBase() const
Definition:TargetTransformInfo.h:321
llvm::TargetTransformInfo::PointersChainInfo::IsUnitStride
unsigned IsUnitStride
These properties only valid if SameBaseAddress is set.
Definition:TargetTransformInfo.h:316
llvm::TargetTransformInfo::PointersChainInfo::isKnownStride
bool isKnownStride() const
Definition:TargetTransformInfo.h:323
llvm::TargetTransformInfo::PointersChainInfo::IsSameBaseAddress
unsigned IsSameBaseAddress
All the GEPs in a set have same base address.
Definition:TargetTransformInfo.h:313
llvm::TargetTransformInfo::PointersChainInfo::getUnitStride
static PointersChainInfo getUnitStride()
Definition:TargetTransformInfo.h:325
llvm::TargetTransformInfo::PointersChainInfo::getUnknownStride
static PointersChainInfo getUnknownStride()
Definition:TargetTransformInfo.h:333
llvm::TargetTransformInfo::ReductionFlags
Flags describing the kind of vector reduction.
Definition:TargetTransformInfo.h:1748
llvm::TargetTransformInfo::ReductionFlags::IsSigned
bool IsSigned
Whether the operation is a signed int reduction.
Definition:TargetTransformInfo.h:1752
llvm::TargetTransformInfo::ReductionFlags::IsMaxOp
bool IsMaxOp
If the op a min/max kind, true if it's a max operation.
Definition:TargetTransformInfo.h:1750
llvm::TargetTransformInfo::ReductionFlags::NoNaN
bool NoNaN
If op is an fp min/max, whether NaNs may be present.
Definition:TargetTransformInfo.h:1753
llvm::TargetTransformInfo::ReductionFlags::ReductionFlags
ReductionFlags()=default
llvm::TargetTransformInfo::UnrollingPreferences
Parameters that control the generic loop unrolling transformation.
Definition:TargetTransformInfo.h:536
llvm::TargetTransformInfo::UnrollingPreferences::MaxCount
unsigned MaxCount
Definition:TargetTransformInfo.h:577
llvm::TargetTransformInfo::UnrollingPreferences::Count
unsigned Count
A forced unrolling factor (the number of concatenated bodies of the original loop in the unrolled loo...
Definition:TargetTransformInfo.h:570
llvm::TargetTransformInfo::UnrollingPreferences::UpperBound
bool UpperBound
Allow using trip count upper bound to unroll loops.
Definition:TargetTransformInfo.h:607
llvm::TargetTransformInfo::UnrollingPreferences::Threshold
unsigned Threshold
The cost threshold for the unrolled loop.
Definition:TargetTransformInfo.h:544
llvm::TargetTransformInfo::UnrollingPreferences::Force
bool Force
Apply loop unroll on any kind of loop (mainly to loops that fail runtime unrolling).
Definition:TargetTransformInfo.h:605
llvm::TargetTransformInfo::UnrollingPreferences::PartialOptSizeThreshold
unsigned PartialOptSizeThreshold
The cost threshold for the unrolled loop when optimizing for size, like OptSizeThreshold,...
Definition:TargetTransformInfo.h:565
llvm::TargetTransformInfo::UnrollingPreferences::UnrollVectorizedLoop
bool UnrollVectorizedLoop
Don't disable runtime unroll for the loops which were vectorized.
Definition:TargetTransformInfo.h:621
llvm::TargetTransformInfo::UnrollingPreferences::DefaultUnrollRuntimeCount
unsigned DefaultUnrollRuntimeCount
Default unroll count for loops with run-time trip count.
Definition:TargetTransformInfo.h:572
llvm::TargetTransformInfo::UnrollingPreferences::MaxPercentThresholdBoost
unsigned MaxPercentThresholdBoost
If complete unrolling will reduce the cost of the loop, we will boost the Threshold by a certain perc...
Definition:TargetTransformInfo.h:555
llvm::TargetTransformInfo::UnrollingPreferences::RuntimeUnrollMultiExit
bool RuntimeUnrollMultiExit
Allow runtime unrolling multi-exit loops.
Definition:TargetTransformInfo.h:629
llvm::TargetTransformInfo::UnrollingPreferences::SCEVExpansionBudget
unsigned SCEVExpansionBudget
Don't allow runtime unrolling if expanding the trip count takes more than SCEVExpansionBudget.
Definition:TargetTransformInfo.h:624
llvm::TargetTransformInfo::UnrollingPreferences::UnrollAndJamInnerLoopThreshold
unsigned UnrollAndJamInnerLoopThreshold
Threshold for unroll and jam, for inner loop size.
Definition:TargetTransformInfo.h:616
llvm::TargetTransformInfo::UnrollingPreferences::MaxIterationsCountToAnalyze
unsigned MaxIterationsCountToAnalyze
Don't allow loop unrolling to simulate more than this number of iterations when checking full unroll ...
Definition:TargetTransformInfo.h:619
llvm::TargetTransformInfo::UnrollingPreferences::AllowRemainder
bool AllowRemainder
Allow generation of a loop remainder (extra iterations after unroll).
Definition:TargetTransformInfo.h:599
llvm::TargetTransformInfo::UnrollingPreferences::UnrollAndJam
bool UnrollAndJam
Allow unroll and jam. Used to enable unroll and jam for the target.
Definition:TargetTransformInfo.h:611
llvm::TargetTransformInfo::UnrollingPreferences::UnrollRemainder
bool UnrollRemainder
Allow unrolling of all the iterations of the runtime loop remainder.
Definition:TargetTransformInfo.h:609
llvm::TargetTransformInfo::UnrollingPreferences::FullUnrollMaxCount
unsigned FullUnrollMaxCount
Set the maximum unrolling factor for full unrolling.
Definition:TargetTransformInfo.h:585
llvm::TargetTransformInfo::UnrollingPreferences::BEInsns
unsigned BEInsns
Definition:TargetTransformInfo.h:590
llvm::TargetTransformInfo::UnrollingPreferences::PartialThreshold
unsigned PartialThreshold
The cost threshold for the unrolled loop, like Threshold, but used for partial/runtime unrolling (set...
Definition:TargetTransformInfo.h:561
llvm::TargetTransformInfo::UnrollingPreferences::Runtime
bool Runtime
Allow runtime unrolling (unrolling of loops to expand the size of the loop body even when the number ...
Definition:TargetTransformInfo.h:597
llvm::TargetTransformInfo::UnrollingPreferences::Partial
bool Partial
Allow partial unrolling (unrolling of loops to expand the size of the loop body, not only to eliminat...
Definition:TargetTransformInfo.h:593
llvm::TargetTransformInfo::UnrollingPreferences::OptSizeThreshold
unsigned OptSizeThreshold
The cost threshold for the unrolled loop when optimizing for size (set to UINT_MAX to disable).
Definition:TargetTransformInfo.h:558
llvm::TargetTransformInfo::UnrollingPreferences::AllowExpensiveTripCount
bool AllowExpensiveTripCount
Allow emitting expensive instructions (such as divisions) when computing the trip count of a loop for...
Definition:TargetTransformInfo.h:602
llvm::TargetTransformInfo::UnrollingPreferences::MaxUpperBound
unsigned MaxUpperBound
Set the maximum upper bound of trip count.
Definition:TargetTransformInfo.h:581
llvm::TargetTransformInfo::VPLegalization
Definition:TargetTransformInfo.h:1833
llvm::TargetTransformInfo::VPLegalization::OpStrategy
VPTransform OpStrategy
Definition:TargetTransformInfo.h:1853
llvm::TargetTransformInfo::VPLegalization::shouldDoNothing
bool shouldDoNothing() const
Definition:TargetTransformInfo.h:1855
llvm::TargetTransformInfo::VPLegalization::EVLParamStrategy
VPTransform EVLParamStrategy
Definition:TargetTransformInfo.h:1847
llvm::TargetTransformInfo::VPLegalization::VPTransform
VPTransform
Definition:TargetTransformInfo.h:1834
llvm::TargetTransformInfo::VPLegalization::Convert
@ Convert
Definition:TargetTransformInfo.h:1840
llvm::TargetTransformInfo::VPLegalization::Legal
@ Legal
Definition:TargetTransformInfo.h:1836
llvm::TargetTransformInfo::VPLegalization::Discard
@ Discard
Definition:TargetTransformInfo.h:1838
llvm::TargetTransformInfo::VPLegalization::VPLegalization
VPLegalization(VPTransform EVLParamStrategy, VPTransform OpStrategy)
Definition:TargetTransformInfo.h:1858

Generated on Sun Jul 20 2025 06:52:11 for LLVM by doxygen 1.9.6
[8]ページ先頭

©2009-2025 Movatter.jp