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());
77 for (
unsigned i = 0; ; ++i) {
78 assert(i != e &&
"Didn't find edge?");
88 bool AllowIdenticalEdges) {
89 assert(SuccNum < TI->getNumSuccessors() &&
"Illegal edge specification!");
96 assert(I != E &&
"No preds, but we have an edge to the block?");
99 if (!AllowIdenticalEdges)
126 return L1 !=
nullptr && L1 == L2;
143 if (!Visited.
insert(BB).second)
162 Outer->getExitBlocks(Worklist);
166 }
while (!Worklist.
empty());
176 "This analysis is function-local!");
179 Worklist.
push_back(const_cast<BasicBlock*>(A));
188 "This analysis is function-local!");
219 if (Worklist.empty()) {
224 Worklist.push_back(const_cast<BasicBlock*>(A->
getParent()));
233 Worklist, const_cast<BasicBlock *>(B->
getParent()), DT, LI);
void push_back(const T &Elt)
size_type count(PtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
LoopT * getParentLoop() const
const Function * getParent() const
Return the enclosing method, or null if none.
unsigned GetSuccessorNumber(BasicBlock *BB, BasicBlock *Succ)
Search for the specified successor of basic block BB and return its position in the terminator instru...
LoopT * getLoopFor(const BlockT *BB) const
getLoopFor - Return the inner most loop that BB lives in.
T LLVM_ATTRIBUTE_UNUSED_RESULT pop_back_val()
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...
bool LLVM_ATTRIBUTE_UNUSED_RESULT empty() const
bool isReachableFromEntry(const Use &U) const
Provide an overload for a Use.
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree...
Interval::succ_iterator succ_end(Interval *I)
unsigned getNumSuccessors() const
Return the number of successors that this terminator has.
static const Loop * getOutermostLoop(const LoopInfo *LI, const BasicBlock *BB)
static bool loopContainsBoth(const LoopInfo *LI, const BasicBlock *BB1, const BasicBlock *BB2)
Subclasses of this class are all able to terminate a basic block.
LLVM Basic Block Representation.
BasicBlock * getSuccessor(unsigned idx) const
Return the specified successor.
SmallSet - This maintains a set of unique values, optimizing for the case when the set is small (less...
bool succ_empty(const BasicBlock *BB)
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.
std::pair< NoneType, bool > insert(const T &V)
insert - Insert an element into the set if it isn't already there.
void append(in_iter in_start, in_iter in_end)
Add the specified range to the end of the SmallVector.
bool dominates(const Instruction *Def, const Use &U) const
Return true if Def dominates a use in User.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
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...
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...
const BasicBlock & getEntryBlock() const
TerminatorInst * getTerminator()
Returns the terminator instruction if the block is well formed or null if the block is not well forme...
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
bool isCriticalEdge(const TerminatorInst *TI, unsigned SuccNum, bool AllowIdenticalEdges=false)
Return true if the specified edge is a critical edge.