LLVM 20.0.0git
|
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree. More...
#include "llvm/IR/Dominators.h"
Public Types | |
using | Base = DominatorTreeBase< BasicBlock, false > |
Public Types inherited from llvm::DominatorTreeBase< BasicBlock, false > | |
enum | VerificationLevel |
using | NodeTrait = DomTreeNodeTraits< BasicBlock > |
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< BasicBlock * >::iterator |
Iteration over roots. | |
using | const_root_iterator = typename SmallVectorImpl< BasicBlock * >::const_iterator |
Public Member Functions | |
DominatorTree ()=default | |
DominatorTree (Function &F) | |
DominatorTree (DominatorTree &DT, DomTreeBuilder::BBUpdates U) | |
bool | invalidate (Function &F, const PreservedAnalyses &PA, FunctionAnalysisManager::Invalidator &) |
Handle invalidation explicitly. | |
bool | dominates (const BasicBlock *BB, const Use &U) const |
Return true if the (end of the) basic block BB dominates the use U. | |
bool | dominates (const Value *Def, const Use &U) const |
Return true if value Def dominates use U, in the sense that Def is available at U, and could be substituted as the used value without violating the SSA dominance requirement. | |
bool | dominates (const Value *Def, const Instruction *User) const |
Return true if value Def dominates all possible uses inside instruction User. | |
bool | dominates (const Value *Def, BasicBlock::iterator User) const |
bool | dominates (const Instruction *Def, const BasicBlock *BB) const |
Returns true if Def would dominate a use in any instruction in BB. | |
bool | dominates (const BasicBlockEdge &BBE, const Use &U) const |
Return true if an edge dominates a use. | |
bool | dominates (const BasicBlockEdge &BBE, const BasicBlock *BB) const |
bool | dominates (const BasicBlockEdge &BBE1, const BasicBlockEdge &BBE2) const |
Returns true if edge BBE1 dominates edge BBE2 . | |
bool | isReachableFromEntry (const Use &U) const |
Provide an overload for a Use. | |
Instruction * | findNearestCommonDominator (Instruction *I1, Instruction *I2) const |
Find the nearest instruction I that dominates both I1 and I2, in the sense that a result produced before I will be available at both I1 and I2. | |
void | viewGraph (const Twine &Name, const Twine &Title) |
void | viewGraph () |
Public Member Functions inherited from llvm::DominatorTreeBase< BasicBlock, false > | |
DominatorTreeBase ()=default | |
DominatorTreeBase (DominatorTreeBase &&Arg) | |
DominatorTreeBase (const DominatorTreeBase &)=delete | |
DominatorTreeBase & | operator= (DominatorTreeBase &&RHS) |
DominatorTreeBase & | operator= (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_iterator > | roots () |
iterator_range< const_root_iterator > | roots () 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< BasicBlock > * | getNode (const BasicBlock *BB) const |
getNode - return the (Post)DominatorTree node for the specified basic block. | |
DomTreeNodeBase< BasicBlock > * | operator[] (const BasicBlock *BB) const |
See getNode. | |
DomTreeNodeBase< BasicBlock > * | getRootNode () |
getRootNode - This returns the entry node for the CFG of the function. | |
const DomTreeNodeBase< BasicBlock > * | getRootNode () const |
void | getDescendants (BasicBlock *R, SmallVectorImpl< BasicBlock * > &Result) const |
Get all nodes dominated by R, including R itself. | |
bool | properlyDominates (const DomTreeNodeBase< BasicBlock > *A, const DomTreeNodeBase< BasicBlock > *B) const |
properlyDominates - Returns true iff A dominates B and A != B. | |
bool | properlyDominates (const BasicBlock *A, const BasicBlock *B) const |
bool | isReachableFromEntry (const BasicBlock *A) const |
isReachableFromEntry - Return true if A is dominated by the entry block of the function containing it. | |
bool | isReachableFromEntry (const DomTreeNodeBase< BasicBlock > *A) const |
bool | dominates (const DomTreeNodeBase< BasicBlock > *A, const DomTreeNodeBase< BasicBlock > *B) const |
dominates - Returns true iff A dominates B. | |
bool | dominates (const BasicBlock *A, const BasicBlock *B) const |
BasicBlock * | getRoot () const |
BasicBlock * | findNearestCommonDominator (BasicBlock *A, BasicBlock *B) const |
Find nearest common dominator basic block for basic block A and B. | |
const BasicBlock * | findNearestCommonDominator (const BasicBlock *A, const BasicBlock *B) const |
bool | isVirtualRoot (const DomTreeNodeBase< BasicBlock > *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 (BasicBlock *From, BasicBlock *To) |
Inform the dominator tree about a CFG edge insertion and update the tree. | |
void | deleteEdge (BasicBlock *From, BasicBlock *To) |
Inform the dominator tree about a CFG edge deletion and update the tree. | |
DomTreeNodeBase< BasicBlock > * | addNewBlock (BasicBlock *BB, BasicBlock *DomBB) |
Add a new node to the dominator tree information. | |
DomTreeNodeBase< BasicBlock > * | setNewRoot (BasicBlock *BB) |
Add a new node to the forward dominator tree and make it a new root. | |
void | changeImmediateDominator (DomTreeNodeBase< BasicBlock > *N, DomTreeNodeBase< BasicBlock > *NewIDom) |
changeImmediateDominator - This method is used to update the dominator tree information when a node's immediate dominator changes. | |
void | changeImmediateDominator (BasicBlock *BB, BasicBlock *NewBB) |
void | eraseNode (BasicBlock *BB) |
eraseNode - Removes a node from the dominator tree. | |
void | splitBlock (BasicBlock *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) |
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 () |
Concrete subclass of DominatorTreeBase that is used to compute a normal dominator tree.
Definition: A block is said to be forward statically reachable if there is a path from the entry of the function to the block. A statically reachable block may become statically unreachable during optimization.
A forward unreachable block may appear in the dominator tree, or it may not. If it does, dominance queries will return results as if all reachable blocks dominate it. When asking for a Node corresponding to a potentially unreachable block, calling code must handle the case where the block was unreachable and the result of getNode() is nullptr.
Generally, a block known to be unreachable when the dominator tree is constructed will not be in the tree. One which becomes unreachable after the dominator tree is initially constructed may still exist in the tree, even if the tree is properly updated. Calling code should not rely on the preceding statements; this is stated only to assist human understanding.
Definition at line 162 of file Dominators.h.
using llvm::DominatorTree::Base = DominatorTreeBase<BasicBlock, false> |
Definition at line 164 of file Dominators.h.
|
default |
|
inlineexplicit |
Definition at line 167 of file Dominators.h.
References F.
|
inlineexplicit |
Definition at line 168 of file Dominators.h.
References llvm::DominatorTreeBase< NodeT, IsPostDom >::Parent.
bool DominatorTree::dominates | ( | const BasicBlock * | BB, |
const Use & | U | ||
) | const |
Return true if the (end of the) basic block BB dominates the use U.
Definition at line 122 of file Dominators.cpp.
References dominates(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), and llvm::DominatorTreeBase< BasicBlock, false >::properlyDominates().
Referenced by llvm::LoopSafetyInfo::allLoopPathsLeadToBlock(), llvm::LoopAccessInfo::blockNeedsPredication(), BrPHIToSelect(), CalculateUnswitchCostMultiplier(), checkBasicSSA(), checkHoistValue(), llvm::RegionBase< RegionTraits< MachineFunction > >::clearNodeCache(), CompareSCEVComplexity(), llvm::computeKnownBitsFromContext(), computeKnownFPClassFromContext(), llvm::RegionBase< Tr >::contains(), containsUnconditionalCallSafepoint(), llvm::InstCombinerImpl::convertOrOfShiftsToFunnelShift(), doesStoreDominatesAllLatches(), DoFlattenLoopPair(), dominates(), llvm::MemorySSA::dominates(), llvm::InstCombinerImpl::dominatesAllUses(), llvm::EpilogueVectorizerEpilogueLoop::emitMinimumVectorEpilogueIterCountCheck(), findBasePointers(), findBBsToSinkInto(), findBestNonTrivialUnswitchCandidate(), findCallsAtConstantOffset(), foldConsecutiveLoads(), llvm::InstCombinerImpl::foldFreezeIntoRecurrence(), foldGuardedFunnelShift(), llvm::InstCombinerImpl::foldICmpWithDominatingICmp(), llvm::InstCombinerImpl::foldIntegerTypedPHI(), llvm::InstCombinerImpl::foldOpIntoPhi(), formLCSSAForInstructionsImpl(), forwardStoredOnceStore(), llvm::InstCombinerImpl::freezeOtherUses(), generateReproducer(), llvm::ScalarEvolution::getAddExpr(), llvm::ScalarEvolution::getAddRecExpr(), getFreezeInsertPt(), getInsertPointForUses(), getInvariantGroupClobberingInstruction(), llvm::MemoryDependenceResults::getInvariantGroupPointerDependency(), llvm::SCEVExpander::getIVIncOperand(), getMinAnalyzeableBackedgeTakenCount(), getReductionInstr(), llvm::InstCombinerImpl::handlePotentiallyDeadBlocks(), llvm::SCEVExpander::hasRelatedExistingExpansion(), llvm::SCEVExpander::hoistIVInc(), llvm::hoistRegion(), hoistValue(), insertParsePoints(), insertSpills(), llvm::ScalarEvolution::instructionCouldExistWithOperands(), IsAcceptableTarget(), IsBackEdge(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), llvm::isControlFlowEquivalent(), llvm::RecurrenceDescriptor::isFixedOrderRecurrence(), isFullDominator(), llvm::HardwareLoopInfo::isHardwareLoopCandidate(), isKnownNonNullFromDominatingCondition(), llvm::isKnownToBeAPowerOfTwo(), llvm::ScalarEvolution::isKnownViaInduction(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::isOverflowIntrinsicNoWrap(), isPointerValueDeadOnEntryToFunction(), isReachableImpl(), llvm::isReachedBefore(), llvm::isSafeToMoveBefore(), llvm::isValidAssumeForContext(), llvm::AA::isValidAtPosition(), IVUseShouldUsePostIncValue(), liesBetween(), llvm::mustExecuteUBIfPoisonOnPathTo(), nearest_common_dominatee(), optimizeDivRem(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), partitionLoopBlocks(), peelToTurnInvariantLoadsDerefencebale(), PickMostRelevantLoop(), llvm::InstCombinerImpl::prepareWorklist(), PrintDebugDomInfo(), llvm::promoteLoopAccessesToScalars(), llvm::replaceDominatedUsesWith(), llvm::replaceDominatedUsesWithIf(), reportMayClobberedLoad(), restoreSSA(), rewriteDebugUsers(), rewritePHIs(), rewriteSingleStoreAlloca(), llvm::InstCombinerImpl::run(), llvm::PlaceSafepointsPass::runImpl(), separateNestedLoop(), simplifyCommonValuePhi(), llvm::InstCombinerImpl::SimplifyDemandedVectorElts(), simplifyUsingControlFlow(), SinkInstruction(), sinkLifetimeStartMarkers(), llvm::coro::sinkSpillUsesAfterCoroBegin(), llvm::PHITransAddr::translateValue(), unswitchNontrivialInvariants(), UpdateSSA(), valueDominatesPHI(), llvm::GenericConvergenceVerifier< ContextT >::verify(), llvm::RegionBase< RegionTraits< MachineFunction > >::verifyRegion(), llvm::InstCombinerImpl::visitAnd(), llvm::InstCombinerImpl::visitBranchInst(), and llvm::InstCombinerImpl::visitOr().
bool DominatorTree::dominates | ( | const BasicBlockEdge & | BBE, |
const BasicBlock * | BB | ||
) | const |
Definition at line 200 of file Dominators.cpp.
References dominates(), End, llvm::BasicBlockEdge::getEnd(), llvm::BasicBlockEdge::getStart(), and llvm::predecessors().
bool DominatorTree::dominates | ( | const BasicBlockEdge & | BBE, |
const Use & | U | ||
) | const |
Return true if an edge dominates a use.
If BBE is not a unique edge between start and end of the edge, it can never dominate the use.
Definition at line 250 of file Dominators.cpp.
References dominates(), llvm::BasicBlockEdge::getEnd(), llvm::PHINode::getIncomingBlock(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), and llvm::BasicBlockEdge::getStart().
bool DominatorTree::dominates | ( | const BasicBlockEdge & | BBE1, |
const BasicBlockEdge & | BBE2 | ||
) | const |
Returns true if edge BBE1
dominates edge BBE2
.
Definition at line 337 of file Dominators.cpp.
References dominates(), llvm::BasicBlockEdge::getEnd(), and llvm::BasicBlockEdge::getStart().
bool DominatorTree::dominates | ( | const Instruction * | Def, |
const BasicBlock * | BB | ||
) | const |
Returns true if Def would dominate a use in any instruction in BB.
If Def is an instruction in BB, then Def does not dominate BB.
Does not accept Value to avoid ambiguity with dominance checks between two basic blocks.
Definition at line 174 of file Dominators.cpp.
References dominates(), E, II, and isReachableFromEntry().
|
inline |
Definition at line 196 of file Dominators.h.
References dominates().
bool DominatorTree::dominates | ( | const Value * | Def, |
const Instruction * | User | ||
) | const |
Return true if value Def dominates all possible uses inside instruction User.
Same comments as for the Use-based API apply.
Definition at line 135 of file Dominators.cpp.
References assert(), dominates(), and isReachableFromEntry().
Return true if value Def dominates use U, in the sense that Def is available at U, and could be substituted as the used value without violating the SSA dominance requirement.
In particular, it is worth noting that:
Definition at line 268 of file Dominators.cpp.
References assert(), dominates(), E, llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), II, and isReachableFromEntry().
Instruction * DominatorTree::findNearestCommonDominator | ( | Instruction * | I1, |
Instruction * | I2 | ||
) | const |
Find the nearest instruction I that dominates both I1 and I2, in the sense that a result produced before I will be available at both I1 and I2.
Definition at line 344 of file Dominators.cpp.
References findNearestCommonDominator(), llvm::ilist_detail::node_parent_access< NodeTy, ParentTy >::getParent(), llvm::BasicBlock::getTerminator(), and isReachableFromEntry().
Referenced by Prefetch::addInstruction(), ConnectEpilog(), ConnectProlog(), findCommonDominator(), findNearestCommonDominator(), getInsertPointForUses(), llvm::isControlFlowEquivalent(), nearest_common_dominator(), llvm::nonStrictlyPostDominate(), llvm::peelLoop(), runMoveAutoInit(), SinkInstruction(), llvm::UnrollLoop(), and usersDominator().
bool DominatorTree::invalidate | ( | Function & | F, |
const PreservedAnalyses & | PA, | ||
FunctionAnalysisManager::Invalidator & | |||
) |
Handle invalidation explicitly.
Definition at line 113 of file Dominators.cpp.
References llvm::PreservedAnalyses::getChecker().
Provide an overload for a Use.
Definition at line 321 of file Dominators.cpp.
References I, and isReachableFromEntry().
Referenced by llvm::GenericUniformityAnalysisImpl< ContextT >::analyzeControlDivergence(), buildExtractionBlockSet(), llvm::PredicateInfoBuilder::buildPredicateInfo(), checkClobberSanity(), collectUnswitchCandidatesWithInjections(), deleteDeadBlocksFromLoop(), deleteDeadClonedBlocks(), llvm::deleteDeadLoop(), dominates(), findBestInsertionSet(), findNearestCommonDominator(), llvm::FunctionPropertiesUpdater::finish(), llvm::InstCombinerImpl::foldBinopWithPhiOperands(), llvm::InstCombinerImpl::foldOpIntoPhi(), foldUnusualPatterns(), formLCSSAForInstructionsImpl(), llvm::FunctionPropertiesInfo::getFunctionPropertiesInfo(), getInsertPointForUses(), llvm::slpvectorizer::BoUpSLP::getTreeCost(), llvm::MemorySSAUpdater::insertDef(), insertParsePoints(), llvm::ScalarEvolution::isBasicBlockEntryGuardedByCond(), isBlockInLCSSAForm(), llvm::ScalarEvolution::isLoopBackedgeGuardedByCond(), llvm::isPotentiallyReachable(), isReachableFromEntry(), isReachableImpl(), llvm::slpvectorizer::BoUpSLP::optimizeGatherSequence(), ProcessBlock(), llvm::coro::BaseCloner::replaceEntryBlock(), llvm::InstCombinerImpl::run(), llvm::TruncInstCombine::run(), runImpl(), llvm::JumpThreadingPass::runImpl(), runMoveAutoInit(), llvm::RewriteStatepointsForGC::runOnFunction(), simplifyLoopInst(), simplifyUsingControlFlow(), sink(), SinkInstruction(), llvm::PHITransAddr::translateValue(), and UpdateAnalysisInformation().
void DominatorTree::viewGraph | ( | ) |
Definition at line 36 of file DomPrinter.cpp.
References llvm::errs(), and viewGraph().
Referenced by viewGraph().
Definition at line 28 of file DomPrinter.cpp.
References llvm::errs(), Name, and llvm::ViewGraph().