LLVM 20.0.0git
Public Types | Public Member Functions | Static Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Friends | List of all members
llvm::DominatorTreeBase< NodeT, IsPostDom > Class Template Reference

Core dominator tree base class. More...

#include "llvm/Support/GenericDomTree.h"

Inheritance diagram for llvm::DominatorTreeBase< NodeT, IsPostDom >:
Inheritance graph
[legend]

Public Types

enum class  VerificationLevel { Fast , Basic , Full }
 
using NodeTrait = DomTreeNodeTraits< NodeT >
 
using NodeType = typename NodeTrait::NodeType
 
using NodePtr = typename NodeTrait::NodePtr
 
using ParentPtr = typename NodeTrait::ParentPtr
 
using ParentType = std::remove_pointer_t< ParentPtr >
 
using UpdateType = cfg::Update< NodePtr >
 
using UpdateKind = cfg::UpdateKind
 
using root_iterator = typename SmallVectorImpl< NodeT * >::iterator
 Iteration over roots.
 
using const_root_iterator = typename SmallVectorImpl< NodeT * >::const_iterator
 

Public Member Functions

 DominatorTreeBase ()=default
 
 DominatorTreeBase (DominatorTreeBase &&Arg)
 
DominatorTreeBaseoperator= (DominatorTreeBase &&RHS)
 
 DominatorTreeBase (const DominatorTreeBase &)=delete
 
DominatorTreeBaseoperator= (const DominatorTreeBase &)=delete
 
root_iterator root_begin ()
 
const_root_iterator root_begin () const
 
root_iterator root_end ()
 
const_root_iterator root_end () const
 
size_t root_size () const
 
iterator_range< root_iteratorroots ()
 
iterator_range< const_root_iteratorroots () const
 
bool isPostDominator () const
 isPostDominator - Returns true if analysis based of postdoms
 
bool compare (const DominatorTreeBase &Other) const
 compare - Return false if the other dominator tree base matches this dominator tree base.
 
DomTreeNodeBase< NodeT > * getNode (const NodeT *BB) const
 getNode - return the (Post)DominatorTree node for the specified basic block.
 
DomTreeNodeBase< NodeT > * operator[] (const NodeT *BB) const
 See getNode.
 
DomTreeNodeBase< NodeT > * getRootNode ()
 getRootNode - This returns the entry node for the CFG of the function.
 
const DomTreeNodeBase< NodeT > * getRootNode () const
 
void getDescendants (NodeT *R, SmallVectorImpl< NodeT * > &Result) const
 Get all nodes dominated by R, including R itself.
 
bool properlyDominates (const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const
 properlyDominates - Returns true iff A dominates B and A != B.
 
bool properlyDominates (const NodeT *A, const NodeT *B) const
 
bool isReachableFromEntry (const NodeT *A) const
 isReachableFromEntry - Return true if A is dominated by the entry block of the function containing it.
 
bool isReachableFromEntry (const DomTreeNodeBase< NodeT > *A) const
 
bool dominates (const DomTreeNodeBase< NodeT > *A, const DomTreeNodeBase< NodeT > *B) const
 dominates - Returns true iff A dominates B.
 
bool dominates (const NodeT *A, const NodeT *B) const
 
NodeT * getRoot () const
 
NodeT * findNearestCommonDominator (NodeT *A, NodeT *B) const
 Find nearest common dominator basic block for basic block A and B.
 
const NodeT * findNearestCommonDominator (const NodeT *A, const NodeT *B) const
 
bool isVirtualRoot (const DomTreeNodeBase< NodeT > *A) const
 
void applyUpdates (ArrayRef< UpdateType > Updates)
 Inform the dominator tree about a sequence of CFG edge insertions and deletions and perform a batch update on the tree.
 
void applyUpdates (ArrayRef< UpdateType > Updates, ArrayRef< UpdateType > PostViewUpdates)
 
void insertEdge (NodeT *From, NodeT *To)
 Inform the dominator tree about a CFG edge insertion and update the tree.
 
void deleteEdge (NodeT *From, NodeT *To)
 Inform the dominator tree about a CFG edge deletion and update the tree.
 
DomTreeNodeBase< NodeT > * addNewBlock (NodeT *BB, NodeT *DomBB)
 Add a new node to the dominator tree information.
 
DomTreeNodeBase< NodeT > * setNewRoot (NodeT *BB)
 Add a new node to the forward dominator tree and make it a new root.
 
void changeImmediateDominator (DomTreeNodeBase< NodeT > *N, DomTreeNodeBase< NodeT > *NewIDom)
 changeImmediateDominator - This method is used to update the dominator tree information when a node's immediate dominator changes.
 
void changeImmediateDominator (NodeT *BB, NodeT *NewBB)
 
void eraseNode (NodeT *BB)
 eraseNode - Removes a node from the dominator tree.
 
void splitBlock (NodeT *NewBB)
 splitBlock - BB is split and now it has one successor.
 
void print (raw_ostream &O) const
 print - Convert to human readable form
 
void updateDFSNumbers () const
 updateDFSNumbers - Assign In and Out numbers to the nodes while walking dominator tree in dfs order.
 
void recalculate (ParentType &Func)
 recalculate - compute a dominator tree for the given function
 
void recalculate (ParentType &Func, ArrayRef< UpdateType > Updates)
 
template<typename T = NodeT>
std::enable_if_t< GraphHasNodeNumbers< T * >, void > updateBlockNumbers ()
 Update dominator tree after renumbering blocks.
 
bool verify (VerificationLevel VL=VerificationLevel::Full) const
 verify - checks if the tree is correct.
 
void reset ()
 

Static Public Attributes

static constexpr bool IsPostDominator = IsPostDom
 
static constexpr UpdateKind Insert = UpdateKind::Insert
 
static constexpr UpdateKind Delete = UpdateKind::Delete
 

Protected Types

using DomTreeNodeStorageTy = SmallVector< std::unique_ptr< DomTreeNodeBase< NodeT > > >
 

Protected Member Functions

void addRoot (NodeT *BB)
 
DomTreeNodeBase< NodeT > * createNode (NodeT *BB, DomTreeNodeBase< NodeT > *IDom=nullptr)
 
template<class N >
void Split (typename GraphTraits< N >::NodeRef NewBB)
 
void addRoot (MachineBasicBlock *MBB)
 

Protected Attributes

SmallVector< NodeT *, IsPostDom ? 4 :1 > Roots
 
DomTreeNodeStorageTy DomTreeNodes
 
std::conditional_t<!GraphHasNodeNumbers< NodeT * >, DenseMap< const NodeT *, unsigned >, std::tuple<> > NodeNumberMap
 
DomTreeNodeBase< NodeT > * RootNode = nullptr
 
ParentPtr Parent = nullptr
 
bool DFSInfoValid = false
 
unsigned int SlowQueries = 0
 
unsigned BlockNumberEpoch = 0
 

Friends

struct DomTreeBuilder::SemiNCAInfo< DominatorTreeBase >
 

Detailed Description

template<typename NodeT, bool IsPostDom>
class llvm::DominatorTreeBase< NodeT, IsPostDom >

Core dominator tree base class.

This class is a generic template over graph nodes. It is instantiated for various graphs in the LLVM IR or in the code generator.

Definition at line 237 of file GenericDomTree.h.

Member Typedef Documentation

◆ const_root_iterator

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::const_root_iterator = typename SmallVectorImpl<NodeT *>::const_iterator

Definition at line 313 of file GenericDomTree.h.

◆ DomTreeNodeStorageTy

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::DomTreeNodeStorageTy = SmallVector<std::unique_ptr<DomTreeNodeBase<NodeT> >>
protected

Definition at line 261 of file GenericDomTree.h.

◆ NodePtr

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::NodePtr = typename NodeTrait::NodePtr

Definition at line 243 of file GenericDomTree.h.

◆ NodeTrait

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::NodeTrait = DomTreeNodeTraits<NodeT>

Definition at line 241 of file GenericDomTree.h.

◆ NodeType

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::NodeType = typename NodeTrait::NodeType

Definition at line 242 of file GenericDomTree.h.

◆ ParentPtr

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::ParentPtr = typename NodeTrait::ParentPtr

Definition at line 244 of file GenericDomTree.h.

◆ ParentType

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::ParentType = std::remove_pointer_t<ParentPtr>

Definition at line 247 of file GenericDomTree.h.

◆ root_iterator

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::root_iterator = typename SmallVectorImpl<NodeT *>::iterator

Iteration over roots.

This may include multiple blocks if we are computing post dominators. For forward dominators, this will always be a single block (the entry block).

Definition at line 312 of file GenericDomTree.h.

◆ UpdateKind

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::UpdateKind = cfg::UpdateKind

Definition at line 251 of file GenericDomTree.h.

◆ UpdateType

template<typename NodeT , bool IsPostDom>
using llvm::DominatorTreeBase< NodeT, IsPostDom >::UpdateType = cfg::Update<NodePtr>

Definition at line 250 of file GenericDomTree.h.

Member Enumeration Documentation

◆ VerificationLevel

template<typename NodeT , bool IsPostDom>
enum class llvm::DominatorTreeBase::VerificationLevel
strong
Enumerator
Fast 
Basic 
Full 

Definition at line 255 of file GenericDomTree.h.

Constructor & Destructor Documentation

◆ DominatorTreeBase() [1/3]

template<typename NodeT , bool IsPostDom>
llvm::DominatorTreeBase< NodeT, IsPostDom >::DominatorTreeBase ( )
default

◆ DominatorTreeBase() [2/3]

template<typename NodeT , bool IsPostDom>
llvm::DominatorTreeBase< NodeT, IsPostDom >::DominatorTreeBase ( DominatorTreeBase< NodeT, IsPostDom > &&  Arg)
inline

Definition at line 281 of file GenericDomTree.h.

◆ DominatorTreeBase() [3/3]

template<typename NodeT , bool IsPostDom>
llvm::DominatorTreeBase< NodeT, IsPostDom >::DominatorTreeBase ( const DominatorTreeBase< NodeT, IsPostDom > &  )
delete

Member Function Documentation

◆ addNewBlock()

template<typename NodeT , bool IsPostDom>
DomTreeNodeBase< NodeT > * llvm::DominatorTreeBase< NodeT, IsPostDom >::addNewBlock ( NodeT *  BB,
NodeT *  DomBB 
)
inline

Add a new node to the dominator tree information.

This creates a new node as a child of DomBB dominator node, linking it into the children list of the immediate dominator.

Parameters
BBNew node in CFG.
DomBBCFG node that is dominator for BB.
Returns
New dominator tree node that represents new CFG node.

Definition at line 671 of file GenericDomTree.h.

References assert(), llvm::DominatorTreeBase< NodeT, IsPostDom >::createNode(), llvm::DominatorTreeBase< NodeT, IsPostDom >::DFSInfoValid, and llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode().

Referenced by cloneLoopBlocks(), CloneLoopBlocks(), llvm::cloneLoopWithPreheader(), loadMBUFScalarOperandsFromVGPR(), llvm::DominatorTreeBase< NodeT, IsPostDom >::Split(), SplitBlockImpl(), llvm::UnrollAndJamLoop(), and llvm::UnrollLoop().

◆ addRoot() [1/2]

void llvm::DominatorTreeBase< MachineBasicBlock, false >::addRoot ( MachineBasicBlock MBB)
inlineprotected

Definition at line 36 of file MachineDominators.h.

References MBB.

◆ addRoot() [2/2]

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::addRoot ( NodeT *  BB)
inlineprotected

◆ applyUpdates() [1/2]

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::applyUpdates ( ArrayRef< UpdateType Updates)
inline

Inform the dominator tree about a sequence of CFG edge insertions and deletions and perform a batch update on the tree.

This function should be used when there were multiple CFG updates after the last dominator tree update. It takes care of performing the updates in sync with the CFG and optimizes away the redundant operations that cancel each other. The functions expects the sequence of updates to be balanced. Eg.:

  • {{Insert, A, B}, {Delete, A, B}, {Insert, A, B}} is fine, because logically it results in a single insertions.
  • {{Insert, A, B}, {Insert, A, B}} is invalid, because it doesn't make sense to insert the same edge twice.

What's more, the functions assumes that it's safe to ask every node in the CFG about its children and inverse children. This implies that deletions of CFG edges must not delete the CFG nodes before calling this function.

The applyUpdates function can reorder the updates and remove redundant ones internally (as long as it is done in a deterministic fashion). The batch updater is also able to detect sequences of zero and exactly one update – it's optimized to do less work in these cases.

Note that for postdominators it automatically takes care of applying updates on reverse edges internally (so there's no need to swap the From and To pointers when constructing DominatorTree::UpdateType). The type of updates is the same for DomTreeBase<T> and PostDomTreeBase<T> with the same template parameter T.

Parameters
UpdatesAn ordered sequence of updates to perform. The current CFG and the reverse of these updates provides the pre-view of the CFG.

Definition at line 596 of file GenericDomTree.h.

References llvm::DomTreeBuilder::ApplyUpdates().

Referenced by llvm::MemorySSAUpdater::applyUpdates(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdates(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::applyUpdatesPermissive(), injectPendingInvariantConditions(), splitBlock(), llvm::SplitKnownCriticalEdge(), unswitchNontrivialInvariants(), and unswitchTrivialSwitch().

◆ applyUpdates() [2/2]

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::applyUpdates ( ArrayRef< UpdateType Updates,
ArrayRef< UpdateType PostViewUpdates 
)
inline
Parameters
UpdatesAn ordered sequence of updates to perform. The current CFG and the reverse of these updates provides the pre-view of the CFG.
PostViewUpdatesAn ordered sequence of update to perform in order to obtain a post-view of the CFG. The DT will be updated assuming the obtained PostViewCFG is the desired end state.

Definition at line 607 of file GenericDomTree.h.

References llvm::append_range(), llvm::DomTreeBuilder::ApplyUpdates(), and llvm::ArrayRef< T >::empty().

◆ changeImmediateDominator() [1/2]

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::changeImmediateDominator ( DomTreeNodeBase< NodeT > *  N,
DomTreeNodeBase< NodeT > *  NewIDom 
)
inline

◆ changeImmediateDominator() [2/2]

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::changeImmediateDominator ( NodeT *  BB,
NodeT *  NewBB 
)
inline

◆ compare()

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::compare ( const DominatorTreeBase< NodeT, IsPostDom > &  Other) const
inline

◆ createNode()

template<typename NodeT , bool IsPostDom>
DomTreeNodeBase< NodeT > * llvm::DominatorTreeBase< NodeT, IsPostDom >::createNode ( NodeT *  BB,
DomTreeNodeBase< NodeT > *  IDom = nullptr 
)
inlineprotected

◆ deleteEdge()

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::deleteEdge ( NodeT *  From,
NodeT *  To 
)
inline

Inform the dominator tree about a CFG edge deletion and update the tree.

This function has to be called just after making the update on the actual CFG. An internal functions checks if the edge doesn't exist in the CFG in DEBUG mode. There cannot be any other updates that the dominator tree doesn't know about.

Note that for postdominators it automatically takes care of deleting a reverse edge internally (so there's no need to swap the parameters).

Definition at line 654 of file GenericDomTree.h.

References assert(), llvm::DomTreeBuilder::DeleteEdge(), From, llvm::DomTreeNodeTraits< NodeT >::getParent(), and llvm::DominatorTreeBase< NodeT, IsPostDom >::Parent.

Referenced by DoFlattenLoopPair(), replaceArgumentUses(), and unswitchTrivialBranch().

◆ dominates() [1/2]

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::dominates ( const DomTreeNodeBase< NodeT > *  A,
const DomTreeNodeBase< NodeT > *  B 
) const
inline

◆ dominates() [2/2]

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::dominates ( const NodeT *  A,
const NodeT *  B 
) const

Definition at line 1012 of file GenericDomTree.h.

References A, B, dominates(), and getNode().

◆ eraseNode()

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::eraseNode ( NodeT *  BB)
inline

◆ findNearestCommonDominator() [1/2]

template<typename NodeT , bool IsPostDom>
const NodeT * llvm::DominatorTreeBase< NodeT, IsPostDom >::findNearestCommonDominator ( const NodeT *  A,
const NodeT *  B 
) const
inline

◆ findNearestCommonDominator() [2/2]

template<typename NodeT , bool IsPostDom>
NodeT * llvm::DominatorTreeBase< NodeT, IsPostDom >::findNearestCommonDominator ( NodeT *  A,
NodeT *  B 
) const
inline

◆ getDescendants()

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::getDescendants ( NodeT *  R,
SmallVectorImpl< NodeT * > &  Result 
) const
inline

◆ getNode()

template<typename NodeT , bool IsPostDom>
DomTreeNodeBase< NodeT > * llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode ( const NodeT *  BB) const
inline

getNode - return the (Post)DominatorTree node for the specified basic block.

This is the same as using operator[] on this class. The result may (but is not required to) be null for a forward (backwards) statically unreachable block.

Definition at line 401 of file GenericDomTree.h.

References assert(), llvm::DominatorTreeBase< NodeT, IsPostDom >::DomTreeNodes, llvm::DomTreeNodeTraits< NodeT >::getParent(), Idx, llvm::DominatorTreeBase< NodeT, IsPostDom >::Parent, and llvm::SmallVectorBase< Size_T >::size().

Referenced by llvm::DominatorTreeBase< NodeT, IsPostDom >::addNewBlock(), llvm::LoopInfoBase< BlockT, LoopT >::analyze(), llvm::IDFCalculatorBase< NodeTy, IsPostDom >::calculate(), llvm::DominatorTreeBase< NodeT, IsPostDom >::changeImmediateDominator(), checkAndReplaceCondition(), checkHoistValue(), cloneLoopBlocks(), CloneLoopBlocks(), llvm::cloneLoopWithPreheader(), llvm::collectChildrenInLoop(), collectUnswitchCandidatesWithInjections(), compareCmp(), llvm::ValueDFS_Compare::comparePHIRelated(), computeBlocksDominatingExits(), llvm::RegionBase< Tr >::contains(), containsUnconditionalCallSafepoint(), domTreeLevelBefore(), eliminateConstraints(), llvm::InnerLoopVectorizer::emitIterationCountCheck(), llvm::EpilogueVectorizerMainLoop::emitIterationCountCheck(), llvm::GenericDomTreeUpdater< DerivedT, DomTreeT, PostDomTreeT >::eraseDelBBNode(), llvm::MustBeExecutedContextExplorer::findBackwardJoinPoint(), findBestInsertionSet(), llvm::MustBeExecutedContextExplorer::findForwardJoinPoint(), llvm::MachinePostDominatorTree::findNearestCommonDominator(), llvm::DominatorTreeBase< NodeT, IsPostDom >::findNearestCommonDominator(), formLCSSAForInstructionsImpl(), llvm::DominatorTreeBase< NodeT, IsPostDom >::getDescendants(), getDominatees(), getDominators(), llvm::RegionBase< Tr >::getEnteringBlock(), llvm::rdf::Liveness::getNearestAliasedRef(), llvm::slpvectorizer::BoUpSLP::getReorderingData(), llvm::slpvectorizer::BoUpSLP::getSpillCost(), llvm::hoistRegion(), hoistValue(), isGuaranteedNotToBeUndefOrPoison(), llvm::DominatorTreeBase< NodeT, IsPostDom >::isReachableFromEntry(), loadCSE(), llvm::PhiLoweringHelper::lowerPhis(), llvm::MergeBlockIntoPredecessor(), llvm::DominatorTreeBase< NodeT, IsPostDom >::operator[](), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), llvm::peelLoop(), preheader(), llvm::MemorySSA::renamePass(), llvm::GuardWideningPass::run(), llvm::DominatorTreeBase< NodeT, IsPostDom >::setNewRoot(), shouldSplitOnPredicatedArgument(), simplifyOneLoop(), simplifyUsingControlFlow(), SinkInstruction(), llvm::sinkRegionForLoopNest(), llvm::DominatorTreeBase< NodeT, IsPostDom >::Split(), SplitBlockImpl(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), llvm::GenericConvergenceVerifier< ContextT >::verify(), and llvm::MemorySSA::verifyPrevDefInPhis().

◆ getRoot()

template<typename NodeT , bool IsPostDom>
NodeT * llvm::DominatorTreeBase< NodeT, IsPostDom >::getRoot ( ) const
inline

◆ getRootNode() [1/2]

template<typename NodeT , bool IsPostDom>
DomTreeNodeBase< NodeT > * llvm::DominatorTreeBase< NodeT, IsPostDom >::getRootNode ( )
inline

getRootNode - This returns the entry node for the CFG of the function.

If this tree represents the post-dominance relations for a function, however, this root may be a node with the block == NULL. This is the case when there are multiple exit nodes from a particular function. Consumers of post-dominance information must be capable of dealing with this possibility.

Definition at line 421 of file GenericDomTree.h.

References llvm::DominatorTreeBase< NodeT, IsPostDom >::RootNode.

Referenced by llvm::LoopInfoBase< BlockT, LoopT >::analyze(), llvm::PredicateInfoBuilder::buildPredicateInfo(), llvm::GraphTraits< DominatorTree * >::getEntryNode(), llvm::GraphTraits< MachineDominatorTree * >::getEntryNode(), llvm::GraphTraits< PostDominatorTree * >::getEntryNode(), llvm::MemorySSA::OptimizeUses::optimizeUses(), llvm::DominatorTreeBase< NodeT, IsPostDom >::print(), llvm::GuardWideningPass::run(), UpdateAnalysisInformation(), and llvm::DominatorTreeBase< NodeT, IsPostDom >::updateDFSNumbers().

◆ getRootNode() [2/2]

template<typename NodeT , bool IsPostDom>
const DomTreeNodeBase< NodeT > * llvm::DominatorTreeBase< NodeT, IsPostDom >::getRootNode ( ) const
inline

◆ insertEdge()

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::insertEdge ( NodeT *  From,
NodeT *  To 
)
inline

Inform the dominator tree about a CFG edge insertion and update the tree.

This function has to be called just before or just after making the update on the actual CFG. There cannot be any other updates that the dominator tree doesn't know about.

Note that for postdominators it automatically takes care of inserting a reverse edge internally (so there's no need to swap the parameters).

Definition at line 636 of file GenericDomTree.h.

References assert(), From, llvm::DomTreeNodeTraits< NodeT >::getParent(), llvm::DomTreeBuilder::InsertEdge(), and llvm::DominatorTreeBase< NodeT, IsPostDom >::Parent.

Referenced by replaceArgumentUses(), and unswitchTrivialBranch().

◆ isPostDominator()

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::isPostDominator ( ) const
inline

◆ isReachableFromEntry() [1/2]

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::isReachableFromEntry ( const DomTreeNodeBase< NodeT > *  A) const
inline

Definition at line 462 of file GenericDomTree.h.

References A.

◆ isReachableFromEntry() [2/2]

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::isReachableFromEntry ( const NodeT *  A) const
inline

◆ isVirtualRoot()

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::isVirtualRoot ( const DomTreeNodeBase< NodeT > *  A) const
inline

◆ operator=() [1/2]

template<typename NodeT , bool IsPostDom>
DominatorTreeBase & llvm::DominatorTreeBase< NodeT, IsPostDom >::operator= ( const DominatorTreeBase< NodeT, IsPostDom > &  )
delete

◆ operator=() [2/2]

template<typename NodeT , bool IsPostDom>
DominatorTreeBase & llvm::DominatorTreeBase< NodeT, IsPostDom >::operator= ( DominatorTreeBase< NodeT, IsPostDom > &&  RHS)
inline

◆ operator[]()

template<typename NodeT , bool IsPostDom>
DomTreeNodeBase< NodeT > * llvm::DominatorTreeBase< NodeT, IsPostDom >::operator[] ( const NodeT *  BB) const
inline

See getNode.

Definition at line 410 of file GenericDomTree.h.

References llvm::DominatorTreeBase< NodeT, IsPostDom >::getNode().

◆ print()

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::print ( raw_ostream O) const
inline

◆ properlyDominates() [1/2]

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::properlyDominates ( const DomTreeNodeBase< NodeT > *  A,
const DomTreeNodeBase< NodeT > *  B 
) const
inline

◆ properlyDominates() [2/2]

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::properlyDominates ( const NodeT *  A,
const NodeT *  B 
) const

Definition at line 1020 of file GenericDomTree.h.

References A, B, dominates(), and getNode().

◆ recalculate() [1/2]

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::recalculate ( ParentType Func)
inline

◆ recalculate() [2/2]

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::recalculate ( ParentType Func,
ArrayRef< UpdateType Updates 
)
inline

◆ reset()

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::reset ( )
inline

◆ root_begin() [1/2]

template<typename NodeT , bool IsPostDom>
root_iterator llvm::DominatorTreeBase< NodeT, IsPostDom >::root_begin ( )
inline

◆ root_begin() [2/2]

template<typename NodeT , bool IsPostDom>
const_root_iterator llvm::DominatorTreeBase< NodeT, IsPostDom >::root_begin ( ) const
inline

◆ root_end() [1/2]

template<typename NodeT , bool IsPostDom>
root_iterator llvm::DominatorTreeBase< NodeT, IsPostDom >::root_end ( )
inline

◆ root_end() [2/2]

template<typename NodeT , bool IsPostDom>
const_root_iterator llvm::DominatorTreeBase< NodeT, IsPostDom >::root_end ( ) const
inline

◆ root_size()

template<typename NodeT , bool IsPostDom>
size_t llvm::DominatorTreeBase< NodeT, IsPostDom >::root_size ( ) const
inline

◆ roots() [1/2]

template<typename NodeT , bool IsPostDom>
iterator_range< root_iterator > llvm::DominatorTreeBase< NodeT, IsPostDom >::roots ( )
inline

◆ roots() [2/2]

template<typename NodeT , bool IsPostDom>
iterator_range< const_root_iterator > llvm::DominatorTreeBase< NodeT, IsPostDom >::roots ( ) const
inline

◆ setNewRoot()

template<typename NodeT , bool IsPostDom>
DomTreeNodeBase< NodeT > * llvm::DominatorTreeBase< NodeT, IsPostDom >::setNewRoot ( NodeT *  BB)
inline

◆ Split()

template<typename NodeT , bool IsPostDom>
template<class N >
void llvm::DominatorTreeBase< NodeT, IsPostDom >::Split ( typename GraphTraits< N >::NodeRef  NewBB)
inlineprotected

◆ splitBlock()

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::splitBlock ( NodeT *  NewBB)
inline

splitBlock - BB is split and now it has one successor.

Update dominator tree to reflect this change.

Definition at line 757 of file GenericDomTree.h.

References llvm::DominatorTreeBase< NodeT, IsPostDom >::IsPostDominator.

Referenced by insertUniqueBackedgeBlock(), and UpdateAnalysisInformation().

◆ updateBlockNumbers()

template<typename NodeT , bool IsPostDom>
template<typename T = NodeT>
std::enable_if_t< GraphHasNodeNumbers< T * >, void > llvm::DominatorTreeBase< NodeT, IsPostDom >::updateBlockNumbers ( )
inline

◆ updateDFSNumbers()

template<typename NodeT , bool IsPostDom>
void llvm::DominatorTreeBase< NodeT, IsPostDom >::updateDFSNumbers ( ) const
inline

◆ verify()

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::verify ( VerificationLevel  VL = VerificationLevel::Full) const
inline

verify - checks if the tree is correct.

There are 3 level of verification:

  • Full – verifies if the tree is correct by making sure all the properties (including the parent and the sibling property) hold. Takes O(N^3) time.
  • Basic – checks if the tree is correct, but compares it to a freshly constructed tree instead of checking the sibling property. Takes O(N^2) time.
  • Fast – checks basic tree structure and compares it with a freshly constructed tree. Takes O(N^2) time worst case, but is faster in practise (same as tree construction).

Definition at line 889 of file GenericDomTree.h.

References llvm::DomTreeBuilder::Verify().

Referenced by llvm::LoopVectorizationPlanner::executePlan(), fixIrreducible(), llvm::hoistRegion(), injectPendingInvariantConditions(), llvm::peelLoop(), llvm::LoopVectorizePass::processLoop(), llvm::DominatorTreeVerifierPass::run(), llvm::CorrelatedValuePropagationPass::run(), llvm::FunctionToLoopPassAdaptor::run(), llvm::StackProtectorPass::run(), llvm::LoopBoundSplitPass::run(), llvm::SimpleLoopUnswitchPass::run(), runImpl(), simplifyFunctionCFG(), unifyLoopExits(), llvm::UnrollAndJamLoop(), llvm::UnrollLoop(), llvm::UnrollRuntimeLoopRemainder(), unswitchNontrivialInvariants(), unswitchTrivialSwitch(), llvm::PostDominatorTreeWrapperPass::verifyAnalysis(), and llvm::DominatorTreeWrapperPass::verifyAnalysis().

Friends And Related Function Documentation

◆ DomTreeBuilder::SemiNCAInfo< DominatorTreeBase >

template<typename NodeT , bool IsPostDom>
friend struct DomTreeBuilder::SemiNCAInfo< DominatorTreeBase >
friend

Definition at line 274 of file GenericDomTree.h.

Member Data Documentation

◆ BlockNumberEpoch

template<typename NodeT , bool IsPostDom>
unsigned llvm::DominatorTreeBase< NodeT, IsPostDom >::BlockNumberEpoch = 0
protected

◆ Delete

template<typename NodeT , bool IsPostDom>
constexpr UpdateKind llvm::DominatorTreeBase< NodeT, IsPostDom >::Delete = UpdateKind::Delete
staticconstexpr

◆ DFSInfoValid

template<typename NodeT , bool IsPostDom>
bool llvm::DominatorTreeBase< NodeT, IsPostDom >::DFSInfoValid = false
mutableprotected

◆ DomTreeNodes

template<typename NodeT , bool IsPostDom>
DomTreeNodeStorageTy llvm::DominatorTreeBase< NodeT, IsPostDom >::DomTreeNodes
protected

◆ Insert

template<typename NodeT , bool IsPostDom>
constexpr UpdateKind llvm::DominatorTreeBase< NodeT, IsPostDom >::Insert = UpdateKind::Insert
staticconstexpr

◆ IsPostDominator

template<typename NodeT , bool IsPostDom>
constexpr bool llvm::DominatorTreeBase< NodeT, IsPostDom >::IsPostDominator = IsPostDom
staticconstexpr

◆ NodeNumberMap

template<typename NodeT , bool IsPostDom>
std::conditional_t<!GraphHasNodeNumbers<NodeT *>, DenseMap<const NodeT *, unsigned>, std::tuple<> > llvm::DominatorTreeBase< NodeT, IsPostDom >::NodeNumberMap
protected

◆ Parent

template<typename NodeT , bool IsPostDom>
ParentPtr llvm::DominatorTreeBase< NodeT, IsPostDom >::Parent = nullptr
protected

◆ RootNode

template<typename NodeT , bool IsPostDom>
DomTreeNodeBase<NodeT>* llvm::DominatorTreeBase< NodeT, IsPostDom >::RootNode = nullptr
protected

◆ Roots

template<typename NodeT , bool IsPostDom>
SmallVector<NodeT *, IsPostDom ? 4 : 1> llvm::DominatorTreeBase< NodeT, IsPostDom >::Roots
protected

◆ SlowQueries

template<typename NodeT , bool IsPostDom>
unsigned int llvm::DominatorTreeBase< NodeT, IsPostDom >::SlowQueries = 0
mutableprotected

The documentation for this class was generated from the following files: