13#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
14#define LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
40#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
48 template <
bool EnableVerify =
true,
typename PassTy,
typename... ArgsTy>
52#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
57 dbgs() << Plan <<
'\n';
64 return std::forward<PassTy>(
Pass)(Plan, std::forward<ArgsTy>(Args)...);
66#define RUN_VPLAN_PASS(PASS, ...) \
67 llvm::VPlanTransforms::runPass(#PASS, PASS, __VA_ARGS__)
68#define RUN_VPLAN_PASS_NO_VERIFY(PASS, ...) \
69 llvm::VPlanTransforms::runPass<false>(#PASS, PASS, __VA_ARGS__)
115 PredicatedScalarEvolution &PSE, LoopVersioning *LVer =
nullptr);
122 VPlan &Plan, PredicatedScalarEvolution &PSE, Loop &OrigLoop,
123 const MapVector<PHINode *, InductionDescriptor> &Inductions,
124 const MapVector<PHINode *, RecurrenceDescriptor> &
Reductions,
125 const SmallPtrSetImpl<const PHINode *> &FixedOrderRecurrences,
126 const SmallPtrSetImpl<PHINode *> &InLoopReductions,
bool AllowReordering);
133 VPlan &Plan,
const DenseMap<VPBasicBlock *, VPValue *> &BlockMaskCache,
134 const DenseSet<BasicBlock *> &BlocksNeedingPredication,
139 bool HasUncountableExit);
144 bool RequiresScalarEpilogueCheck,
150 ElementCount MinProfitableTripCount,
151 bool RequiresScalarEpilogue,
bool TailFolded,
152 bool CheckNeededWithTailFolding, Loop *OrigLoop,
154 PredicatedScalarEvolution &PSE);
159 VPlan &Plan, Value *TripCount, Value *VectorTripCount,
160 bool RequiresScalarEpilogue, ElementCount EpilogueVF,
unsigned EpilogueUF,
161 unsigned MainLoopStep,
unsigned EpilogueLoopStep, ScalarEvolution &SE);
171 bool AddBranchWeights);
178 const TargetLibraryInfo &TLI);
212 static void unrollByUF(VPlan &Plan,
unsigned UF);
224 PredicatedScalarEvolution &PSE);
246 bool UseActiveLaneMaskForControlFlow,
253 const MapVector<Instruction *, uint64_t> &MinBWs);
259 const DenseMap<Value *, const SCEV *> &StridesMap);
275 const std::function<
bool(BasicBlock *)> &BlockNeedsPredication);
284 const std::optional<unsigned> &MaxEVLSafeElements);
300 const SmallPtrSetImpl<
const InterleaveGroup<Instruction> *>
302 VPRecipeBuilder &RecipeBuilder,
const bool &ScalarEpilogueAllowed);
312 VPBasicBlock *EarlyExitVPBB,
313 VPlan &Plan, VPBasicBlock *HeaderVPBB,
314 VPBasicBlock *LatchVPBB);
354 static void cse(VPlan &Plan);
361 DenseMap<VPValue *, VPValue *> &EndValues,
362 PredicatedScalarEvolution &PSE);
390 PredicatedScalarEvolution &PSE);
394 VPBasicBlock *VectorPHVPBB,
396 bool RequiresScalarEpilogue);
401 VPBasicBlock *VectorPH);
416 static DenseMap<const SCEV *, Value *>
expandSCEVs(VPlan &Plan,
417 ScalarEvolution &SE);
426 TypeSize VectorRegWidth);
434 static DenseMap<VPBasicBlock *, VPValue *>
441 std::optional<unsigned> VScaleForTuning);
448 DenseMap<VPValue *, VPValue *> &IVEndValues);
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_ABI_FOR_TEST
static constexpr uint32_t MinItersBypassWeights[]
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
const SmallVectorImpl< MachineOperand > & Cond
This file defines the make_scope_exit function, which executes user-defined cleanup logic at scope ex...
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[]
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...
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 ...
The main scalar evolution driver.
StringRef - Represent a constant reference to a string, i.e.
Provides information about what library functions are available for the current target.
VPlan-based builder utility analogous to IRBuilder.
Helper class to create VPRecipies from IR instructions.
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
This is an optimization pass for GlobalISel generic memory operations.
LLVM_ABI_FOR_TEST cl::opt< bool > VerifyEachVPlan
LLVM_ABI_FOR_TEST bool verifyVPlanIsValid(const VPlan &Plan, bool VerifyLate=false)
Verify invariants for general VPlans.
LLVM_ABI_FOR_TEST cl::opt< bool > EnableWideActiveLaneMask
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
@ DataAndControlFlowWithoutRuntimeCheck
Use predicate to control both data and control flow, but modify the trip count so that a runtime over...
LLVM_ABI_FOR_TEST cl::opt< bool > PrintAfterEachVPlanPass
A range of powers-of-2 vectorization factors with fixed start and adjustable end.