28 SmallVectorImpl<std::pair<const BasicBlock*,const BasicBlock*> > &Result) {
41 std::pair<const BasicBlock*, succ_const_iterator> &Top = VisitStack.
back();
45 bool FoundNew =
false;
48 if (Visited.
insert(BB).second) {
53 if (InStack.
count(BB))
54 Result.push_back(std::make_pair(ParentBB, BB));
65 }
while (!VisitStack.
empty());
78 for (
unsigned i = 0; ; ++i) {
79 assert(i != e &&
"Didn't find edge?");
89 bool AllowIdenticalEdges) {
90 assert(SuccNum < TI->getNumSuccessors() &&
"Illegal edge specification!");
95 bool AllowIdenticalEdges) {
100 "No edge between TI's block and Dest.");
105 assert(I !=
E &&
"No preds, but we have an edge to the block?");
108 if (!AllowIdenticalEdges)
141 if (ExclusionSet && !ExclusionSet->
empty())
148 if (LI && ExclusionSet) {
149 for (
auto BB : *ExclusionSet) {
163 if (!Visited.
insert(BB).second)
167 if (ExclusionSet && ExclusionSet->
count(BB))
172 const Loop *Outer =
nullptr;
179 if (LoopsWithHoles.
count(Outer))
181 if (StopLoop && Outer == StopLoop)
199 }
while (!Worklist.
empty());
209 "This analysis is function-local!");
212 Worklist.
push_back(const_cast<BasicBlock*>(A));
223 "This analysis is function-local!");
255 if (Worklist.empty()) {
260 Worklist.push_back(const_cast<BasicBlock*>(A->
getParent()));
267 if (!ExclusionSet || ExclusionSet->
empty()) {
278 Worklist, const_cast<BasicBlock *>(B->
getParent()), ExclusionSet, DT, LI);
This class represents lattice values for constants.
BasicBlock * getSuccessor(unsigned Idx) const
Return the specified successor. This instruction must be a terminator.
bool isPotentiallyReachable(const Instruction *From, const Instruction *To, const SmallPtrSetImpl< BasicBlock *> *ExclusionSet=nullptr, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)
Determine whether instruction 'To' is reachable from 'From', without passing through any blocks in Ex...
void push_back(const T &Elt)
bool isTerminator() const
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...
bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
A templated base class for SmallPtrSet which provides the typesafe interface that is common across al...
LoopT * getLoopFor(const BlockT *BB) const
Return the inner most loop that BB lives in.
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
Interval::succ_iterator succ_begin(Interval *I)
succ_begin/succ_end - define methods so that Intervals may be used just like BasicBlocks can with the...
void getExitBlocks(SmallVectorImpl< BlockT *> &ExitBlocks) const
Return all of the successor blocks of this loop.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
unsigned getNumSuccessors() const
Return the number of successors that this instruction has.
Interval::succ_iterator succ_end(Interval *I)
const BasicBlock & getEntryBlock() const
static const Loop * getOutermostLoop(const LoopInfo *LI, const BasicBlock *BB)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
LLVM Basic Block Representation.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
LLVM_NODISCARD bool empty() const
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
Interval::pred_iterator pred_begin(Interval *I)
pred_begin/pred_end - define methods so that Intervals may be used just like BasicBlocks can with the...
Interval::pred_iterator pred_end(Interval *I)
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
self_iterator getIterator()
bool isCriticalEdge(const Instruction *TI, unsigned SuccNum, bool AllowIdenticalEdges=false)
Return true if the specified edge is a critical edge.
bool succ_empty(const Instruction *I)
auto find(R &&Range, const T &Val) -> decltype(adl_begin(Range))
Provide wrappers to std::find which take ranges instead of having to pass begin/end explicitly...
Iterator for intrusive lists based on ilist_node.
bool erase(PtrType Ptr)
erase - If the set contains the specified pointer, remove it and return true, otherwise return false...
This is a 'vector' (really, a variable-sized array), optimized for the case when the array is small...
bool dominates(const Instruction *Def, const Use &U) const
Return true if Def dominates a use in User.
LLVM_NODISCARD T pop_back_val()
pred_range predecessors(BasicBlock *BB)
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
LoopT * getParentLoop() const
unsigned GetSuccessorNumber(const BasicBlock *BB, const BasicBlock *Succ)
Search for the specified successor of basic block BB and return its position in the terminator instru...
LLVM_NODISCARD bool empty() const
Represents a single loop in the control flow graph.
const Function * getParent() const
Return the enclosing method, or null if none.
void FindFunctionBackedges(const Function &F, SmallVectorImpl< std::pair< const BasicBlock *, const BasicBlock *> > &Result)
Analyze the specified function to find all of the loop backedges in the function and return them...
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
bool isPotentiallyReachableFromMany(SmallVectorImpl< BasicBlock *> &Worklist, BasicBlock *StopBB, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)
Determine whether there is at least one path from a block in 'Worklist' to 'StopBB', returning true if uncertain.
const BasicBlock * getParent() const