14 #ifndef LLVM_ANALYSIS_CFG_H 15 #define LLVM_ANALYSIS_CFG_H 35 SmallVectorImpl<std::pair<const BasicBlock *, const BasicBlock *> > &
48 bool AllowIdenticalEdges =
false);
50 bool AllowIdenticalEdges =
false);
68 const Instruction *
From,
const Instruction *To,
69 const SmallPtrSetImpl<BasicBlock *> *ExclusionSet =
nullptr,
70 const DominatorTree *DT =
nullptr,
const LoopInfo *LI =
nullptr);
79 const DominatorTree *DT =
nullptr,
80 const LoopInfo *LI =
nullptr);
91 const DominatorTree *DT =
nullptr,
92 const LoopInfo *LI =
nullptr);
104 SmallVectorImpl<BasicBlock *> &Worklist,
BasicBlock *StopBB,
105 const SmallPtrSetImpl<BasicBlock *> *ExclusionSet,
106 const DominatorTree *DT =
nullptr,
const LoopInfo *LI =
nullptr);
143 template <
class NodeT,
class RPOTraversalT,
class LoopInfoT,
144 class GT = GraphTraits<NodeT>>
149 auto isProperBackedge = [&](NodeT Src, NodeT Dst) {
150 for (
const auto *Lp = LI.getLoopFor(Src); Lp; Lp = Lp->getParentLoop()) {
151 if (Lp->getHeader() == Dst)
158 for (NodeT
Node : RPOTraversal) {
162 if (!Visited.
count(Succ))
167 if (!isProperBackedge(
Node, Succ))
This class represents lattice values for constants.
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...
bool containsIrreducibleCFG(RPOTraversalT &RPOTraversal, const LoopInfoT &LI)
Return true if the control flow in RPOTraversal is irreducible.
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
bool isCriticalEdge(const Instruction *TI, unsigned SuccNum, bool AllowIdenticalEdges=false)
Return true if the specified edge is a critical edge.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
BlockVerifier::State From
This file provides various utilities for inspecting and working with the control flow graph in LLVM I...
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...
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 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.