Go to the documentation of this file.
14 #ifndef LLVM_ANALYSIS_CFG_H
15 #define LLVM_ANALYSIS_CFG_H
28 template <
typename T>
class SmallVectorImpl;
37 SmallVectorImpl<std::pair<const BasicBlock *, const BasicBlock *> > &
50 bool AllowIdenticalEdges =
false);
52 bool AllowIdenticalEdges =
false);
70 const Instruction *
From,
const Instruction *To,
71 const SmallPtrSetImpl<BasicBlock *> *ExclusionSet =
nullptr,
72 const DominatorTree *DT =
nullptr,
const LoopInfo *LI =
nullptr);
82 const SmallPtrSetImpl<BasicBlock *> *ExclusionSet =
nullptr,
83 const DominatorTree *DT =
nullptr,
const LoopInfo *LI =
nullptr);
95 SmallVectorImpl<BasicBlock *> &Worklist,
BasicBlock *StopBB,
96 const SmallPtrSetImpl<BasicBlock *> *ExclusionSet,
97 const DominatorTree *DT =
nullptr,
const LoopInfo *LI =
nullptr);
134 template <
class NodeT,
class RPOTraversalT,
class LoopInfoT,
135 class GT = GraphTraits<NodeT>>
140 auto isProperBackedge = [&](NodeT Src, NodeT Dst) {
141 for (
const auto *Lp = LI.getLoopFor(Src); Lp; Lp = Lp->getParentLoop()) {
142 if (Lp->getHeader() == Dst)
149 for (NodeT
Node : RPOTraversal) {
153 if (!Visited.
count(Succ))
158 if (!isProperBackedge(
Node, Succ))
This is an optimization pass for GlobalISel generic memory operations.
iterator_range< T > make_range(T x, T y)
Convenience function for iterating over sub-ranges.
bool isPotentiallyReachableFromMany(SmallVectorImpl< BasicBlock * > &Worklist, BasicBlock *StopBB, const SmallPtrSetImpl< BasicBlock * > *ExclusionSet, const DominatorTree *DT=nullptr, const LoopInfo *LI=nullptr)
Determine whether there is at least one path from a block in 'Worklist' to 'StopBB' without passing t...
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.
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements.
bool isCriticalEdge(const Instruction *TI, unsigned SuccNum, bool AllowIdenticalEdges=false)
Return true if the specified edge is a critical edge.
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...
@ BasicBlock
Various leaf nodes.
size_type count(ConstPtrType Ptr) const
count - Return 1 if the specified pointer is in the set, 0 otherwise.
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...
Common register allocation spilling lr str ldr sxth r3 ldr mla r4 can lr mov lr str ldr sxth r3 mla r4 and then merge mul and lr str ldr sxth r3 mla r4 It also increase the likelihood the store may become dead bb27 Successors according to LLVM BB
BlockVerifier::State From
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.