13#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
14#define LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
57 template <
bool EnableVerify =
true,
typename PassTy,
typename... ArgsTy>
67 std::string NumberedPassName;
70 Instance = ++PassCounter[{Fn,
PassName}];
72 NumberedPassName = Instance == 1
90 return std::forward<PassTy>(
Pass)(Plan, std::forward<ArgsTy>(Args)...);
92#define RUN_VPLAN_PASS(PASS, ...) \
93 llvm::VPlanTransforms::runPass(#PASS, PASS, __VA_ARGS__)
94#define RUN_VPLAN_PASS_NO_VERIFY(PASS, ...) \
95 llvm::VPlanTransforms::runPass<false>(#PASS, PASS, __VA_ARGS__)
140 PredicatedScalarEvolution &PSE, LoopVersioning *LVer =
nullptr,
141 function_ref<
const BranchProbabilityInfo &()> GetBPI =
nullptr);
155 VPlan &Plan, PredicatedScalarEvolution &PSE,
Loop &OrigLoop,
156 OptimizationRemarkEmitter *ORE,
const VPDominatorTree &VPDT,
157 const MapVector<PHINode *, InductionDescriptor> &Inductions,
158 const MapVector<PHINode *, RecurrenceDescriptor> &
Reductions,
159 const SmallPtrSetImpl<const PHINode *> &FixedOrderRecurrences,
160 const SmallPtrSetImpl<PHINode *> &InLoopReductions,
bool AllowReordering);
169 bool OptForSize,
unsigned SCEVCheckThreshold,
170 OptimizationRemarkEmitter *ORE,
Loop *TheLoop);
184 VPlan &Plan, ElementCount VF,
unsigned UF,
185 ElementCount MinProfitableTripCount,
bool RequiresScalarEpilogue,
187 DebugLoc DL, PredicatedScalarEvolution &PSE, VPBasicBlock *CheckBlock);
193 bool RequiresScalarEpilogue,
Loop *OrigLoop,
200 VPlan &Plan, VPValue *MainVectorTripCount,
bool RequiresScalarEpilogue,
201 ElementCount EpilogueVF,
unsigned MainLoopStep,
unsigned EpilogueLoopStep,
202 ScalarEvolution &SE);
212 VPBasicBlock *CheckBlock,
213 bool AddBranchWeights);
215 bool AddBranchWeights);
221 const RuntimePointerChecking &RtPtrChecking,
222 ScalarEvolution &SE, ElementCount VF,
224 bool AddBranchWeights);
232 VPIRBasicBlock *EnteredFrom);
239 VPlan &Plan,
const TargetLibraryInfo &TLI, PredicatedScalarEvolution &PSE,
247 OptimizationRemarkEmitter *ORE,
267 static void unrollByUF(VPlan &Plan,
unsigned UF);
280 PredicatedScalarEvolution &PSE);
285 PredicatedScalarEvolution &PSE);
306 bool UseActiveLaneMaskForControlFlow);
312 const MapVector<Instruction *, uint64_t> &MinBWs);
317 PredicatedScalarEvolution &PSE);
322 PredicatedScalarEvolution &PSE,
324 const VPDominatorTree &VPDT);
341 const std::optional<unsigned> &MaxEVLSafeElements);
357 const SmallPtrSetImpl<
const InterleaveGroup<Instruction> *>
359 const bool &EpilogueAllowed);
365 PredicatedScalarEvolution &PSE,
Loop &L,
366 VPCostContext &Ctx, VFRange &
Range);
376 PredicatedScalarEvolution &PSE,
378 AssumptionCache *AC);
392 Loop *TheLoop, PredicatedScalarEvolution &PSE,
393 DominatorTree &DT, AssumptionCache *AC,
444 static void cse(VPlan &Plan);
454 PredicatedScalarEvolution &PSE,
476 const TargetTransformInfo &
TTI);
483 PredicatedScalarEvolution &PSE);
490 VPlan &Plan, VPBasicBlock *VectorPHVPBB,
bool TailByMasking,
491 bool RequiresScalarEpilogue, VPValue *Step,
492 std::optional<uint64_t> MaxRuntimeStep = std::nullopt);
497 VPBasicBlock *VectorPH);
513 VPBasicBlock *AliasCheckVPBB,
530 static DenseMap<const SCEV *, Value *>
expandSCEVs(VPlan &Plan,
531 ScalarEvolution &SE);
545 static std::unique_ptr<VPlan>
592 const TargetTransformInfo &
TTI,
594 ElementCount VF,
unsigned UF);
600 std::optional<unsigned> VScaleForTuning);
615 PredicatedScalarEvolution &PSE,
Loop &L);
627 VPRecipeBuilder &RecipeBuilder,
628 VPCostContext &CostCtx);
640 VPRecipeBuilder &RecipeBuilder,
641 VPCostContext &CostCtx);
649 const TargetTransformInfo &
TTI,
650 PredicatedScalarEvolution &PSE);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_ABI_FOR_TEST
static cl::opt< OutputCostKind > CostKind("cost-kind", cl::desc("Target cost kind"), cl::init(OutputCostKind::RecipThroughput), cl::values(clEnumValN(OutputCostKind::RecipThroughput, "throughput", "Reciprocal throughput"), clEnumValN(OutputCostKind::Latency, "latency", "Instruction latency"), clEnumValN(OutputCostKind::CodeSize, "code-size", "Code size"), clEnumValN(OutputCostKind::SizeAndLatency, "size-latency", "Code size and latency"), clEnumValN(OutputCostKind::All, "all", "Print all cost kinds")))
static constexpr uint32_t MinItersBypassWeights[]
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
const SmallVectorImpl< MachineOperand > & Cond
This file defines the scope_exit class, which executes user-defined cleanup logic at scope exit.
This file declares the class VPlanVerifier, which contains utility functions to check the consistency...
This file contains the declarations of the Vectorization Plan base classes:
static const char PassName[]
const Function * getParent() const
Return the enclosing method, or null if none.
Analysis providing branch probability information.
A struct for saving information about induction variables.
This class emits a version of the loop where run-time checks ensure that may-alias pointers can't ove...
Represents a single loop in the control flow graph.
Pass interface - Implemented by all 'passes'.
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
Holds information about the memory runtime legality checks to verify that a group of pointers do not ...
The main scalar evolution driver.
Represent a constant reference to a string, i.e.
Provides information about what library functions are available for the current target.
Twine - A lightweight data structure for efficiently representing the concatenation of temporary valu...
BasicBlock * getIRBasicBlock() const
Helper class to create VPRecipies from IR instructions.
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
VPIRBasicBlock * getScalarHeader() const
Return the VPIRBasicBlock wrapping the header of the scalar loop.
This is an optimization pass for GlobalISel generic memory operations.
DenseMap< Value *, const SCEVUnknown * > SymbolicStrideMap
Maps a pointer to its symbolic (non-constant) stride.
UncountableExitStyle
Different methods of handling early exits.
ArrayRef(const T &OneElt) -> ArrayRef< T >
A range of powers-of-2 vectorization factors with fixed start and adjustable end.