LLVM 22.0.0git
VPlanTransforms.h
Go to the documentation of this file.
1//===- VPlanTransforms.h - Utility VPlan to VPlan transforms --------------===//
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///
9/// \file
10/// This file provides utility VPlan to VPlan transformations.
11//===----------------------------------------------------------------------===//
12
13#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
14#define LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
15
16#include "VPlan.h"
17#include "VPlanVerifier.h"
21
22namespace llvm {
23
25class Instruction;
26class PHINode;
27class ScalarEvolution;
30class VPBuilder;
31class VPRecipeBuilder;
32struct VFRange;
33
35
37 /// Helper to run a VPlan transform \p Transform on \p VPlan, forwarding extra
38 /// arguments to the transform. Returns the boolean returned by the transform.
39 template <typename... ArgsTy>
40 static bool runPass(bool (*Transform)(VPlan &, ArgsTy...), VPlan &Plan,
41 typename std::remove_reference<ArgsTy>::type &...Args) {
42 bool Res = Transform(Plan, Args...);
45 return Res;
46 }
47 /// Helper to run a VPlan transform \p Transform on \p VPlan, forwarding extra
48 /// arguments to the transform.
49 template <typename... ArgsTy>
50 static void runPass(void (*Fn)(VPlan &, ArgsTy...), VPlan &Plan,
51 typename std::remove_reference<ArgsTy>::type &...Args) {
52 Fn(Plan, Args...);
55 }
56
57 /// Create a base VPlan0, serving as the common starting point for all later
58 /// candidates. It consists of an initial plain CFG loop with loop blocks from
59 /// \p TheLoop being directly translated to VPBasicBlocks with VPInstruction
60 /// corresponding to the input IR.
61 ///
62 /// The created loop is wrapped in an initial skeleton to facilitate
63 /// vectorization, consisting of a vector pre-header, an exit block for the
64 /// main vector loop (middle.block) and a new block as preheader of the scalar
65 /// loop (scalar.ph). See below for an illustration. It also adds a canonical
66 /// IV and its increment, using \p InductionTy and \p IVDL, and creates a
67 /// VPValue expression for the original trip count.
68 ///
69 /// [ ] <-- Plan's entry VPIRBasicBlock, wrapping the original loop's
70 /// / \ old preheader. Will contain iteration number check and SCEV
71 /// | | expansions.
72 /// | |
73 /// / v
74 /// | [ ] <-- vector loop bypass (may consist of multiple blocks) will be
75 /// | / | added later.
76 /// | / v
77 /// || [ ] <-- vector pre header.
78 /// |/ |
79 /// | v
80 /// | [ ] \ <-- plain CFG loop wrapping original loop to be vectorized.
81 /// | [ ]_|
82 /// | |
83 /// | v
84 /// | [ ] <--- middle-block with the branch to successors
85 /// | / |
86 /// | / |
87 /// | | v
88 /// \--->[ ] <--- scalar preheader (initial a VPBasicBlock, which will be
89 /// | | replaced later by a VPIRBasicBlock wrapping the scalar
90 /// | | preheader basic block.
91 /// | |
92 /// v <-- edge from middle to exit iff epilogue is not required.
93 /// | [ ] \
94 /// | [ ]_| <-- old scalar loop to handle remainder (scalar epilogue,
95 /// | | header wrapped in VPIRBasicBlock).
96 /// \ |
97 /// \ v
98 /// >[ ] <-- original loop exit block(s), wrapped in VPIRBasicBlocks.
99 LLVM_ABI_FOR_TEST static std::unique_ptr<VPlan>
100 buildVPlan0(Loop *TheLoop, LoopInfo &LI, Type *InductionTy, DebugLoc IVDL,
102
103 /// Update \p Plan to account for all early exits.
104 LLVM_ABI_FOR_TEST static void handleEarlyExits(VPlan &Plan,
105 bool HasUncountableExit);
106
107 /// If a check is needed to guard executing the scalar epilogue loop, it will
108 /// be added to the middle block.
109 LLVM_ABI_FOR_TEST static void addMiddleCheck(VPlan &Plan,
110 bool RequiresScalarEpilogueCheck,
111 bool TailFolded);
112
113 // Create a check to \p Plan to see if the vector loop should be executed.
114 static void addMinimumIterationCheck(
115 VPlan &Plan, ElementCount VF, unsigned UF,
116 ElementCount MinProfitableTripCount, bool RequiresScalarEpilogue,
117 bool TailFolded, bool CheckNeededWithTailFolding, Loop *OrigLoop,
119
120 /// Replace loops in \p Plan's flat CFG with VPRegionBlocks, turning \p Plan's
121 /// flat CFG into a hierarchical CFG.
122 LLVM_ABI_FOR_TEST static void createLoopRegions(VPlan &Plan);
123
124 /// Wrap runtime check block \p CheckBlock in a VPIRBB and \p Cond in a
125 /// VPValue and connect the block to \p Plan, using the VPValue as branch
126 /// condition.
127 static void attachCheckBlock(VPlan &Plan, Value *Cond, BasicBlock *CheckBlock,
128 bool AddBranchWeights);
129
130 /// Replaces the VPInstructions in \p Plan with corresponding
131 /// widen recipes. Returns false if any VPInstructions could not be converted
132 /// to a wide recipe if needed.
134 VPlanPtr &Plan,
136 GetIntOrFpInductionDescriptor,
137 const TargetLibraryInfo &TLI);
138
139 /// Try to have all users of fixed-order recurrences appear after the recipe
140 /// defining their previous value, by either sinking users or hoisting recipes
141 /// defining their previous value (and its operands). Then introduce
142 /// FirstOrderRecurrenceSplice VPInstructions to combine the value from the
143 /// recurrence phis and previous values.
144 /// \returns true if all users of fixed-order recurrences could be re-arranged
145 /// as needed or false if it is not possible. In the latter case, \p Plan is
146 /// not valid.
147 static bool adjustFixedOrderRecurrences(VPlan &Plan, VPBuilder &Builder);
148
149 /// Check if \p Plan contains any FMaxNum or FMinNum reductions. If they do,
150 /// try to update the vector loop to exit early if any input is NaN and resume
151 /// executing in the scalar loop to handle the NaNs there. Return false if
152 /// this attempt was unsuccessful.
153 static bool handleMaxMinNumReductions(VPlan &Plan);
154
155 /// Clear NSW/NUW flags from reduction instructions if necessary.
156 static void clearReductionWrapFlags(VPlan &Plan);
157
158 /// Explicitly unroll \p Plan by \p UF.
159 static void unrollByUF(VPlan &Plan, unsigned UF);
160
161 /// Replace each replicating VPReplicateRecipe and VPInstruction outside of
162 /// any replicate region in \p Plan with \p VF single-scalar recipes.
163 /// TODO: Also replicate VPScalarIVSteps and VPReplicateRecipes inside
164 /// replicate regions, thereby dissolving the latter.
165 static void replicateByVF(VPlan &Plan, ElementCount VF);
166
167 /// Optimize \p Plan based on \p BestVF and \p BestUF. This may restrict the
168 /// resulting plan to \p BestVF and \p BestUF.
169 static void optimizeForVFAndUF(VPlan &Plan, ElementCount BestVF,
170 unsigned BestUF,
172
173 /// Apply VPlan-to-VPlan optimizations to \p Plan, including induction recipe
174 /// optimizations, dead recipe removal, replicate region optimizations and
175 /// block merging.
176 static void optimize(VPlan &Plan);
177
178 /// Wrap predicated VPReplicateRecipes with a mask operand in an if-then
179 /// region block and remove the mask operand. Optimize the created regions by
180 /// iteratively sinking scalar operands into the region, followed by merging
181 /// regions until no improvements are remaining.
182 static void createAndOptimizeReplicateRegions(VPlan &Plan);
183
184 /// Replace (ICMP_ULE, wide canonical IV, backedge-taken-count) checks with an
185 /// (active-lane-mask recipe, wide canonical IV, trip-count). If \p
186 /// UseActiveLaneMaskForControlFlow is true, introduce an
187 /// VPActiveLaneMaskPHIRecipe. If \p DataAndControlFlowWithoutRuntimeCheck is
188 /// true, no minimum-iteration runtime check will be created (during skeleton
189 /// creation) and instead it is handled using active-lane-mask. \p
190 /// DataAndControlFlowWithoutRuntimeCheck implies \p
191 /// UseActiveLaneMaskForControlFlow.
192 static void addActiveLaneMask(VPlan &Plan,
193 bool UseActiveLaneMaskForControlFlow,
195
196 /// Insert truncates and extends for any truncated recipe. Redundant casts
197 /// will be folded later.
198 static void
201
202 /// Replace symbolic strides from \p StridesMap in \p Plan with constants when
203 /// possible.
204 static void
206 const DenseMap<Value *, const SCEV *> &StridesMap);
207
208 /// Drop poison flags from recipes that may generate a poison value that is
209 /// used after vectorization, even when their operands are not poison. Those
210 /// recipes meet the following conditions:
211 /// * Contribute to the address computation of a recipe generating a widen
212 /// memory load/store (VPWidenMemoryInstructionRecipe or
213 /// VPInterleaveRecipe).
214 /// * Such a widen memory load/store has at least one underlying Instruction
215 /// that is in a basic block that needs predication and after vectorization
216 /// the generated instruction won't be predicated.
217 /// Uses \p BlockNeedsPredication to check if a block needs predicating.
218 /// TODO: Replace BlockNeedsPredication callback with retrieving info from
219 /// VPlan directly.
220 static void dropPoisonGeneratingRecipes(
221 VPlan &Plan,
222 const std::function<bool(BasicBlock *)> &BlockNeedsPredication);
223
224 /// Add a VPEVLBasedIVPHIRecipe and related recipes to \p Plan and
225 /// replaces all uses except the canonical IV increment of
226 /// VPCanonicalIVPHIRecipe with a VPEVLBasedIVPHIRecipe.
227 /// VPCanonicalIVPHIRecipe is only used to control the loop after
228 /// this transformation.
229 static void
231 const std::optional<unsigned> &MaxEVLSafeElements);
232
233 // For each Interleave Group in \p InterleaveGroups replace the Recipes
234 // widening its memory instructions with a single VPInterleaveRecipe at its
235 // insertion point.
236 static void createInterleaveGroups(
237 VPlan &Plan,
239 &InterleaveGroups,
240 VPRecipeBuilder &RecipeBuilder, const bool &ScalarEpilogueAllowed);
241
242 /// Remove dead recipes from \p Plan.
243 static void removeDeadRecipes(VPlan &Plan);
244
245 /// Update \p Plan to account for the uncountable early exit from \p
246 /// EarlyExitingVPBB to \p EarlyExitVPBB by
247 /// * updating the condition exiting the loop via the latch to include the
248 /// early exit condition,
249 /// * splitting the original middle block to branch to the early exit block
250 /// conditionally - according to the early exit condition.
251 static void handleUncountableEarlyExit(VPBasicBlock *EarlyExitingVPBB,
252 VPBasicBlock *EarlyExitVPBB,
253 VPlan &Plan, VPBasicBlock *HeaderVPBB,
254 VPBasicBlock *LatchVPBB);
255
256 /// Replace loop regions with explicit CFG.
257 static void dissolveLoopRegions(VPlan &Plan);
258
259 /// Transform EVL loops to use variable-length stepping after region
260 /// dissolution.
261 ///
262 /// Once loop regions are replaced with explicit CFG, EVL loops can step with
263 /// variable vector lengths instead of fixed lengths. This transformation:
264 /// * Makes EVL-Phi concrete.
265 // * Removes CanonicalIV and increment.
266 /// * Replaces the exit condition from
267 /// (branch-on-count CanonicalIVInc, VectorTripCount)
268 /// to
269 /// (branch-on-cond eq AVLNext, 0)
270 static void canonicalizeEVLLoops(VPlan &Plan);
271
272 /// Lower abstract recipes to concrete ones, that can be codegen'd.
273 static void convertToConcreteRecipes(VPlan &Plan);
274
275 /// This function converts initial recipes to the abstract recipes and clamps
276 /// \p Range based on cost model for following optimizations and cost
277 /// estimations. The converted abstract recipes will lower to concrete
278 /// recipes before codegen.
279 static void convertToAbstractRecipes(VPlan &Plan, VPCostContext &Ctx,
280 VFRange &Range);
281
282 /// Perform instcombine-like simplifications on recipes in \p Plan.
283 static void simplifyRecipes(VPlan &Plan);
284
285 /// Remove BranchOnCond recipes with true or false conditions together with
286 /// removing dead edges to their successors.
287 static void removeBranchOnConst(VPlan &Plan);
288
289 /// Perform common-subexpression-elimination on \p Plan.
290 static void cse(VPlan &Plan);
291
292 /// If there's a single exit block, optimize its phi recipes that use exiting
293 /// IV values by feeding them precomputed end values instead, possibly taken
294 /// one step backwards.
295 static void
298 ScalarEvolution &SE);
299
300 /// Add explicit broadcasts for live-ins and VPValues defined in \p Plan's entry block if they are used as vectors.
301 static void materializeBroadcasts(VPlan &Plan);
302
303 // Materialize vector trip counts for constants early if it can simply be
304 // computed as (Original TC / VF * UF) * VF * UF.
305 static void
307 unsigned BestUF,
309
310 /// Materialize vector trip count computations to a set of VPInstructions.
311 static void materializeVectorTripCount(VPlan &Plan,
312 VPBasicBlock *VectorPHVPBB,
313 bool TailByMasking,
314 bool RequiresScalarEpilogue);
315
316 /// Materialize the backedge-taken count to be computed explicitly using
317 /// VPInstructions.
318 static void materializeBackedgeTakenCount(VPlan &Plan,
319 VPBasicBlock *VectorPH);
320
321 /// Add explicit Build[Struct]Vector recipes that combine multiple scalar
322 /// values into single vectors.
323 static void materializeBuildVectors(VPlan &Plan);
324
325 /// Materialize VF and VFxUF to be computed explicitly using VPInstructions.
326 static void materializeVFAndVFxUF(VPlan &Plan, VPBasicBlock *VectorPH,
327 ElementCount VF);
328
329 /// Expand VPExpandSCEVRecipes in \p Plan's entry block. Each
330 /// VPExpandSCEVRecipe is replaced with a live-in wrapping the expanded IR
331 /// value. A mapping from SCEV expressions to their expanded IR value is
332 /// returned.
334 ScalarEvolution &SE);
335
336 /// Try to convert a plan with interleave groups with VF elements to a plan
337 /// with the interleave groups replaced by wide loads and stores processing VF
338 /// elements, if all transformed interleave groups access the full vector
339 /// width (checked via \o VectorRegWidth). This effectively is a very simple
340 /// form of loop-aware SLP, where we use interleave groups to identify
341 /// candidates.
342 static void narrowInterleaveGroups(VPlan &Plan, ElementCount VF,
343 unsigned VectorRegWidth);
344
345 /// Predicate and linearize the control-flow in the only loop region of
346 /// \p Plan. If \p FoldTail is true, create a mask guarding the loop
347 /// header, otherwise use all-true for the header mask. Masks for blocks are
348 /// added to a block-to-mask map which is returned in order to be used later
349 /// for wide recipe construction. This argument is temporary and will be
350 /// removed in the future.
352 introduceMasksAndLinearize(VPlan &Plan, bool FoldTail);
353
354 /// Add branch weight metadata, if the \p Plan's middle block is terminated by
355 /// a BranchOnCond recipe.
356 static void
358 std::optional<unsigned> VScaleForTuning);
359};
360
361} // namespace llvm
362
363#endif // LLVM_TRANSFORMS_VECTORIZE_VPLANTRANSFORMS_H
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
#define LLVM_ABI_FOR_TEST
Definition Compiler.h:218
static constexpr uint32_t MinItersBypassWeights[]
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
const SmallVectorImpl< MachineOperand > & Cond
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:
LLVM Basic Block Representation.
Definition BasicBlock.h:62
A debug info location.
Definition DebugLoc.h:124
A struct for saving information about induction variables.
The group of interleaved loads/stores sharing the same stride and close to each other.
Represents a single loop in the control flow graph.
Definition LoopInfo.h:40
This class implements a map that also provides access to all stored values in a deterministic order.
Definition MapVector.h:36
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
The main scalar evolution driver.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
Provides information about what library functions are available for the current target.
The instances of the Type class are immutable: once they are created, they are never changed.
Definition Type.h:45
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition VPlan.h:3750
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...
Definition VPlan.h:4041
LLVM Value Representation.
Definition Value.h:75
An efficient, type-erasing, non-owning reference to a callable.
This is an optimization pass for GlobalISel generic memory operations.
cl::opt< bool > VerifyEachVPlan
LLVM_ABI_FOR_TEST bool verifyVPlanIsValid(const VPlan &Plan, bool VerifyLate=false)
Verify invariants for general VPlans.
@ DataAndControlFlowWithoutRuntimeCheck
Use predicate to control both data and control flow, but modify the trip count so that a runtime over...
std::unique_ptr< VPlan > VPlanPtr
Definition VPlan.h:77
A range of powers-of-2 vectorization factors with fixed start and adjustable end.
Struct to hold various analysis needed for cost computations.
static void materializeBroadcasts(VPlan &Plan)
Add explicit broadcasts for live-ins and VPValues defined in Plan's entry block if they are used as v...
static void materializeBackedgeTakenCount(VPlan &Plan, VPBasicBlock *VectorPH)
Materialize the backedge-taken count to be computed explicitly using VPInstructions.
static LLVM_ABI_FOR_TEST std::unique_ptr< VPlan > buildVPlan0(Loop *TheLoop, LoopInfo &LI, Type *InductionTy, DebugLoc IVDL, PredicatedScalarEvolution &PSE)
Create a base VPlan0, serving as the common starting point for all later candidates.
static void optimizeInductionExitUsers(VPlan &Plan, DenseMap< VPValue *, VPValue * > &EndValues, ScalarEvolution &SE)
If there's a single exit block, optimize its phi recipes that use exiting IV values by feeding them p...
static LLVM_ABI_FOR_TEST void handleEarlyExits(VPlan &Plan, bool HasUncountableExit)
Update Plan to account for all early exits.
static void canonicalizeEVLLoops(VPlan &Plan)
Transform EVL loops to use variable-length stepping after region dissolution.
static void dropPoisonGeneratingRecipes(VPlan &Plan, const std::function< bool(BasicBlock *)> &BlockNeedsPredication)
Drop poison flags from recipes that may generate a poison value that is used after vectorization,...
static void createAndOptimizeReplicateRegions(VPlan &Plan)
Wrap predicated VPReplicateRecipes with a mask operand in an if-then region block and remove the mask...
static void createInterleaveGroups(VPlan &Plan, const SmallPtrSetImpl< const InterleaveGroup< Instruction > * > &InterleaveGroups, VPRecipeBuilder &RecipeBuilder, const bool &ScalarEpilogueAllowed)
static bool runPass(bool(*Transform)(VPlan &, ArgsTy...), VPlan &Plan, typename std::remove_reference< ArgsTy >::type &...Args)
Helper to run a VPlan transform Transform on VPlan, forwarding extra arguments to the transform.
static void addBranchWeightToMiddleTerminator(VPlan &Plan, ElementCount VF, std::optional< unsigned > VScaleForTuning)
Add branch weight metadata, if the Plan's middle block is terminated by a BranchOnCond recipe.
static void materializeBuildVectors(VPlan &Plan)
Add explicit Build[Struct]Vector recipes that combine multiple scalar values into single vectors.
static void unrollByUF(VPlan &Plan, unsigned UF)
Explicitly unroll Plan by UF.
static DenseMap< const SCEV *, Value * > expandSCEVs(VPlan &Plan, ScalarEvolution &SE)
Expand VPExpandSCEVRecipes in Plan's entry block.
static void convertToConcreteRecipes(VPlan &Plan)
Lower abstract recipes to concrete ones, that can be codegen'd.
static void runPass(void(*Fn)(VPlan &, ArgsTy...), VPlan &Plan, typename std::remove_reference< ArgsTy >::type &...Args)
Helper to run a VPlan transform Transform on VPlan, forwarding extra arguments to the transform.
static void addMinimumIterationCheck(VPlan &Plan, ElementCount VF, unsigned UF, ElementCount MinProfitableTripCount, bool RequiresScalarEpilogue, bool TailFolded, bool CheckNeededWithTailFolding, Loop *OrigLoop, const uint32_t *MinItersBypassWeights, DebugLoc DL, ScalarEvolution &SE)
static void convertToAbstractRecipes(VPlan &Plan, VPCostContext &Ctx, VFRange &Range)
This function converts initial recipes to the abstract recipes and clamps Range based on cost model f...
static void materializeConstantVectorTripCount(VPlan &Plan, ElementCount BestVF, unsigned BestUF, PredicatedScalarEvolution &PSE)
static DenseMap< VPBasicBlock *, VPValue * > introduceMasksAndLinearize(VPlan &Plan, bool FoldTail)
Predicate and linearize the control-flow in the only loop region of Plan.
static void addExplicitVectorLength(VPlan &Plan, const std::optional< unsigned > &MaxEVLSafeElements)
Add a VPEVLBasedIVPHIRecipe and related recipes to Plan and replaces all uses except the canonical IV...
static void replaceSymbolicStrides(VPlan &Plan, PredicatedScalarEvolution &PSE, const DenseMap< Value *, const SCEV * > &StridesMap)
Replace symbolic strides from StridesMap in Plan with constants when possible.
static bool handleMaxMinNumReductions(VPlan &Plan)
Check if Plan contains any FMaxNum or FMinNum reductions.
static void removeBranchOnConst(VPlan &Plan)
Remove BranchOnCond recipes with true or false conditions together with removing dead edges to their ...
static LLVM_ABI_FOR_TEST void createLoopRegions(VPlan &Plan)
Replace loops in Plan's flat CFG with VPRegionBlocks, turning Plan's flat CFG into a hierarchical CFG...
static void removeDeadRecipes(VPlan &Plan)
Remove dead recipes from Plan.
static void attachCheckBlock(VPlan &Plan, Value *Cond, BasicBlock *CheckBlock, bool AddBranchWeights)
Wrap runtime check block CheckBlock in a VPIRBB and Cond in a VPValue and connect the block to Plan,...
static void materializeVectorTripCount(VPlan &Plan, VPBasicBlock *VectorPHVPBB, bool TailByMasking, bool RequiresScalarEpilogue)
Materialize vector trip count computations to a set of VPInstructions.
static void simplifyRecipes(VPlan &Plan)
Perform instcombine-like simplifications on recipes in Plan.
static LLVM_ABI_FOR_TEST bool tryToConvertVPInstructionsToVPRecipes(VPlanPtr &Plan, function_ref< const InductionDescriptor *(PHINode *)> GetIntOrFpInductionDescriptor, const TargetLibraryInfo &TLI)
Replaces the VPInstructions in Plan with corresponding widen recipes.
static void handleUncountableEarlyExit(VPBasicBlock *EarlyExitingVPBB, VPBasicBlock *EarlyExitVPBB, VPlan &Plan, VPBasicBlock *HeaderVPBB, VPBasicBlock *LatchVPBB)
Update Plan to account for the uncountable early exit from EarlyExitingVPBB to EarlyExitVPBB by.
static void replicateByVF(VPlan &Plan, ElementCount VF)
Replace each replicating VPReplicateRecipe and VPInstruction outside of any replicate region in Plan ...
static void clearReductionWrapFlags(VPlan &Plan)
Clear NSW/NUW flags from reduction instructions if necessary.
static void cse(VPlan &Plan)
Perform common-subexpression-elimination on Plan.
static void addActiveLaneMask(VPlan &Plan, bool UseActiveLaneMaskForControlFlow, bool DataAndControlFlowWithoutRuntimeCheck)
Replace (ICMP_ULE, wide canonical IV, backedge-taken-count) checks with an (active-lane-mask recipe,...
static void optimize(VPlan &Plan)
Apply VPlan-to-VPlan optimizations to Plan, including induction recipe optimizations,...
static void dissolveLoopRegions(VPlan &Plan)
Replace loop regions with explicit CFG.
static void narrowInterleaveGroups(VPlan &Plan, ElementCount VF, unsigned VectorRegWidth)
Try to convert a plan with interleave groups with VF elements to a plan with the interleave groups re...
static void truncateToMinimalBitwidths(VPlan &Plan, const MapVector< Instruction *, uint64_t > &MinBWs)
Insert truncates and extends for any truncated recipe.
static bool adjustFixedOrderRecurrences(VPlan &Plan, VPBuilder &Builder)
Try to have all users of fixed-order recurrences appear after the recipe defining their previous valu...
static void optimizeForVFAndUF(VPlan &Plan, ElementCount BestVF, unsigned BestUF, PredicatedScalarEvolution &PSE)
Optimize Plan based on BestVF and BestUF.
static void materializeVFAndVFxUF(VPlan &Plan, VPBasicBlock *VectorPH, ElementCount VF)
Materialize VF and VFxUF to be computed explicitly using VPInstructions.
static LLVM_ABI_FOR_TEST void addMiddleCheck(VPlan &Plan, bool RequiresScalarEpilogueCheck, bool TailFolded)
If a check is needed to guard executing the scalar epilogue loop, it will be added to the middle bloc...