25#define DEBUG_TYPE "vplan"
32class PlainCFGBuilder {
40 std::unique_ptr<VPlan> Plan;
61 bool isExternalDef(
Value *Val);
68 : TheLoop(Lp), LI(LI), Plan(std::make_unique<VPlan>(Lp)) {}
71 std::unique_ptr<VPlan> buildPlainCFG();
81 VPBBPreds.
push_back(getOrCreateVPBB(Pred));
86 return L && BB == L->getHeader();
90void PlainCFGBuilder::fixHeaderPhis() {
91 for (
auto *Phi : PhisToFix) {
92 assert(IRDef2VPValue.
count(Phi) &&
"Missing VPInstruction for PHINode.");
93 VPValue *VPVal = IRDef2VPValue[
Phi];
96 assert(PhiR->getNumOperands() == 0 &&
"Expected VPPhi with no operands.");
98 "Expected Phi in header block.");
100 "header phi must have exactly 2 operands");
103 getOrCreateVPOperand(
Phi->getIncomingValueForBlock(Pred)));
109VPBasicBlock *PlainCFGBuilder::getOrCreateVPBB(BasicBlock *BB) {
110 if (
auto *VPBB = BB2VPBB.lookup(BB)) {
117 LLVM_DEBUG(
dbgs() <<
"Creating VPBasicBlock for " << Name <<
"\n");
118 VPBasicBlock *VPBB = Plan->createVPBasicBlock(Name);
129bool PlainCFGBuilder::isExternalDef(
Value *Val) {
145VPValue *PlainCFGBuilder::getOrCreateVPOperand(
Value *IRVal) {
146 auto VPValIt = IRDef2VPValue.
find(IRVal);
147 if (VPValIt != IRDef2VPValue.
end())
150 return VPValIt->second;
159 assert(isExternalDef(IRVal) &&
"Expected external definition as operand.");
163 VPValue *NewVPVal = Plan->getOrAddLiveIn(IRVal);
164 IRDef2VPValue[IRVal] = NewVPVal;
171void PlainCFGBuilder::createVPInstructionsForVPBB(VPBasicBlock *VPBB,
181 "Instruction shouldn't have been visited.");
186 if (Br->isConditional()) {
187 VPValue *
Cond = getOrCreateVPOperand(Br->getCondition());
197 if (
SI->getNumCases() == 0)
200 for (
auto Case :
SI->cases())
201 Ops.push_back(getOrCreateVPOperand(Case.getCaseValue()));
206 VPSingleDefRecipe *NewR;
216 PhisToFix.push_back(Phi);
220 DenseMap<const VPBasicBlock *, VPValue *> VPPredToIncomingValue;
221 for (
unsigned I = 0;
I !=
Phi->getNumOperands(); ++
I) {
222 VPPredToIncomingValue[BB2VPBB[
Phi->getIncomingBlock(
I)]] =
223 getOrCreateVPOperand(
Phi->getIncomingValue(
I));
227 VPPredToIncomingValue.
lookup(Pred->getExitingBasicBlock()));
242 IRDef2VPValue[Inst] = NewR;
247std::unique_ptr<VPlan> PlainCFGBuilder::buildPlainCFG() {
250 for (VPIRBasicBlock *ExitVPBB : Plan->getExitBlocks())
251 BB2VPBB[ExitVPBB->getIRBasicBlock()] = ExitVPBB;
264 "Unexpected loop preheader");
265 for (
auto &
I : *ThePreheaderBB) {
266 if (
I.getType()->isVoidTy())
268 IRDef2VPValue[&
I] = Plan->getOrAddLiveIn(&
I);
271 LoopBlocksRPO RPO(TheLoop);
274 for (BasicBlock *BB : RPO) {
276 VPBasicBlock *VPBB = getOrCreateVPBB(BB);
278 setVPBBPredsFromBB(VPBB, BB);
281 createVPInstructionsForVPBB(VPBB, BB);
288 getOrCreateVPBB(
SI->getDefaultDest())};
289 for (
auto Case :
SI->cases())
290 Succs.
push_back(getOrCreateVPBB(Case.getCaseSuccessor()));
300 assert(BI->isConditional() && NumSuccs == 2 && BI->isConditional() &&
301 "block must have conditional branch with 2 successors");
305 VPBasicBlock *Successor0 = getOrCreateVPBB(IRSucc0);
306 VPBasicBlock *Successor1 = getOrCreateVPBB(IRSucc1);
310 for (
auto *EB : Plan->getExitBlocks())
311 setVPBBPredsFromBB(EB, EB->getIRBasicBlock());
318 Plan->getEntry()->setOneSuccessor(getOrCreateVPBB(TheLoop->
getHeader()));
319 Plan->getEntry()->setPlan(&*Plan);
326 for (
auto *EB : Plan->getExitBlocks()) {
327 for (VPRecipeBase &R : EB->phis()) {
329 PHINode &
Phi = PhiR->getIRPhi();
330 assert(PhiR->getNumOperands() == 0 &&
331 "no phi operands should be added yet");
332 for (BasicBlock *Pred :
predecessors(EB->getIRBasicBlock()))
334 getOrCreateVPOperand(
Phi.getIncomingValueForBlock(Pred)));
339 return std::move(Plan);
352 if (Preds.
size() != 2)
355 auto *PreheaderVPBB = Preds[0];
356 auto *LatchVPBB = Preds[1];
357 if (!VPDT.
dominates(PreheaderVPBB, HeaderVPB) ||
361 if (!VPDT.
dominates(PreheaderVPBB, HeaderVPB) ||
378 if (LatchVPBB->getSingleSuccessor() ||
379 LatchVPBB->getSuccessors()[0] != HeaderVPB)
382 assert(LatchVPBB->getNumSuccessors() == 2 &&
"Must have 2 successors");
386 "terminator must be a BranchOnCond");
388 Not->insertBefore(Term);
389 Term->setOperand(0, Not);
390 LatchVPBB->swapSuccessors();
403 assert(LatchExitVPB &&
"Latch expected to be left with a single successor");
413 R->setEntry(HeaderVPB);
414 R->setExiting(LatchVPBB);
426 Value *StartIdx = ConstantInt::get(IdxTy, 0);
431 HeaderVPBB->
insert(CanonicalIVPHI, HeaderVPBB->
begin());
436 if (!LatchVPBB->
empty() &&
446 auto *CanonicalIVIncrement = Builder.createOverflowingOp(
447 Instruction::Add, {CanonicalIVPHI, &Plan.
getVFxUF()}, {
true,
false},
DL,
449 CanonicalIVPHI->addOperand(CanonicalIVIncrement);
462 if (EB->getSinglePredecessor() != MiddleVPBB)
467 for (
unsigned Idx = 0; Idx != ExitIRI->getNumIncoming(); ++Idx) {
468 VPRecipeBase *Inc = ExitIRI->getIncomingValue(Idx)->getDefiningRecipe();
471 assert(ExitIRI->getNumOperands() == 1 &&
472 ExitIRI->getParent()->getSinglePredecessor() == MiddleVPBB &&
473 "exit values from early exits must be fixed when branch to "
474 "early-exit is added");
475 ExitIRI->extractLastLaneOfFirstOperand(
B);
498 if (LatchVPBB->getNumSuccessors() == 2) {
503 LatchVPBB->swapSuccessors();
513 "Invalid backedge-taken count");
516 InductionTy, TheLoop);
534std::unique_ptr<VPlan>
537 PlainCFGBuilder Builder(TheLoop, &LI);
538 std::unique_ptr<VPlan> VPlan0 = Builder.buildPlainCFG();
544 bool HasUncountableEarlyExit) {
555 [[maybe_unused]]
bool HandledUncountableEarlyExit =
false;
558 if (Pred == MiddleVPBB)
560 if (HasUncountableEarlyExit) {
561 assert(!HandledUncountableEarlyExit &&
562 "can handle exactly one uncountable early exit");
565 HandledUncountableEarlyExit =
true;
575 assert((!HasUncountableEarlyExit || HandledUncountableEarlyExit) &&
576 "missed an uncountable exit that must be handled");
580 bool RequiresScalarEpilogueCheck,
587 if (MiddleVPBB->getNumSuccessors() == 1) {
589 "must have ScalarPH as single successor");
593 assert(MiddleVPBB->getNumSuccessors() == 2 &&
"must have 2 successors");
611 DebugLoc LatchDL = LatchVPBB->getTerminator()->getDebugLoc();
614 if (!RequiresScalarEpilogueCheck)
633 TopRegion->
setName(
"vector loop");
643 bool AddBranchWeights) {
659 "must have incoming values for all operands");
660 R.addOperand(R.getOperand(NumPredecessors - 2));
667 if (AddBranchWeights) {
671 Term->addMetadata(LLVMContext::MD_prof, BranchWeights);
677 ElementCount MinProfitableTripCount,
bool RequiresScalarEpilogue,
678 bool TailFolded,
bool CheckNeededWithTailFolding,
Loop *OrigLoop,
691 auto GetMinTripCount = [&]() ->
const SCEV * {
700 const SCEV *MinProfitableTripCountSCEV =
702 return SE.
getUMaxExpr(MinProfitableTripCountSCEV, VFxUF);
708 const SCEV *Step = GetMinTripCount();
710 if (CheckNeededWithTailFolding) {
718 VPValue *DistanceToMax = Builder.createNaryOp(
719 Instruction::Sub, {MaxUIntTripCount, TripCountVPV},
726 Builder.createExpandSCEV(Step),
DL);
739 TripCountCheck = Plan.
getTrue();
744 VPValue *MinTripCountVPV = Builder.createExpandSCEV(Step);
745 TripCountCheck = Builder.createICmp(
746 CmpPred, TripCountVPV, MinTripCountVPV,
DL,
"min.iters.check");
755 Term->addMetadata(LLVMContext::MD_prof, BranchWeights);
762 RedPhiR->getBackedgeValue()->getDefiningRecipe());
779 ->getIntrinsicID() == RdxIntrinsicId)) &&
780 "Intrinsic did not match recurrence kind");
783 if (MinMaxR->getOperand(0) == RedPhiR)
784 return MinMaxR->getOperand(1);
786 assert(MinMaxR->getOperand(1) == RedPhiR &&
787 "Reduction phi operand expected");
788 return MinMaxR->getOperand(0);
793 bool HasUnsupportedPhi =
false;
800 HasUnsupportedPhi =
true;
809 HasUnsupportedPhi =
true;
824 VPValue *MinMaxOp = GetMinMaxCompareValue(RedPhiR);
830 "unsupported reduction");
842 for (
auto &R : *VPBB) {
843 if (R.mayWriteToMemory() &&
853 "Unexpected terminator");
854 auto *IsLatchExitTaken =
856 LatchExitingBranch->getOperand(1));
861 Builder.createNaryOp(Instruction::Or, {AnyNaN, IsLatchExitTaken});
863 LatchExitingBranch->eraseFromParent();
869 auto *VPI = dyn_cast<VPInstruction>(U);
870 if (VPI && VPI->getOpcode() == VPInstruction::ComputeReductionResult)
876 Builder.setInsertPoint(MiddleVPBB, MiddleVPBB->begin());
878 Builder.createSelect(AnyNaN, RedPhiR, RdxResult->
getOperand(1));
879 RdxResult->setOperand(1, NewSel);
885 for (
auto &R : ScalarPH->phis()) {
887 VPValue *VecV = ResumeR->getOperand(0);
888 if (VecV == RdxResult)
891 if (DerivedIV->getNumUsers() == 1 &&
893 auto *NewSel = Builder.createSelect(AnyNaN, Plan.
getCanonicalIV(),
895 DerivedIV->moveAfter(&*Builder.getInsertPoint());
896 DerivedIV->setOperand(1, NewSel);
903 LLVM_DEBUG(
dbgs() <<
"Found resume phi we cannot update for VPlan with "
904 "FMaxNum/FMinNum reduction.\n");
907 auto *NewSel = Builder.createSelect(AnyNaN, Plan.
getCanonicalIV(), VecV);
908 ResumeR->setOperand(0, NewSel);
912 Builder.setInsertPoint(MiddleTerm);
913 VPValue *MiddleCond = MiddleTerm->getOperand(0);
914 VPValue *NewCond = Builder.createAnd(MiddleCond, Builder.createNot(AnyNaN));
915 MiddleTerm->setOperand(0, NewCond);
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
MachineBasicBlock MachineBasicBlock::iterator DebugLoc DL
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
static std::pair< Value *, APInt > getMask(Value *WideMask, unsigned Factor, ElementCount LeafValueEC)
const AbstractManglingParser< Derived, Alloc >::OperatorInfo AbstractManglingParser< Derived, Alloc >::Ops[]
This file provides a LoopVectorizationPlanner class.
static constexpr uint32_t MinItersBypassWeights[]
static DebugLoc getDebugLoc(MachineBasicBlock::instr_iterator FirstMI, MachineBasicBlock::instr_iterator LastMI)
Return the first found DebugLoc that has a DILocation, given a range of instructions.
const SmallVectorImpl< MachineOperand > & Cond
static void createLoopRegion(VPlan &Plan, VPBlockBase *HeaderVPB)
Create a new VPRegionBlock for the loop starting at HeaderVPB.
static bool isHeaderBB(BasicBlock *BB, Loop *L)
static void addInitialSkeleton(VPlan &Plan, Type *InductionTy, DebugLoc IVDL, PredicatedScalarEvolution &PSE, Loop *TheLoop)
static void addCanonicalIVRecipes(VPlan &Plan, VPBasicBlock *HeaderVPBB, VPBasicBlock *LatchVPBB, Type *IdxTy, DebugLoc DL)
static bool canonicalHeaderAndLatch(VPBlockBase *HeaderVPB, const VPDominatorTree &VPDT)
Checks if HeaderVPB is a loop header block in the plain CFG; that is, it has exactly 2 predecessors (...
static constexpr uint32_t CheckBypassWeights[]
static void createExtractsForLiveOuts(VPlan &Plan, VPBasicBlock *MiddleVPBB)
Creates extracts for values in Plan defined in a loop region and used outside a loop region.
This file implements dominator tree analysis for a single level of a VPlan's H-CFG.
static std::optional< unsigned > getOpcode(ArrayRef< VPValue * > Values)
Returns the opcode of Values or ~0 if they do not all agree.
This file contains the declarations of the Vectorization Plan base classes:
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory),...
size_t size() const
size - Get the array size.
LLVM Basic Block Representation.
LLVM_ABI iterator_range< filter_iterator< BasicBlock::const_iterator, std::function< bool(const Instruction &)> > > instructionsWithoutDebug(bool SkipPseudoOp=true) const
Return a const iterator range over the instructions in the block, skipping any debug instructions.
LLVM_ABI const BasicBlock * getSingleSuccessor() const
Return the successor of this block if it has a single successor.
const Instruction * getTerminator() const LLVM_READONLY
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
Predicate
This enumeration lists the possible predicates for CmpInst subclasses.
@ ICMP_ULT
unsigned less than
@ ICMP_ULE
unsigned less or equal
@ FCMP_UNO
1 0 0 0 True if unordered: isnan(X) | isnan(Y)
Predicate getInversePredicate() const
For example, EQ -> NE, UGT -> ULE, SLT -> SGE, OEQ -> UNE, UGT -> OLE, OLT -> UGE,...
static LLVM_ABI ConstantInt * getTrue(LLVMContext &Context)
static DebugLoc getUnknown()
ValueT lookup(const_arg_type_t< KeyT > Val) const
lookup - Return the entry for the specified key, or a default constructed value if no such entry exis...
iterator find(const_arg_type_t< KeyT > Val)
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
bool dominates(const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const
dominates - Returns true iff A dominates B.
void recalculate(ParentType &Func)
recalculate - compute a dominator tree for the given function
LLVM_ABI unsigned getNumSuccessors() const LLVM_READONLY
Return the number of successors that this instruction has.
unsigned getOpcode() const
Returns a member of one of the enums like Instruction::Add.
bool contains(const LoopT *L) const
Return true if the specified loop is contained within in this loop.
BlockT * getHeader() const
BlockT * getLoopPreheader() const
If there is a preheader for this loop, return it.
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
Represents a single loop in the control flow graph.
LLVM_ABI MDNode * createBranchWeights(uint32_t TrueWeight, uint32_t FalseWeight, bool IsExpected=false)
Return metadata containing two branch weights.
An interface layer with SCEV used to manage how we see SCEV expressions for values in the context of ...
ScalarEvolution * getSE() const
Returns the ScalarEvolution analysis used.
LLVM_ABI const SCEV * getSymbolicMaxBackedgeTakenCount()
Get the (predicated) symbolic max backedge count for the analyzed loop.
This class represents an analyzed expression in the program.
LLVM_ABI Type * getType() const
Return the LLVM type of this SCEV expression.
The main scalar evolution driver.
LLVM_ABI const SCEV * getUMaxExpr(const SCEV *LHS, const SCEV *RHS)
LLVM_ABI const SCEV * getTripCountFromExitCount(const SCEV *ExitCount)
A version of getTripCountFromExitCount below which always picks an evaluation type which can not resu...
LLVM_ABI const SCEV * getElementCount(Type *Ty, ElementCount EC, SCEV::NoWrapFlags Flags=SCEV::FlagAnyWrap)
LLVM_ABI const SCEV * applyLoopGuards(const SCEV *Expr, const Loop *L)
Try to apply information from loop guards for L to Expr.
LLVM_ABI bool isKnownPredicate(CmpPredicate Pred, const SCEV *LHS, const SCEV *RHS)
Test if the given expression is known to satisfy the condition described by Pred, LHS,...
void push_back(const T &Elt)
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small.
The instances of the Type class are immutable: once they are created, they are never changed.
static LLVM_ABI IntegerType * getInt1Ty(LLVMContext &C)
VPBasicBlock serves as the leaf of the Hierarchical Control-Flow Graph.
iterator begin()
Recipe iterator methods.
iterator_range< iterator > phis()
Returns an iterator range over the PHI-like recipes in the block.
iterator getFirstNonPhi()
Return the position of the first non-phi node recipe in the block.
VPRecipeBase * getTerminator()
If the block has multiple successors, return the branch recipe terminating the block.
const VPRecipeBase & back() const
void insert(VPRecipeBase *Recipe, iterator InsertPt)
VPBlockBase is the building block of the Hierarchical Control-Flow Graph.
void setSuccessors(ArrayRef< VPBlockBase * > NewSuccs)
Set each VPBasicBlock in NewSuccss as successor of this VPBlockBase.
const VPBasicBlock * getExitingBasicBlock() const
void setName(const Twine &newName)
void swapSuccessors()
Swap successors of the block. The block must have exactly 2 successors.
size_t getNumPredecessors() const
void setPredecessors(ArrayRef< VPBlockBase * > NewPreds)
Set each VPBasicBlock in NewPreds as predecessor of this VPBlockBase.
const VPBlocksTy & getPredecessors() const
void setTwoSuccessors(VPBlockBase *IfTrue, VPBlockBase *IfFalse)
Set two given VPBlockBases IfTrue and IfFalse to be the two successors of this VPBlockBase.
VPBlockBase * getSinglePredecessor() const
void swapPredecessors()
Swap predecessors of the block.
const VPBasicBlock * getEntryBasicBlock() const
void setOneSuccessor(VPBlockBase *Successor)
Set a given VPBlockBase Successor as the single successor of this VPBlockBase.
void setParent(VPRegionBlock *P)
VPBlockBase * getSingleSuccessor() const
const VPBlocksTy & getSuccessors() const
static void insertBlockAfter(VPBlockBase *NewBlock, VPBlockBase *BlockPtr)
Insert disconnected VPBlockBase NewBlock after BlockPtr.
static void insertOnEdge(VPBlockBase *From, VPBlockBase *To, VPBlockBase *BlockPtr)
Inserts BlockPtr on the edge between From and To.
static void connectBlocks(VPBlockBase *From, VPBlockBase *To, unsigned PredIdx=-1u, unsigned SuccIdx=-1u)
Connect VPBlockBases From and To bi-directionally.
static void disconnectBlocks(VPBlockBase *From, VPBlockBase *To)
Disconnect VPBlockBases From and To bi-directionally.
VPlan-based builder utility analogous to IRBuilder.
VPPhi * createScalarPhi(ArrayRef< VPValue * > IncomingValues, DebugLoc DL, const Twine &Name="")
VPInstruction * createNaryOp(unsigned Opcode, ArrayRef< VPValue * > Operands, Instruction *Inst=nullptr, const Twine &Name="")
Create an N-ary operation with Opcode, Operands and set Inst as its underlying Instruction.
void setInsertPoint(VPBasicBlock *TheBB)
This specifies that created VPInstructions should be appended to the end of the specified block.
Canonical scalar induction phi of the vector loop.
Template specialization of the standard LLVM dominator tree utility for VPBlockBases.
A special type of VPBasicBlock that wraps an existing IR basic block.
This is a concrete Recipe that models a single VPlan-level instruction.
VPRecipeBase is a base class modeling a sequence of one or more output IR instructions.
DebugLoc getDebugLoc() const
Returns the debug location of the recipe.
iplist< VPRecipeBase >::iterator eraseFromParent()
This method unlinks 'this' from the containing basic block and deletes it.
A recipe for handling reduction phis.
RecurKind getRecurrenceKind() const
Returns the recurrence kind of the reduction.
VPRegionBlock represents a collection of VPBasicBlocks and VPRegionBlocks which form a Single-Entry-S...
VPSingleDef is a base class for recipes for modeling a sequence of one or more output IR that define ...
This class augments VPValue with operands which provide the inverse def-use edges from VPValue's user...
VPValue * getOperand(unsigned N) const
void addOperand(VPValue *Operand)
void setUnderlyingValue(Value *Val)
VPlan models a candidate for vectorization, encoding various decisions take to produce efficient outp...
LLVMContext & getContext() const
VPBasicBlock * getEntry()
VPRegionBlock * createVPRegionBlock(VPBlockBase *Entry, VPBlockBase *Exiting, const std::string &Name="", bool IsReplicator=false)
Create a new VPRegionBlock with Entry, Exiting and Name.
VPValue & getVectorTripCount()
The vector trip count.
VPValue & getVFxUF()
Returns VF * UF of the vector loop region.
VPValue * getTripCount() const
The trip count of the original loop.
VPValue * getTrue()
Return a VPValue wrapping i1 true.
ArrayRef< VPIRBasicBlock * > getExitBlocks() const
Return an ArrayRef containing VPIRBasicBlocks wrapping the exit blocks of the original scalar loop.
LLVM_ABI_FOR_TEST VPRegionBlock * getVectorLoopRegion()
Returns the VPRegionBlock of the vector loop.
void setTripCount(VPValue *NewTripCount)
Set the trip count assuming it is currently null; if it is not - use resetTripCount().
VPBasicBlock * getMiddleBlock()
Returns the 'middle' block of the plan, that is the block that selects whether to execute the scalar ...
VPBasicBlock * createVPBasicBlock(const Twine &Name, VPRecipeBase *Recipe=nullptr)
Create a new VPBasicBlock with Name and containing Recipe if present.
LLVM_ABI_FOR_TEST VPIRBasicBlock * createVPIRBasicBlock(BasicBlock *IRBB)
Create a VPIRBasicBlock from IRBB containing VPIRInstructions for all instructions in IRBB,...
VPValue * getFalse()
Return a VPValue wrapping i1 false.
VPValue * getOrAddLiveIn(Value *V)
Gets the live-in VPValue for V or adds a new live-in (if none exists yet) for V.
VPBasicBlock * getScalarPreheader() const
Return the VPBasicBlock for the preheader of the scalar loop.
VPCanonicalIVPHIRecipe * getCanonicalIV()
Returns the canonical induction recipe of the vector loop.
VPIRBasicBlock * getScalarHeader() const
Return the VPIRBasicBlock wrapping the header of the scalar loop.
VPBasicBlock * getVectorPreheader()
Returns the preheader of the vector loop region, if one exists, or null otherwise.
bool hasScalarTail() const
Returns true if the scalar tail may execute after the vector loop.
LLVM Value Representation.
LLVM_ABI StringRef getName() const
Return a constant reference to the value's name.
constexpr ScalarTy getKnownMinValue() const
Returns the minimum value this quantity can represent.
@ BasicBlock
Various leaf nodes.
bool match(Val *V, const Pattern &P)
VPInstruction_match< VPInstruction::BranchOnCount, Op0_t, Op1_t > m_BranchOnCount(const Op0_t &Op0, const Op1_t &Op1)
class_match< VPValue > m_VPValue()
Match an arbitrary VPValue and ignore it.
VPInstruction_match< VPInstruction::BranchOnCond, Op0_t > m_BranchOnCond(const Op0_t &Op0)
NodeAddr< PhiNode * > Phi
friend class Instruction
Iterator for Instructions in a `BasicBlock.
VPValue * getOrCreateVPValueForSCEVExpr(VPlan &Plan, const SCEV *Expr)
Get or create a VPValue that corresponds to the expansion of Expr.
const SCEV * getSCEVExprForVPValue(VPValue *V, ScalarEvolution &SE)
Return the SCEV expression for V.
This is an optimization pass for GlobalISel generic memory operations.
FunctionAddr VTableAddr Value
decltype(auto) dyn_cast(const From &Val)
dyn_cast<X> - Return the argument parameter cast to the specified type.
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.
LLVM_ABI raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
auto succ_size(const MachineBasicBlock *BB)
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...
T * find_singleton(R &&Range, Predicate P, bool AllowRepeats=false)
Return the single value in Range that satisfies P(<member of Range> *, AllowRepeats)->T * returning n...
class LLVM_GSL_OWNER SmallVector
Forward declaration of SmallVector so that calculateSmallVectorDefaultInlinedElements can reference s...
iterator_range< po_iterator< VPBlockShallowTraversalWrapper< VPBlockBase * > > > vp_post_order_shallow(VPBlockBase *G)
Returns an iterator range to traverse the graph starting at G in post order.
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...
RecurKind
These are the kinds of recurrences that we support.
@ FMaxNum
FP max with llvm.maxnum semantics including NaNs.
@ FMinNum
FP min with llvm.minnum semantics including NaNs.
DWARFExpression::Operation Op
ArrayRef(const T &OneElt) -> ArrayRef< T >
decltype(auto) cast(const From &Val)
cast<X> - Return the argument parameter cast to the specified type.
auto predecessors(const MachineBasicBlock *BB)
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.