18 return all_of(Def->users(),
19 [Def](
const VPUser *U) { return U->onlyFirstLaneUsed(Def); });
23 return all_of(Def->users(),
24 [Def](
const VPUser *U) { return U->onlyFirstPartUsed(Def); });
28 return all_of(Def->users(),
29 [Def](
const VPUser *U) { return U->usesScalars(Def); });
36 if (
auto *E = dyn_cast<SCEVConstant>(Expr))
39 auto *U = dyn_cast<SCEVUnknown>(Expr);
44 if (U && !isa<Instruction>(U->getValue())) {
56 if (isa<VPActiveLaneMaskPHIRecipe>(V))
59 auto IsWideCanonicalIV = [](
VPValue *
A) {
60 return isa<VPWidenCanonicalIVRecipe>(
A) ||
61 (isa<VPWidenIntOrFpInductionRecipe>(
A) &&
62 cast<VPWidenIntOrFpInductionRecipe>(
A)->isCanonical());
66 using namespace VPlanPatternMatch;
68 if (
match(V, m_ActiveLaneMask(m_VPValue(
A), m_VPValue(
B))))
73 IsWideCanonicalIV(
A));
75 return match(V, m_Binary<Instruction::ICmp>(m_VPValue(
A), m_VPValue(
B))) &&
81 if (
Value *LiveIn = V->getLiveInIRValue())
94 using namespace VPlanPatternMatch;
100 if (R && V->isDefinedOutsideLoopRegions()) {
101 if (
match(V->getDefiningRecipe(),
102 m_VPInstruction<VPInstruction::CanonicalIVIncrementForPart>(
108 auto *CanonicalIV = R->getParent()->getPlan()->getCanonicalIV();
110 if (V == CanonicalIV || V == CanonicalIV->getBackedgeValue())
115 .Case<VPReplicateRecipe>([](
const auto *R) {
120 return R->isSingleScalar() &&
121 (isa<LoadInst, StoreInst>(R->getUnderlyingValue())) &&
124 .Case<VPInstruction>([](
const auto *VPI) {
125 return VPI->isScalarCast() &&
128 .Case<VPWidenCastRecipe>([](
const auto *R) {
143 return I == DepthFirst.end() ? nullptr : cast<VPBasicBlock>(*
I);
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static GCRegistry::Add< ErlangGC > A("erlang", "erlang-compatible garbage collector")
This file implements the TypeSwitch template, which mimics a switch() statement whose cases are type ...
This class represents an analyzed expression in the program.
The main scalar evolution driver.
LLVM_ABI const SCEV * getSCEV(Value *V)
Return a SCEV expression for the full generality of the specified expression.
LLVM_ABI const SCEV * getCouldNotCompute()
This class implements a switch-like dispatch statement for a value of 'T' using dyn_cast functionalit...
TypeSwitch< T, ResultT > & Case(CallableT &&caseFn)
Add a case on the given type.
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
void appendRecipe(VPRecipeBase *Recipe)
Augment the existing recipes of a VPBasicBlock with an additional Recipe as the last recipe.
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
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.
A recipe for converting the input value IV value to the corresponding value of an IV with different s...
Template specialization of the standard LLVM dominator tree utility for VPBlockBases.
Recipe to expand a SCEV expression.
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
VPRecipeBase * getDefiningRecipe()
Returns the recipe defining this VPValue or nullptr if it is not defined by a recipe,...
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
VPBasicBlock * getEntry()
VPValue & getVF()
Returns the VF of the vector loop region.
VPValue * getTripCount() const
The trip count of the original loop.
VPValue * getOrCreateBackedgeTakenCount()
The backedge taken count of the original loop.
void addSCEVExpansion(const SCEV *S, VPValue *V)
VPValue * getOrAddLiveIn(Value *V)
Gets the live-in VPValue for V or adds a new live-in (if none exists yet) for V.
VPCanonicalIVPHIRecipe * getCanonicalIV()
Returns the canonical induction recipe of the vector loop.
VPValue * getSCEVExpansion(const SCEV *S) const
LLVM Value Representation.
specific_intval< false > m_SpecificInt(const APInt &V)
Match a specific integer value or vector with all elements equal to the value.
bool match(Val *V, const Pattern &P)
specificval_ty m_Specific(const Value *V)
Match if we have a specific specified value.
bool isUniformAcrossVFsAndUFs(VPValue *V)
Checks if V is uniform across all VF lanes and UF parts.
VPValue * getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr)
Get or create a VPValue that corresponds to the expansion of Expr.
VPBasicBlock * getFirstLoopHeader(VPlan &Plan, VPDominatorTree &VPDT)
Returns the header block of the first, top-level loop, or null if none exist.
bool onlyFirstPartUsed(const VPValue *Def)
Returns true if only the first part of Def is used.
const SCEV * getSCEVExprForVPValue(VPValue *V, ScalarEvolution &SE)
Return the SCEV expression for V.
bool onlyFirstLaneUsed(const VPValue *Def)
Returns true if only the first lane of Def is used.
bool isHeaderMask(const VPValue *V, VPlan &Plan)
Return true if V is a header mask in Plan.
bool onlyScalarValuesUsed(const VPValue *Def)
Returns true if only scalar values of Def are used by all users.
This is an optimization pass for GlobalISel generic memory operations.
bool all_of(R &&range, UnaryPredicate P)
Provide wrappers to std::all_of which take ranges instead of having to pass begin/end explicitly.
iterator_range< df_iterator< VPBlockShallowTraversalWrapper< VPBlockBase * > > > vp_depth_first_shallow(VPBlockBase *G)
Returns an iterator range to traverse the graph starting at G in depth-first order.
auto find_if(R &&Range, UnaryPredicate P)
Provide wrappers to std::find_if which take ranges instead of having to pass begin/end explicitly.