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) {
91 assert(SuccNum < TI->getNumSuccessors() &&
"Illegal edge specification!");
98 assert(I !=
E &&
"No preds, but we have an edge to the block?");
101 if (!AllowIdenticalEdges)
128 return L1 !=
nullptr && L1 == L2;
145 if (!Visited.
insert(BB).second)
164 Outer->getExitBlocks(Worklist);
168 }
while (!Worklist.
empty());
178 "This analysis is function-local!");
181 Worklist.
push_back(const_cast<BasicBlock*>(A));
190 "This analysis is function-local!");
222 if (Worklist.empty()) {
227 Worklist.push_back(const_cast<BasicBlock*>(A->
getParent()));
236 Worklist, const_cast<BasicBlock *>(B->
getParent()), DT, LI);
This class represents lattice values for constants.
BasicBlock * getSuccessor(unsigned Idx) const
Return the specified successor. This instruction must be a terminator.
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.
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...
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 bool loopContainsBoth(const LoopInfo *LI, const BasicBlock *BB1, const BasicBlock *BB2)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
LLVM Basic Block Representation.
static GCRegistry::Add< CoreCLRGC > E("coreclr", "CoreCLR-compatible GC")
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)
bool isPotentiallyReachable(const Instruction *From, const Instruction *To, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)
Determine whether instruction 'To' is reachable from 'From', returning true if uncertain.
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)
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()
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