35 #ifndef LLVM_SUPPORT_GENERICDOMTREECONSTRUCTION_H 36 #define LLVM_SUPPORT_GENERICDOMTREECONSTRUCTION_H 47 #define DEBUG_TYPE "dom-tree-builder" 50 namespace DomTreeBuilder {
52 template <
typename DomTreeT>
54 using NodePtr =
typename DomTreeT::NodePtr;
57 using RootsT = decltype(DomTreeT::Roots);
58 static constexpr
bool IsPostDom = DomTreeT::IsPostDominator;
75 using UpdateT =
typename DomTreeT::UpdateType;
92 bool IsRecalculated =
false;
102 NumToNode = {
nullptr};
108 template <
bool Inverse>
113 auto RChildren =
reverse(children<NodePtr>(N));
114 return ResultTy(RChildren.begin(), RChildren.end());
118 auto IChildren = inverse_children<NodePtr>(
N);
119 return ResultTy(IChildren.begin(), IChildren.end());
122 using Tag = std::integral_constant<bool, Inverse>;
131 if (!BUI)
return Res;
138 auto FCIt = FutureChildren.find(N);
139 if (FCIt == FutureChildren.end())
return Res;
141 for (
auto ChildAndKind : FCIt->second) {
142 const NodePtr Child = ChildAndKind.getPointer();
146 if (UK == UpdateKind::Insert) {
150 &&
"Expected child not found in the CFG");
158 "Unexpected child found in the CFG");
170 auto InfoIt = NodeToInfo.
find(BB);
171 if (InfoIt == NodeToInfo.
end())
return nullptr;
173 return InfoIt->second.IDom;
183 assert(IDom || DT.DomTreeNodes[
nullptr]);
188 return (DT.DomTreeNodes[BB] = IDomNode->
addChild(
205 BP.
N->printAsOperand(O,
false);
218 template <
bool IsReverse = false,
typename DescendCondition>
220 unsigned AttachToNum) {
223 if (NodeToInfo.
count(V) != 0) NodeToInfo[V].
Parent = AttachToNum;
225 while (!WorkList.
empty()) {
227 auto &BBInfo = NodeToInfo[BB];
230 if (BBInfo.DFSNum != 0)
continue;
231 BBInfo.DFSNum = BBInfo.Semi = ++LastNum;
233 NumToNode.push_back(BB);
238 const auto SIT = NodeToInfo.
find(Succ);
241 if (SIT != NodeToInfo.
end() && SIT->second.DFSNum != 0) {
242 if (Succ != BB) SIT->second.ReverseChildren.push_back(BB);
246 if (!Condition(BB, Succ))
continue;
250 auto &SuccInfo = NodeToInfo[Succ];
252 SuccInfo.Parent = LastNum;
253 SuccInfo.ReverseChildren.push_back(BB);
275 InfoRec *VInfo = &NodeToInfo[V];
276 if (VInfo->
Parent < LastLinked)
283 VInfo = &NodeToInfo[NumToNode[VInfo->
Parent]];
284 }
while (VInfo->
Parent >= LastLinked);
294 if (PLabelInfo->
Semi < VLabelInfo->
Semi)
297 PLabelInfo = VLabelInfo;
299 }
while (!Stack.
empty());
305 const unsigned NextDFSNum(NumToNode.size());
307 for (
unsigned i = 1; i < NextDFSNum; ++i) {
308 const NodePtr V = NumToNode[i];
309 auto &VInfo = NodeToInfo[V];
310 VInfo.IDom = NumToNode[VInfo.Parent];
315 for (
unsigned i = NextDFSNum - 1; i >= 2; --i) {
317 auto &WInfo = NodeToInfo[
W];
320 WInfo.Semi = WInfo.Parent;
321 for (
const auto &
N : WInfo.ReverseChildren) {
322 if (NodeToInfo.
count(
N) == 0)
327 if (TN && TN->
getLevel() < MinLevel)
330 unsigned SemiU = NodeToInfo[
eval(
N, i + 1, EvalStack)].Semi;
331 if (SemiU < WInfo.Semi) WInfo.Semi = SemiU;
339 for (
unsigned i = 2; i < NextDFSNum; ++i) {
341 auto &WInfo = NodeToInfo[
W];
342 const unsigned SDomNum = NodeToInfo[NumToNode[WInfo.Semi]].DFSNum;
343 NodePtr WIDomCandidate = WInfo.IDom;
344 while (NodeToInfo[WIDomCandidate].
DFSNum > SDomNum)
345 WIDomCandidate = NodeToInfo[WIDomCandidate].IDom;
347 WInfo.IDom = WIDomCandidate;
357 assert(IsPostDom &&
"Only postdominators have a virtual root");
358 assert(NumToNode.size() == 1 &&
"SNCAInfo must be freshly constructed");
360 auto &BBInfo = NodeToInfo[
nullptr];
361 BBInfo.DFSNum = BBInfo.Semi = 1;
362 BBInfo.Label =
nullptr;
364 NumToNode.push_back(
nullptr);
371 assert(N &&
"N must be a valid node");
376 assert(DT.Parent &&
"Parent not set");
384 assert(DT.Parent &&
"Parent pointer is not set");
396 SNCA.addVirtualRoot();
428 bool HasNonTrivialRoots =
false;
431 if (Total + 1 != Num) {
432 HasNonTrivialRoots =
true;
442 if (SNCA.NodeToInfo.count(
I) == 0) {
457 const unsigned NewNum = SNCA.runDFS<
true>(
I, Num,
AlwaysDescend, Num);
458 const NodePtr FurthestAway = SNCA.NumToNode[NewNum];
460 <<
"(non-trivial root): " 462 ConnectToExitBlock.
insert(FurthestAway);
463 Roots.push_back(FurthestAway);
464 LLVM_DEBUG(
dbgs() <<
"\t\t\tPrev DFSNum: " << Num <<
", new DFSNum: " 465 << NewNum <<
"\n\t\t\tRemoving DFS info\n");
466 for (
unsigned i = NewNum; i > Num; --i) {
467 const NodePtr N = SNCA.NumToNode[i];
470 SNCA.NodeToInfo.erase(N);
471 SNCA.NumToNode.pop_back();
473 const unsigned PrevNum = Num;
475 Num = SNCA.runDFS(FurthestAway, Num, AlwaysDescend, 1);
476 for (
unsigned i = PrevNum + 1; i <= Num; ++i)
483 LLVM_DEBUG(
dbgs() <<
"Total: " << Total <<
", Num: " << Num <<
"\n");
488 assert((Total + 1 == Num) &&
"Everything should have been visited");
512 assert(IsPostDom &&
"This function is for postdominators only");
517 for (
unsigned i = 0; i < Roots.size(); ++i) {
518 auto &Root = Roots[i];
522 <<
" remains a root\n");
525 const unsigned Num = SNCA.runDFS<
true>(Root, 0,
AlwaysDescend, 0);
528 for (
unsigned x = 2; x <= Num; ++x) {
529 const NodePtr N = SNCA.NumToNode[x];
549 template <
typename DescendCondition>
552 assert(DT.Roots.size() == 1 &&
"Dominators should have a singe root");
553 runDFS(DT.Roots[0], 0, DC, 0);
559 for (
const NodePtr Root : DT.Roots) Num =
runDFS(Root, Num, DC, 0);
578 dbgs() <<
"DomTree recalculated, skipping future batch updates\n");
581 if (DT.Roots.empty())
return;
586 NodePtr Root = IsPostDom ? nullptr : DT.Roots[0];
588 DT.RootNode = (DT.DomTreeNodes[Root] =
589 std::make_unique<DomTreeNodeBase<NodeT>>(Root,
nullptr))
591 SNCA.attachNewSubtree(DT, DT.RootNode);
596 NodeToInfo[NumToNode[1]].IDom = AttachTo->
getBlock();
598 for (
size_t i = 1,
e = NumToNode.size(); i !=
e; ++i) {
604 if (DT.DomTreeNodes[W])
continue;
619 NodeToInfo[NumToNode[1]].IDom = AttachTo->
getBlock();
620 for (
size_t i = 1,
e = NumToNode.size(); i !=
e; ++i) {
639 std::priority_queue<TreeNodePtr, SmallVector<TreeNodePtr, 8>,
651 assert((From || IsPostDom) &&
652 "From has to be a valid CFG node or a virtual root");
653 assert(To &&
"Cannot be a nullptr");
660 if (!IsPostDom)
return;
668 DT.Roots.push_back(From);
671 DT.DFSInfoValid =
false;
685 assert(IsPostDom &&
"This function is only for postdominators");
688 if (!DT.isVirtualRoot(To->
getIDom()))
return false;
691 if (RIt == DT.Roots.end())
695 <<
" is no longer a root\n\t\tRebuilding the tree!!!\n");
707 if (Set.count(
N) == 0)
716 assert(IsPostDom &&
"This function is only for postdominators");
733 <<
"The entire tree needs to be rebuilt\n");
753 assert(NCDBlock || DT.isPostDominator());
758 const unsigned NCDLevel = NCD->getLevel();
778 while (!II.
Bucket.empty()) {
783 const unsigned CurrentLevel = TN->
getLevel();
785 "as affected, CurrentLevel " << CurrentLevel <<
"\n");
802 "Unreachable successor found at reachable insertion");
803 const unsigned SuccLevel = SuccTN->
getLevel();
806 <<
", level = " << SuccLevel <<
"\n");
815 if (SuccLevel <= NCDLevel + 1 || !II.
Visited.insert(SuccTN).second)
818 if (SuccLevel > CurrentLevel) {
823 UnaffectedOnCurrentLevel.
push_back(SuccTN);
831 <<
" to a Bucket\n");
836 if (UnaffectedOnCurrentLevel.
empty())
861 "TN should have been updated by an affected ancestor");
884 for (
const auto &Edge : DiscoveredEdgesToReachable) {
897 &DiscoveredConnectingEdges) {
898 assert(!DT.getNode(Root) &&
"Root must not be reachable");
901 auto UnreachableDescender = [&DT, &DiscoveredConnectingEdges](
NodePtr From,
904 if (!ToTN)
return true;
906 DiscoveredConnectingEdges.push_back({
From, ToTN});
911 SNCA.runDFS(Root, 0, UnreachableDescender, 0);
913 SNCA.attachNewSubtree(DT, Incoming);
920 assert(From && To &&
"Cannot disconnect nullptrs");
928 auto IsSuccessor = [BUI](
const NodePtr SuccCandidate,
const NodePtr Of) {
930 return llvm::find(Successors, SuccCandidate) != Successors.end();
933 assert(!IsSuccessor(To, From) &&
"Deleted edge still exists in the CFG!");
944 <<
") already unreachable -- there is no edge to delete\n");
948 const NodePtr NCDBlock = DT.findNearestCommonDominator(From, To);
953 DT.DFSInfoValid =
false;
982 assert(ToIDom || DT.isPostDominator());
988 if (!PrevIDomSubTree) {
995 const unsigned Level = ToIDomTN->getLevel();
997 return DT.getNode(To)->getLevel() >
Level;
1004 SNCA.runDFS(ToIDom, 0, DescendBelow, 0);
1006 SNCA.runSemiNCA(DT, Level);
1007 SNCA.reattachExistingSubtree(DT, PrevIDomSubTree);
1019 if (!DT.getNode(Pred))
continue;
1022 DT.findNearestCommonDominator(TN->
getBlock(), Pred);
1026 <<
" is reachable from support " 1048 LLVM_DEBUG(
dbgs() <<
"\tDeletion made a region reverse-unreachable\n");
1051 DT.Roots.push_back(ToTN->
getBlock());
1061 auto DescendAndCollect = [
Level, &AffectedQueue, &DT](
NodePtr, NodePtr To) {
1065 if (
llvm::find(AffectedQueue, To) == AffectedQueue.end())
1066 AffectedQueue.push_back(To);
1072 unsigned LastDFSNum =
1073 SNCA.runDFS(ToTN->
getBlock(), 0, DescendAndCollect, 0);
1079 for (
const NodePtr
N : AffectedQueue) {
1081 const NodePtr NCDBlock =
1083 assert(NCDBlock || DT.isPostDominator());
1102 for (
unsigned i = LastDFSNum; i > 0; --i) {
1103 const NodePtr
N = SNCA.NumToNode[i];
1111 if (MinNode == ToTN)
return;
1113 LLVM_DEBUG(
dbgs() <<
"DeleteUnreachable: running DFS with MinNode = " 1115 const unsigned MinLevel = MinNode->
getLevel();
1121 auto DescendBelow = [MinLevel, &DT](
NodePtr, NodePtr To) {
1123 return ToTN && ToTN->
getLevel() > MinLevel;
1125 SNCA.runDFS(MinNode->
getBlock(), 0, DescendBelow, 0);
1131 SNCA.runSemiNCA(DT, MinLevel);
1132 SNCA.reattachExistingSubtree(DT, PrevIDom);
1144 assert(ChIt != IDom->Children.end());
1145 std::swap(*ChIt, IDom->Children.back());
1146 IDom->Children.pop_back();
1148 DT.DomTreeNodes.erase(TN->
getBlock());
1156 const size_t NumUpdates = Updates.
size();
1157 if (NumUpdates == 0)
1162 if (NumUpdates == 1) {
1163 const auto &Update = Updates.
front();
1164 if (Update.getKind() == UpdateKind::Insert)
1165 DT.insertEdge(Update.getFrom(), Update.getTo());
1167 DT.deleteEdge(Update.getFrom(), Update.getTo());
1192 LLVM_DEBUG(
dbgs() <<
"About to apply " << NumLegalized <<
" updates\n");
1193 LLVM_DEBUG(
if (NumLegalized < 32)
for (
const auto &U
1210 if (DT.DomTreeNodes.size() <= 100) {
1211 if (NumLegalized > DT.DomTreeNodes.size())
1213 }
else if (NumLegalized > DT.DomTreeNodes.size() / 40)
1238 assert(FS.back().getPointer() == CurrentUpdate.getTo() &&
1239 FS.back().getInt() == CurrentUpdate.getKind());
1244 assert(FP.back().getPointer() == CurrentUpdate.getFrom() &&
1245 FP.back().getInt() == CurrentUpdate.getKind());
1249 if (CurrentUpdate.getKind() == UpdateKind::Insert)
1250 InsertEdge(DT, &BUI, CurrentUpdate.getFrom(), CurrentUpdate.getTo());
1252 DeleteEdge(DT, &BUI, CurrentUpdate.getFrom(), CurrentUpdate.getTo());
1265 if (!DT.Parent && !DT.Roots.empty()) {
1266 errs() <<
"Tree has no parent but has roots!\n";
1272 if (DT.Roots.empty()) {
1273 errs() <<
"Tree doesn't have a root!\n";
1279 errs() <<
"Tree's root is not its parent's entry node!\n";
1287 errs() <<
"Tree has different roots than freshly computed ones!\n";
1288 errs() <<
"\tPDT roots: ";
1290 errs() <<
"\n\tComputed roots: ";
1291 for (
const NodePtr N : ComputedRoots)
1307 for (
auto &NodeToTN : DT.DomTreeNodes) {
1312 if (DT.isVirtualRoot(TN))
continue;
1314 if (NodeToInfo.
count(BB) == 0) {
1316 <<
" not found by DFS walk!\n";
1323 for (
const NodePtr N : NumToNode) {
1324 if (
N && !DT.getNode(
N)) {
1326 <<
" not found in the DomTree!\n";
1340 for (
auto &NodeToTN : DT.DomTreeNodes) {
1346 if (!IDom && TN->
getLevel() != 0) {
1348 <<
" has a nonzero level " << TN->
getLevel() <<
"!\n";
1356 << TN->
getLevel() <<
" while its IDom " 1372 if (!DT.DFSInfoValid || !DT.Parent)
1375 const NodePtr RootBB = IsPostDom ? nullptr : DT.getRoots()[0];
1378 auto PrintNodeAndDFSNums = [](
const TreeNodePtr TN) {
1380 << TN->getDFSNumOut() <<
'}';
1386 errs() <<
"DFSIn number for the tree root is not:\n\t";
1387 PrintNodeAndDFSNums(Root);
1395 for (
const auto &NodeToTN : DT.DomTreeNodes) {
1401 errs() <<
"Tree leaf should have DFSOut = DFSIn + 1:\n\t";
1402 PrintNodeAndDFSNums(Node);
1418 auto PrintChildrenError = [Node, &Children, PrintNodeAndDFSNums](
1422 errs() <<
"Incorrect DFS numbers for:\n\tParent ";
1423 PrintNodeAndDFSNums(Node);
1425 errs() <<
"\n\tChild ";
1426 PrintNodeAndDFSNums(FirstCh);
1429 errs() <<
"\n\tSecond child ";
1430 PrintNodeAndDFSNums(SecondCh);
1433 errs() <<
"\nAll children: ";
1435 PrintNodeAndDFSNums(Ch);
1443 if (Children.front()->getDFSNumIn() != Node->
getDFSNumIn() + 1) {
1444 PrintChildrenError(Children.front(),
nullptr);
1448 if (Children.back()->getDFSNumOut() + 1 != Node->
getDFSNumOut()) {
1449 PrintChildrenError(Children.back(),
nullptr);
1453 for (
size_t i = 0,
e = Children.size() - 1; i !=
e; ++i) {
1454 if (Children[i]->getDFSNumOut() + 1 != Children[i + 1]->getDFSNumIn()) {
1455 PrintChildrenError(Children[i], Children[i + 1]);
1508 for (
auto &NodeToTN : DT.DomTreeNodes) {
1517 return From != BB && To != BB;
1521 if (NodeToInfo.
count(Child->getBlock()) != 0) {
1524 <<
" is removed!\n";
1541 for (
auto &NodeToTN : DT.DomTreeNodes) {
1551 return From != BBN && To != BBN;
1555 if (S ==
N)
continue;
1557 if (NodeToInfo.
count(S->getBlock()) == 0) {
1560 <<
" is removed!\n";
1581 FreshTree.recalculate(*DT.Parent);
1582 const bool Different = DT.compare(FreshTree);
1585 errs() << (DT.isPostDominator() ?
"Post" :
"")
1586 <<
"DominatorTree is different than a freshly computed one!\n" 1589 errs() <<
"\n\tFreshly computed tree:\n";
1590 FreshTree.print(
errs());
1598 template <
class DomTreeT>
1603 template <
typename DomTreeT>
1609 cfg::LegalizeUpdates<typename DomTreeT::NodePtr>(Updates, BUI.
Updates,
1610 DomTreeT::IsPostDominator);
1622 template <
class DomTreeT>
1624 typename DomTreeT::NodePtr To) {
1625 if (DT.isPostDominator())
std::swap(From, To);
1629 template <
class DomTreeT>
1631 typename DomTreeT::NodePtr To) {
1632 if (DT.isPostDominator())
std::swap(From, To);
1636 template <
class DomTreeT>
1642 template <
class DomTreeT>
1643 bool Verify(
const DomTreeT &DT,
typename DomTreeT::VerificationLevel VL) {
1648 if (!SNCA.IsSameAsFreshTree(DT))
1652 if (!SNCA.verifyRoots(DT) || !SNCA.verifyReachability(DT) ||
1653 !SNCA.VerifyLevels(DT) || !SNCA.VerifyDFSNumbers(DT))
1659 if (!SNCA.verifyParentProperty(DT))
1662 if (!SNCA.verifySiblingProperty(DT))
const T & front() const
front - Get the first element.
NodePtr getIDom(NodePtr BB) const
static void UpdateInsertion(DomTreeT &DT, const BatchUpdatePtr BUI, const TreeNodePtr NCD, InsertionInfo &II)
raw_ostream & errs()
This returns a reference to a raw_ostream for standard error.
DenseMap< NodePtr, InfoRec > NodeToInfo
static void EraseNode(DomTreeT &DT, const TreeNodePtr TN)
This class represents lattice values for constants.
bool operator()(TreeNodePtr LHS, TreeNodePtr RHS) const
bool verifyReachability(const DomTreeT &DT)
std::error_code remove(const Twine &path, bool IgnoreNonExisting=true)
Remove path.
static void UpdateRootsAfterUpdate(DomTreeT &DT, const BatchUpdatePtr BUI)
void push_back(const T &Elt)
void doFullDFSWalk(const DomTreeT &DT, DescendCondition DC)
std::priority_queue< TreeNodePtr, SmallVector< TreeNodePtr, 8 >, Compare > Bucket
std::integral_constant< bool, Inverse > Tag
static bool isPermutation(const SmallVectorImpl< NodePtr > &A, const SmallVectorImpl< NodePtr > &B)
SmallVector< UpdateT, 4 > Updates
static bool VerifyLevels(const DomTreeT &DT)
NodeType
ISD::NodeType enum - This enum defines the target-independent operators for a SelectionDAG.
NodePtr eval(NodePtr V, unsigned LastLinked, SmallVectorImpl< InfoRec *> &Stack)
static void ApplyNextUpdate(DomTreeT &DT, BatchUpdateInfo &BUI)
decltype(DomTreeT::Roots) RootsT
void runSemiNCA(DomTreeT &DT, const unsigned MinLevel=0)
static ManagedStatic< DebugCounter > DC
static void RemoveRedundantRoots(const DomTreeT &DT, BatchUpdatePtr BUI, RootsT &Roots)
This class consists of common code factored out of the SmallVector class to reduce code duplication b...
SmallDenseSet< TreeNodePtr, 8 > Visited
bool none_of(R &&Range, UnaryPredicate P)
Provide wrappers to std::none_of which take ranges instead of having to pass begin/end explicitly...
auto reverse(ContainerTy &&C, typename std::enable_if< has_rbegin< ContainerTy >::value >::type *=nullptr) -> decltype(make_range(C.rbegin(), C.rend()))
static bool IsSameAsFreshTree(const DomTreeT &DT)
static void DeleteEdge(DomTreeT &DT, const BatchUpdatePtr BUI, const NodePtr From, const NodePtr To)
Base class for the actual dominator tree node.
ArrayRef - Represent a constant reference to an array (0 or more elements consecutively in memory)...
const std::vector< DomTreeNodeBase * > & getChildren() const
static bool HasForwardSuccessors(const NodePtr N, BatchUpdatePtr BUI)
bool verifySiblingProperty(const DomTreeT &DT)
typename DomTreeT::NodePtr NodePtr
unsigned runDFS(NodePtr V, unsigned LastNum, DescendCondition Condition, unsigned AttachToNum)
iterator find(const_arg_type_t< KeyT > Val)
typename DomTreeT::UpdateKind UpdateKind
unsigned getDFSNumIn() const
getDFSNumIn/getDFSNumOut - These return the DFS visitation order for nodes in the dominator tree...
static ResultTy Get(NodePtr N, std::integral_constant< bool, true >)
static GCRegistry::Add< OcamlGC > B("ocaml", "ocaml 3.10-compatible GC")
typename DomTreeT::UpdateType UpdateT
PointerIntPair - This class implements a pair of a pointer and small integer.
size_t size() const
size - Get the array size.
DomTreeNodeBase * getIDom() const
std::pair< iterator, bool > insert(PtrType Ptr)
Inserts Ptr if and only if there is no element in the container equal to Ptr.
static ResultTy Get(NodePtr N, BatchUpdatePtr BUI)
BlockNamePrinter(NodePtr Block)
static RootsT FindRoots(const DomTreeT &DT, BatchUpdatePtr BUI)
unsigned getDFSNumOut() const
iterator erase(const_iterator CI)
SmallVector< NodePtr, 2 > ReverseChildren
static void DeleteReachable(DomTreeT &DT, const BatchUpdatePtr BUI, const TreeNodePtr FromTN, const TreeNodePtr ToTN)
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...
static bool UpdateRootsBeforeInsertion(DomTreeT &DT, const BatchUpdatePtr BUI, const TreeNodePtr From, const TreeNodePtr To)
void sort(IteratorTy Start, IteratorTy End)
static void ApplyUpdates(DomTreeT &DT, ArrayRef< UpdateT > Updates)
bool verifyRoots(const DomTreeT &DT)
void CalculateWithUpdates(DomTreeT &DT, ArrayRef< typename DomTreeT::UpdateType > Updates)
typename DomTreeT::NodeType NodeT
bool verifyParentProperty(const DomTreeT &DT)
static void CalculateFromScratch(DomTreeT &DT, BatchUpdatePtr BUI)
static constexpr bool IsPostDom
SmallPtrSet - This class implements a set which is optimized for holding SmallSize or less elements...
BlockNamePrinter(TreeNodePtr TN)
BlockVerifier::State From
size_t getNumChildren() const
static bool HasProperSupport(DomTreeT &DT, const BatchUpdatePtr BUI, const TreeNodePtr TN)
LLVM_NODISCARD T pop_back_val()
static bool VerifyDFSNumbers(const DomTreeT &DT)
raw_ostream & dbgs()
dbgs() - This returns a reference to a raw_ostream for debugging messages.
Implements a dense probed hash-table based set with some number of buckets stored inline...
void swap(llvm::BitVector &LHS, llvm::BitVector &RHS)
Implement std::swap in terms of BitVector swap.
static void DeleteUnreachable(DomTreeT &DT, const BatchUpdatePtr BUI, const TreeNodePtr ToTN)
bool Verify(const DomTreeT &DT, typename DomTreeT::VerificationLevel VL)
static bool AlwaysDescend(NodePtr, NodePtr)
friend raw_ostream & operator<<(raw_ostream &O, const BlockNamePrinter &BP)
std::unique_ptr< DomTreeNodeBase > addChild(std::unique_ptr< DomTreeNodeBase > C)
SemiNCAInfo(BatchUpdatePtr BUI)
void Calculate(DomTreeT &DT)
iterator_range< typename GraphTraits< GraphType >::nodes_iterator > nodes(const GraphType &G)
void attachNewSubtree(DomTreeT &DT, const TreeNodePtr AttachTo)
LLVM_NODISCARD bool empty() const
void reattachExistingSubtree(DomTreeT &DT, const TreeNodePtr AttachTo)
static NodePtr GetEntryNode(const DomTreeT &DT)
static void InsertEdge(DomTreeT &DT, const BatchUpdatePtr BUI, const NodePtr From, const NodePtr To)
size_type count(const_arg_type_t< KeyT > Val) const
Return 1 if the specified key is in the map, 0 otherwise.
static void InsertReachable(DomTreeT &DT, const BatchUpdatePtr BUI, const TreeNodePtr From, const TreeNodePtr To)
Loop::LoopBounds::Direction Direction
SmallVector< TreeNodePtr, 8 > Affected
static void ComputeUnreachableDominators(DomTreeT &DT, const BatchUpdatePtr BUI, const NodePtr Root, const TreeNodePtr Incoming, SmallVectorImpl< std::pair< NodePtr, TreeNodePtr >> &DiscoveredConnectingEdges)
std::vector< NodePtr > NumToNode
assert(ImpDefSCC.getReg()==AMDGPU::SCC &&ImpDefSCC.isDef())
This class implements an extremely fast bulk output stream that can only output to a stream...
SmallVector< TreeNodePtr, 8 > VisitedUnaffected
unsigned getLevel() const
This file defines a set of templates that efficiently compute a dominator tree over a generic graph...
static void InsertUnreachable(DomTreeT &DT, const BatchUpdatePtr BUI, const TreeNodePtr From, const NodePtr To)
TreeNodePtr getNodeForBlock(NodePtr BB, DomTreeT &DT)
DenseMap< NodePtr, SmallVector< NodePtrAndKind, 4 > > FutureSuccessors
DenseMap< NodePtr, SmallVector< NodePtrAndKind, 4 > > FuturePredecessors
static ResultTy Get(NodePtr N, std::integral_constant< bool, false >)
BatchUpdateInfo * BatchUpdates
void setIDom(DomTreeNodeBase *NewIDom)