LLVM 23.0.0git
VPlanUtils.h
Go to the documentation of this file.
1//===- VPlanUtils.h - VPlan-related utilities -------------------*- 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
9#ifndef LLVM_TRANSFORMS_VECTORIZE_VPLANUTILS_H
10#define LLVM_TRANSFORMS_VECTORIZE_VPLANUTILS_H
11
12#include "VPlan.h"
13#include "VPlanPatternMatch.h"
15
16namespace llvm {
17class MemoryLocation;
18class ScalarEvolution;
19class SCEV;
21} // namespace llvm
22
23namespace llvm {
24
25namespace vputils {
26/// Returns true if only the first lane of \p Def is used.
27bool onlyFirstLaneUsed(const VPValue *Def);
28
29/// Returns true if only the first part of \p Def is used.
30bool onlyFirstPartUsed(const VPValue *Def);
31
32/// Returns true if only scalar values of \p Def are used by all users.
33bool onlyScalarValuesUsed(const VPValue *Def);
34
35/// Get or create a VPValue that corresponds to the expansion of \p Expr. If \p
36/// Expr is a SCEVConstant or SCEVUnknown, return a VPValue wrapping the live-in
37/// value. Otherwise return a VPExpandSCEVRecipe to expand \p Expr. If \p Plan's
38/// pre-header already contains a recipe expanding \p Expr, return it. If not,
39/// create a new one.
41
42/// Return the SCEV expression for \p V. Returns SCEVCouldNotCompute if no
43/// SCEV expression could be constructed.
44const SCEV *getSCEVExprForVPValue(const VPValue *V,
46 const Loop *L = nullptr);
47
48/// Returns true if \p Addr is an address SCEV that can be passed to
49/// TTI::getAddressComputationCost, i.e. the address SCEV is loop invariant, an
50/// affine AddRec (i.e. induction ), or an add expression of such operands or a
51/// sign-extended AddRec.
52bool isAddressSCEVForCost(const SCEV *Addr, ScalarEvolution &SE, const Loop *L);
53
54/// Returns true if \p VPV is a single scalar, either because it produces the
55/// same value for all lanes or only has its first lane used.
56bool isSingleScalar(const VPValue *VPV);
57
58/// Return true if \p V is a header mask in \p Plan.
59bool isHeaderMask(const VPValue *V, const VPlan &Plan);
60
61/// Checks if \p V is uniform across all VF lanes and UF parts. It is considered
62/// as such if it is either loop invariant (defined outside the vector region)
63/// or its operands are known to be uniform across all VFs and UFs (e.g.
64/// VPDerivedIV or the canonical IV).
66
67/// Returns the header block of the first, top-level loop, or null if none
68/// exist.
70
71/// Get the VF scaling factor applied to the recipe's output, if the recipe has
72/// one.
74
75/// Return true if we do not know how to (mechanically) hoist or sink \p R.
76/// When sinking, passing \p Sinking = true ensures that assumes aren't sunk.
77bool cannotHoistOrSinkRecipe(const VPRecipeBase &R, bool Sinking = false);
78
79/// Returns the VPValue representing the uncountable exit comparison used by
80/// AnyOf if the recipes it depends on can be traced back to live-ins and
81/// the addresses (in GEP/PtrAdd form) of any (non-masked) load used in
82/// generating the values for the comparison. The recipes are stored in
83/// \p Recipes, and recipes forming an address for a load are also added to
84/// \p GEPs.
86std::optional<VPValue *>
89 VPBasicBlock *LatchVPBB);
90
91/// Return a MemoryLocation for \p R with noalias metadata populated from
92/// \p R, if the recipe is supported and std::nullopt otherwise. The pointer of
93/// the location is conservatively set to nullptr.
94std::optional<MemoryLocation> getMemoryLocation(const VPRecipeBase &R);
95
96/// Extracts and returns NoWrap and FastMath flags from the induction binop in
97/// \p ID.
100 return ID.getInductionBinOp()->getFastMathFlags();
101
103 ID.getInductionBinOp()))
104 return VPIRFlags::WrapFlagsTy(OBO->hasNoUnsignedWrap(),
105 OBO->hasNoSignedWrap());
106
108 "Expected int induction");
109 return VPIRFlags::WrapFlagsTy(false, false);
110}
111
112/// Search \p Start's users for a recipe satisfying \p Pred, looking through
113/// recipes with definitions.
114template <typename PredT>
115inline VPRecipeBase *findRecipe(VPValue *Start, PredT Pred) {
116 SetVector<VPValue *> Worklist;
117 Worklist.insert(Start);
118 for (unsigned I = 0; I != Worklist.size(); ++I) {
119 VPValue *Cur = Worklist[I];
120 auto *R = Cur->getDefiningRecipe();
121 if (!R)
122 continue;
123 if (Pred(R))
124 return R;
125 for (VPUser *U : Cur->users()) {
126 for (VPValue *V : cast<VPRecipeBase>(U)->definedValues())
127 Worklist.insert(V);
128 }
129 }
130 return nullptr;
131}
132
133/// If \p V is used by a recipe matching pattern \p P, return it. Otherwise
134/// return nullptr;
135template <typename MatchT>
136static VPRecipeBase *findUserOf(VPValue *V, const MatchT &P) {
137 using namespace llvm::VPlanPatternMatch;
138 auto It = find_if(V->users(), match_fn(P));
139 return It == V->user_end() ? nullptr : cast<VPRecipeBase>(*It);
140}
141
142/// If \p V is used by a VPInstruction with \p Opcode, return it. Otherwise
143/// return nullptr.
144template <unsigned Opcode> static VPInstruction *findUserOf(VPValue *V) {
145 using namespace llvm::VPlanPatternMatch;
147}
148
149template <typename RecipeTy> static RecipeTy *findUserOf(VPValue *V) {
150 using namespace llvm::VPlanPatternMatch;
152}
153
154/// Find the canonical IV increment of \p Plan's vector loop region. Returns
155/// nullptr if not found.
157
158/// Returns the GEP nowrap flags for \p Ptr, looking through pointer casts
159/// mirroring Value::stripPointerCasts.
161
162/// Returns true if \p V is used as part of the address of another load or
163/// store.
164bool isUsedByLoadStoreAddress(const VPValue *V);
165
166/// Find the ComputeReductionResult recipe for \p PhiR, looking through selects
167/// inserted for predicated reductions or tail folding.
169
170/// Collect the header mask with the pattern:
171/// (ICMP_ULE, WideCanonicalIV, backedge-taken-count)
172/// TODO: Introduce explicit recipe for header-mask instead of searching
173/// the header-mask pattern manually.
175
176} // namespace vputils
177
178//===----------------------------------------------------------------------===//
179// Utilities for modifying predecessors and successors of VPlan blocks.
180//===----------------------------------------------------------------------===//
181
182/// Class that provides utilities for VPBlockBases in VPlan.
184public:
185 VPBlockUtils() = delete;
186
187 /// Insert disconnected VPBlockBase \p NewBlock after \p BlockPtr. Add \p
188 /// NewBlock as successor of \p BlockPtr and \p BlockPtr as predecessor of \p
189 /// NewBlock, and propagate \p BlockPtr parent to \p NewBlock. \p BlockPtr's
190 /// successors are moved from \p BlockPtr to \p NewBlock. \p NewBlock must
191 /// have neither successors nor predecessors.
192 static void insertBlockAfter(VPBlockBase *NewBlock, VPBlockBase *BlockPtr) {
193 assert(!NewBlock->hasSuccessors() && !NewBlock->hasPredecessors() &&
194 "Can't insert new block with predecessors or successors.");
195 NewBlock->setParent(BlockPtr->getParent());
196 transferSuccessors(BlockPtr, NewBlock);
197 connectBlocks(BlockPtr, NewBlock);
198 }
199
200 /// Insert disconnected block \p NewBlock before \p Blockptr. First
201 /// disconnects all predecessors of \p BlockPtr and connects them to \p
202 /// NewBlock. Add \p NewBlock as predecessor of \p BlockPtr and \p BlockPtr as
203 /// successor of \p NewBlock.
204 static void insertBlockBefore(VPBlockBase *NewBlock, VPBlockBase *BlockPtr) {
205 assert(!NewBlock->hasSuccessors() && !NewBlock->hasPredecessors() &&
206 "Can't insert new block with predecessors or successors.");
207 NewBlock->setParent(BlockPtr->getParent());
208 for (VPBlockBase *Pred : to_vector(BlockPtr->predecessors())) {
209 Pred->replaceSuccessor(BlockPtr, NewBlock);
210 NewBlock->appendPredecessor(Pred);
211 }
212 BlockPtr->clearPredecessors();
213 connectBlocks(NewBlock, BlockPtr);
214 }
215
216 /// Insert disconnected VPBlockBases \p IfTrue and \p IfFalse after \p
217 /// BlockPtr. Add \p IfTrue and \p IfFalse as succesors of \p BlockPtr and \p
218 /// BlockPtr as predecessor of \p IfTrue and \p IfFalse. Propagate \p BlockPtr
219 /// parent to \p IfTrue and \p IfFalse. \p BlockPtr must have no successors
220 /// and \p IfTrue and \p IfFalse must have neither successors nor
221 /// predecessors.
222 static void insertTwoBlocksAfter(VPBlockBase *IfTrue, VPBlockBase *IfFalse,
223 VPBlockBase *BlockPtr) {
224 assert(!IfTrue->hasSuccessors() && "Can't insert IfTrue with successors.");
225 assert(!IfFalse->hasSuccessors() &&
226 "Can't insert IfFalse with successors.");
227 BlockPtr->setTwoSuccessors(IfTrue, IfFalse);
228 IfTrue->setPredecessors({BlockPtr});
229 IfFalse->setPredecessors({BlockPtr});
230 IfTrue->setParent(BlockPtr->getParent());
231 IfFalse->setParent(BlockPtr->getParent());
232 }
233
234 /// Connect VPBlockBases \p From and \p To bi-directionally. If \p PredIdx is
235 /// -1, append \p From to the predecessors of \p To, otherwise set \p To's
236 /// predecessor at \p PredIdx to \p From. If \p SuccIdx is -1, append \p To to
237 /// the successors of \p From, otherwise set \p From's successor at \p SuccIdx
238 /// to \p To. Both VPBlockBases must have the same parent, which can be null.
239 /// Both VPBlockBases can be already connected to other VPBlockBases.
240 static void connectBlocks(VPBlockBase *From, VPBlockBase *To,
241 unsigned PredIdx = -1u, unsigned SuccIdx = -1u) {
242 assert((From->getParent() == To->getParent()) &&
243 "Can't connect two block with different parents");
244
245 if (SuccIdx == -1u)
246 From->appendSuccessor(To);
247 else
248 From->getSuccessors()[SuccIdx] = To;
249
250 if (PredIdx == -1u)
251 To->appendPredecessor(From);
252 else
253 To->getPredecessors()[PredIdx] = From;
254 }
255
256 /// Disconnect VPBlockBases \p From and \p To bi-directionally. Remove \p To
257 /// from the successors of \p From and \p From from the predecessors of \p To.
258 static void disconnectBlocks(VPBlockBase *From, VPBlockBase *To) {
259 assert(To && "Successor to disconnect is null.");
260 From->removeSuccessor(To);
261 To->removePredecessor(From);
262 }
263
264 /// Reassociate all the blocks connected to \p Old so that they now point to
265 /// \p New.
266 static void reassociateBlocks(VPBlockBase *Old, VPBlockBase *New) {
267 for (auto *Pred : to_vector(Old->getPredecessors()))
268 Pred->replaceSuccessor(Old, New);
269 for (auto *Succ : to_vector(Old->getSuccessors()))
270 Succ->replacePredecessor(Old, New);
271 New->setPredecessors(Old->getPredecessors());
272 New->setSuccessors(Old->getSuccessors());
273 Old->clearPredecessors();
274 Old->clearSuccessors();
275 }
276
277 /// Transfer successors from \p Old to \p New. \p New must have no successors.
279 for (auto *Succ : Old->getSuccessors())
280 Succ->replacePredecessor(Old, New);
281 New->setSuccessors(Old->getSuccessors());
282 Old->clearSuccessors();
283 }
284
285 /// Clone the CFG for all nodes reachable from \p Entry, including cloning
286 /// the blocks and their recipes. Operands of cloned recipes will NOT be
287 /// updated. Remapping of operands must be done separately. Returns a pair
288 /// with the new entry and exiting blocks of the cloned region. If \p Entry
289 /// isn't part of a region, return nullptr for the exiting block.
290 static std::pair<VPBlockBase *, VPBlockBase *> cloneFrom(VPBlockBase *Entry);
291
292 /// Return an iterator range over \p Range which only includes \p BlockTy
293 /// blocks. The accesses are casted to \p BlockTy.
294 template <typename BlockTy, typename T> static auto blocksOnly(T &&Range) {
295 // Create BaseTy with correct const-ness based on BlockTy.
296 using BaseTy = std::conditional_t<std::is_const<BlockTy>::value,
297 const VPBlockBase, VPBlockBase>;
298
299 // We need to first create an iterator range over (const) BlocktTy & instead
300 // of (const) BlockTy * for filter_range to work properly.
301 auto Mapped =
302 map_range(Range, [](BaseTy *Block) -> BaseTy & { return *Block; });
304 Mapped, [](BaseTy &Block) { return isa<BlockTy>(&Block); });
305 return map_range(Filter, [](BaseTy &Block) -> BlockTy * {
306 return cast<BlockTy>(&Block);
307 });
308 }
309
310 /// Returns the blocks between \p FirstBB and \p LastBB, where FirstBB
311 /// to LastBB forms a single-sucessor chain.
314 VPBasicBlock *LastBB);
315
316 /// Inserts \p BlockPtr on the edge between \p From and \p To. That is, update
317 /// \p From's successor to \p To to point to \p BlockPtr and \p To's
318 /// predecessor from \p From to \p BlockPtr. \p From and \p To are added to \p
319 /// BlockPtr's predecessors and successors respectively. There must be a
320 /// single edge between \p From and \p To.
321 static void insertOnEdge(VPBlockBase *From, VPBlockBase *To,
322 VPBlockBase *BlockPtr) {
323 unsigned SuccIdx = From->getIndexForSuccessor(To);
324 unsigned PredIx = To->getIndexForPredecessor(From);
325 VPBlockUtils::connectBlocks(From, BlockPtr, -1, SuccIdx);
326 VPBlockUtils::connectBlocks(BlockPtr, To, PredIx, -1);
327 }
328
329 /// Returns true if \p VPB is a loop header, based on regions or \p VPDT in
330 /// their absence.
331 static bool isHeader(const VPBlockBase *VPB, const VPDominatorTree &VPDT);
332
333 /// Returns true if \p VPB is a loop latch, using isHeader().
334 static bool isLatch(const VPBlockBase *VPB, const VPDominatorTree &VPDT);
335};
336
337} // namespace llvm
338
339#endif
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
#define LLVM_ABI_FOR_TEST
Definition Compiler.h:218
std::pair< BasicBlock *, unsigned > BlockTy
A pair of (basic block, score).
#define I(x, y, z)
Definition MD5.cpp:57
#define T
ConstantRange Range(APInt(BitWidth, Low), APInt(BitWidth, High))
#define P(N)
This file contains the declarations of the Vectorization Plan base classes:
Represents flags for the getelementptr instruction/expression.
A struct for saving information about induction variables.
@ IK_FpInduction
Floating point induction variable.
@ IK_IntInduction
Integer induction variable. Step = C.
Represents a single loop in the control flow graph.
Definition LoopInfo.h:40
Representation for a specific memory location.
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
This class represents an analyzed expression in the program.
The main scalar evolution driver.
A vector that has set insertion semantics.
Definition SetVector.h:57
size_type size() const
Determine the number of elements in the SetVector.
Definition SetVector.h:103
bool insert(const value_type &X)
Insert a new element into the SetVector.
Definition SetVector.h:151
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
Definition VPlan.h:4146
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
Definition VPlan.h:97
VPRegionBlock * getParent()
Definition VPlan.h:189
iterator_range< VPBlockBase ** > predecessors()
Definition VPlan.h:223
bool hasPredecessors() const
Returns true if this block has any predecessors.
Definition VPlan.h:220
unsigned getIndexForSuccessor(const VPBlockBase *Succ) const
Returns the index for Succ in the blocks successor list.
Definition VPlan.h:353
void setPredecessors(ArrayRef< VPBlockBase * > NewPreds)
Set each VPBasicBlock in NewPreds as predecessor of this VPBlockBase.
Definition VPlan.h:309
unsigned getIndexForPredecessor(const VPBlockBase *Pred) const
Returns the index for Pred in the blocks predecessors list.
Definition VPlan.h:346
bool hasSuccessors() const
Returns true if this block has any successors.
Definition VPlan.h:218
const VPBlocksTy & getPredecessors() const
Definition VPlan.h:225
void clearSuccessors()
Remove all the successors of this block.
Definition VPlan.h:328
void setTwoSuccessors(VPBlockBase *IfTrue, VPBlockBase *IfFalse)
Set two given VPBlockBases IfTrue and IfFalse to be the two successors of this VPBlockBase.
Definition VPlan.h:300
void clearPredecessors()
Remove all the predecessor of this block.
Definition VPlan.h:325
void setParent(VPRegionBlock *P)
Definition VPlan.h:200
const VPBlocksTy & getSuccessors() const
Definition VPlan.h:214
static void insertBlockAfter(VPBlockBase *NewBlock, VPBlockBase *BlockPtr)
Insert disconnected VPBlockBase NewBlock after BlockPtr.
Definition VPlanUtils.h:192
static void insertOnEdge(VPBlockBase *From, VPBlockBase *To, VPBlockBase *BlockPtr)
Inserts BlockPtr on the edge between From and To.
Definition VPlanUtils.h:321
static bool isLatch(const VPBlockBase *VPB, const VPDominatorTree &VPDT)
Returns true if VPB is a loop latch, using isHeader().
static bool isHeader(const VPBlockBase *VPB, const VPDominatorTree &VPDT)
Returns true if VPB is a loop header, based on regions or VPDT in their absence.
static void insertTwoBlocksAfter(VPBlockBase *IfTrue, VPBlockBase *IfFalse, VPBlockBase *BlockPtr)
Insert disconnected VPBlockBases IfTrue and IfFalse after BlockPtr.
Definition VPlanUtils.h:222
static void connectBlocks(VPBlockBase *From, VPBlockBase *To, unsigned PredIdx=-1u, unsigned SuccIdx=-1u)
Connect VPBlockBases From and To bi-directionally.
Definition VPlanUtils.h:240
static void disconnectBlocks(VPBlockBase *From, VPBlockBase *To)
Disconnect VPBlockBases From and To bi-directionally.
Definition VPlanUtils.h:258
static void reassociateBlocks(VPBlockBase *Old, VPBlockBase *New)
Reassociate all the blocks connected to Old so that they now point to New.
Definition VPlanUtils.h:266
static void insertBlockBefore(VPBlockBase *NewBlock, VPBlockBase *BlockPtr)
Insert disconnected block NewBlock before Blockptr.
Definition VPlanUtils.h:204
static auto blocksOnly(T &&Range)
Return an iterator range over Range which only includes BlockTy blocks.
Definition VPlanUtils.h:294
static void transferSuccessors(VPBlockBase *Old, VPBlockBase *New)
Transfer successors from Old to New. New must have no successors.
Definition VPlanUtils.h:278
static SmallVector< VPBasicBlock * > blocksInSingleSuccessorChainBetween(VPBasicBlock *FirstBB, VPBasicBlock *LastBB)
Returns the blocks between FirstBB and LastBB, where FirstBB to LastBB forms a single-sucessor chain.
static std::pair< VPBlockBase *, VPBlockBase * > cloneFrom(VPBlockBase *Entry)
Clone the CFG for all nodes reachable from Entry, including cloning the blocks and their recipes.
Definition VPlan.cpp:679
Template specialization of the standard LLVM dominator tree utility for VPBlockBases.
Class to record and manage LLVM IR flags.
Definition VPlan.h:691
This is a concrete Recipe that models a single VPlan-level instruction.
Definition VPlan.h:1226
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
Definition VPlan.h:405
A recipe for handling reduction phis.
Definition VPlan.h:2685
VPSingleDef is a base class for recipes for modeling a sequence of one or more output IR that define ...
Definition VPlan.h:609
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
Definition VPlanValue.h:329
This is the base class of the VPlan Def/Use graph, used for modeling the data flow into,...
Definition VPlanValue.h:49
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
Definition VPlan.cpp:128
user_range users()
Definition VPlanValue.h:155
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
Definition VPlan.h:4504
unsigned ID
LLVM IR allows to use arbitrary numbers as calling convention identifiers.
Definition CallingConv.h:24
auto match_fn(const Pattern &P)
A match functor that can be used as a UnaryPredicate in functional algorithms like all_of.
match_bind< VPInstruction > m_VPInstruction(VPInstruction *&V)
Match a VPInstruction, capturing if we match.
bool isSingleScalar(const VPValue *VPV)
Returns true if VPV is a single scalar, either because it produces the same value for all lanes or on...
VPValue * getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr)
Get or create a VPValue that corresponds to the expansion of Expr.
bool cannotHoistOrSinkRecipe(const VPRecipeBase &R, bool Sinking=false)
Return true if we do not know how to (mechanically) hoist or sink R.
VPBasicBlock * getFirstLoopHeader(VPlan &Plan, VPDominatorTree &VPDT)
Returns the header block of the first, top-level loop, or null if none exist.
bool isAddressSCEVForCost(const SCEV *Addr, ScalarEvolution &SE, const Loop *L)
Returns true if Addr is an address SCEV that can be passed to TTI::getAddressComputationCost,...
bool onlyFirstPartUsed(const VPValue *Def)
Returns true if only the first part of Def is used.
VPInstruction * findComputeReductionResult(VPReductionPHIRecipe *PhiR)
Find the ComputeReductionResult recipe for PhiR, looking through selects inserted for predicated redu...
VPInstruction * findCanonicalIVIncrement(VPlan &Plan)
Find the canonical IV increment of Plan's vector loop region.
std::optional< MemoryLocation > getMemoryLocation(const VPRecipeBase &R)
Return a MemoryLocation for R with noalias metadata populated from R, if the recipe is supported and ...
bool onlyFirstLaneUsed(const VPValue *Def)
Returns true if only the first lane of Def is used.
VPIRFlags getFlagsFromIndDesc(const InductionDescriptor &ID)
Extracts and returns NoWrap and FastMath flags from the induction binop in ID.
Definition VPlanUtils.h:98
VPRecipeBase * findRecipe(VPValue *Start, PredT Pred)
Search Start's users for a recipe satisfying Pred, looking through recipes with definitions.
Definition VPlanUtils.h:115
VPSingleDefRecipe * findHeaderMask(VPlan &Plan)
Collect the header mask with the pattern: (ICMP_ULE, WideCanonicalIV, backedge-taken-count) TODO: Int...
bool onlyScalarValuesUsed(const VPValue *Def)
Returns true if only scalar values of Def are used by all users.
static VPRecipeBase * findUserOf(VPValue *V, const MatchT &P)
If V is used by a recipe matching pattern P, return it.
Definition VPlanUtils.h:136
bool isUniformAcrossVFsAndUFs(const VPValue *V)
Checks if V is uniform across all VF lanes and UF parts.
bool isUsedByLoadStoreAddress(const VPValue *V)
Returns true if V is used as part of the address of another load or store.
LLVM_ABI_FOR_TEST std::optional< VPValue * > getRecipesForUncountableExit(SmallVectorImpl< VPInstruction * > &Recipes, SmallVectorImpl< VPInstruction * > &GEPs, VPBasicBlock *LatchVPBB)
Returns the VPValue representing the uncountable exit comparison used by AnyOf if the recipes it depe...
GEPNoWrapFlags getGEPFlagsForPtr(VPValue *Ptr)
Returns the GEP nowrap flags for Ptr, looking through pointer casts mirroring Value::stripPointerCast...
const SCEV * getSCEVExprForVPValue(const VPValue *V, PredicatedScalarEvolution &PSE, const Loop *L=nullptr)
Return the SCEV expression for V.
unsigned getVFScaleFactor(VPRecipeBase *R)
Get the VF scaling factor applied to the recipe's output, if the recipe has one.
bool isHeaderMask(const VPValue *V, const VPlan &Plan)
Return true if V is a header mask in Plan.
This is an optimization pass for GlobalISel generic memory operations.
auto dyn_cast_if_present(const Y &Val)
dyn_cast_if_present<X> - Functionally identical to dyn_cast, except that a null (or none in the case ...
Definition Casting.h:732
auto cast_or_null(const Y &Val)
Definition Casting.h:714
auto map_range(ContainerTy &&C, FuncTy F)
Return a range that applies F to the elements of C.
Definition STLExtras.h:365
SmallVector< ValueTypeFromRangeType< R >, Size > to_vector(R &&Range)
Given a range of type R, iterate the entire range and return a SmallVector with elements of the vecto...
iterator_range< filter_iterator< detail::IterOfRange< RangeT >, PredicateT > > make_filter_range(RangeT &&Range, PredicateT Pred)
Convenience function that takes a range of elements and a predicate, and return a new filter_iterator...
Definition STLExtras.h:551
bool isa(const From &Val)
isa<X> - Return true if the parameter to the template is an instance of one of the template type argu...
Definition Casting.h:547
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
Definition Casting.h:559
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.
Definition STLExtras.h:1771