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 MapVector<PHINode *, ConditionalInductionDescriptor>
160 &ConditionalInductions,
161 const SmallPtrSetImpl<const PHINode *> &FixedOrderRecurrences,
162 const SmallPtrSetImpl<PHINode *> &InLoopReductions,
bool AllowReordering);
171 bool OptForSize,
unsigned SCEVCheckThreshold,
172 OptimizationRemarkEmitter *ORE,
Loop *TheLoop);
186 VPlan &Plan, ElementCount VF,
unsigned UF,
187 ElementCount MinProfitableTripCount,
bool RequiresScalarEpilogue,
189 DebugLoc DL, PredicatedScalarEvolution &PSE, VPBasicBlock *CheckBlock);
195 bool RequiresScalarEpilogue,
Loop *OrigLoop,
202 VPlan &Plan, VPValue *MainVectorTripCount,
bool RequiresScalarEpilogue,
203 ElementCount EpilogueVF,
unsigned MainLoopStep,
unsigned EpilogueLoopStep,
204 ScalarEvolution &SE);
214 VPBasicBlock *CheckBlock,
215 bool AddBranchWeights);
217 bool AddBranchWeights);
223 const RuntimePointerChecking &RtPtrChecking,
224 const Loop *TheLoop, ScalarEvolution &SE,
225 ElementCount VF,
unsigned UF,
226 bool AddBranchWeights);
237 VPBasicBlock *MainCheck);
244 VPlan &Plan,
const TargetLibraryInfo &
TLI, PredicatedScalarEvolution &PSE,
252 OptimizationRemarkEmitter *ORE,
277 VPRecipeBuilder &RecipeBuilder,
278 ScalarEvolution &SE);
284 static void unrollByUF(VPlan &Plan,
unsigned UF);
297 PredicatedScalarEvolution &PSE);
302 PredicatedScalarEvolution &PSE);
325 bool UseActiveLaneMaskForControlFlow);
331 const MapVector<Instruction *, uint64_t> &MinBWs);
336 PredicatedScalarEvolution &PSE);
341 PredicatedScalarEvolution &PSE,
343 const VPDominatorTree &VPDT);
360 const std::optional<unsigned> &MaxEVLSafeElements);
376 const SmallPtrSetImpl<
const InterleaveGroup<Instruction> *>
378 const bool &EpilogueAllowed);
384 PredicatedScalarEvolution &PSE,
Loop &L,
385 VPCostContext &Ctx, VFRange &
Range);
401 PredicatedScalarEvolution &PSE,
403 AssumptionCache *AC);
421 Loop *TheLoop, PredicatedScalarEvolution &PSE,
422 DominatorTree &DT, AssumptionCache *AC);
472 static void cse(VPlan &Plan,
const VPDominatorTree &VPDT);
478 PredicatedScalarEvolution &PSE,
500 const TargetTransformInfo &
TTI);
507 PredicatedScalarEvolution &PSE);
514 VPlan &Plan, VPBasicBlock *VectorPHVPBB,
bool TailByMasking,
515 bool RequiresScalarEpilogue, VPValue *Step,
516 std::optional<uint64_t> MaxRuntimeStep = std::nullopt);
534 VPBasicBlock *AliasCheckVPBB,
536 ScalarEvolution &SE);
544 ScalarEvolution &SE,
bool HasBranchWeights);
554 static DenseMap<const SCEV *, Value *>
expandSCEVs(VPlan &Plan,
555 ScalarEvolution &SE);
569 static std::unique_ptr<VPlan>
616 const TargetTransformInfo &
TTI,
618 ElementCount VF,
unsigned UF);
624 std::optional<unsigned> VScaleForTuning);
639 PredicatedScalarEvolution &PSE,
Loop &L);
651 VPRecipeBuilder &RecipeBuilder,
652 VPCostContext &CostCtx);
664 VPRecipeBuilder &RecipeBuilder,
665 VPCostContext &CostCtx);
673 const TargetTransformInfo &
TTI);
const TargetLowering & TLI
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_ABI_FOR_TEST
SmallVector< MachineOperand, 4 > Cond
static constexpr uint32_t MinItersBypassWeights[]
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
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.
ArrayRef(const T &OneElt) -> ArrayRef< T >
A range of powers-of-2 vectorization factors with fixed start and adjustable end.