10b57cec5SDimitry Andric //===- Dominators.h - Dominator Info Calculation ----------------*- C++ -*-===//
20b57cec5SDimitry Andric //
30b57cec5SDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
40b57cec5SDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
50b57cec5SDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
60b57cec5SDimitry Andric //
70b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
80b57cec5SDimitry Andric //
90b57cec5SDimitry Andric // This file defines the DominatorTree class, which provides fast and efficient
100b57cec5SDimitry Andric // dominance queries.
110b57cec5SDimitry Andric //
120b57cec5SDimitry Andric //===----------------------------------------------------------------------===//
130b57cec5SDimitry Andric 
140b57cec5SDimitry Andric #ifndef LLVM_IR_DOMINATORS_H
150b57cec5SDimitry Andric #define LLVM_IR_DOMINATORS_H
160b57cec5SDimitry Andric 
1781ad6265SDimitry Andric #include "llvm/ADT/APInt.h"
181fd87a68SDimitry Andric #include "llvm/ADT/ArrayRef.h"
190b57cec5SDimitry Andric #include "llvm/ADT/DenseMapInfo.h"
200b57cec5SDimitry Andric #include "llvm/ADT/DepthFirstIterator.h"
210b57cec5SDimitry Andric #include "llvm/ADT/Hashing.h"
221fd87a68SDimitry Andric #include "llvm/ADT/PointerIntPair.h"
231fd87a68SDimitry Andric #include "llvm/ADT/SmallVector.h"
241fd87a68SDimitry Andric #include "llvm/ADT/Twine.h"
2581ad6265SDimitry Andric #include "llvm/ADT/ilist_iterator.h"
260b57cec5SDimitry Andric #include "llvm/IR/BasicBlock.h"
270b57cec5SDimitry Andric #include "llvm/IR/CFG.h"
280b57cec5SDimitry Andric #include "llvm/IR/PassManager.h"
291fd87a68SDimitry Andric #include "llvm/IR/Use.h"
300b57cec5SDimitry Andric #include "llvm/Pass.h"
311fd87a68SDimitry Andric #include "llvm/Support/CFGDiff.h"
321fd87a68SDimitry Andric #include "llvm/Support/CFGUpdate.h"
330b57cec5SDimitry Andric #include "llvm/Support/GenericDomTree.h"
3481ad6265SDimitry Andric #include <algorithm>
350b57cec5SDimitry Andric #include <utility>
360b57cec5SDimitry Andric 
370b57cec5SDimitry Andric namespace llvm {
380b57cec5SDimitry Andric 
390b57cec5SDimitry Andric class Function;
400b57cec5SDimitry Andric class Instruction;
410b57cec5SDimitry Andric class Module;
421fd87a68SDimitry Andric class Value;
430b57cec5SDimitry Andric class raw_ostream;
441fd87a68SDimitry Andric template <class GraphType> struct GraphTraits;
450b57cec5SDimitry Andric 
460b57cec5SDimitry Andric extern template class DomTreeNodeBase<BasicBlock>;
470b57cec5SDimitry Andric extern template class DominatorTreeBase<BasicBlock, false>; // DomTree
480b57cec5SDimitry Andric extern template class DominatorTreeBase<BasicBlock, true>; // PostDomTree
490b57cec5SDimitry Andric 
500b57cec5SDimitry Andric extern template class cfg::Update<BasicBlock *>;
510b57cec5SDimitry Andric 
520b57cec5SDimitry Andric namespace DomTreeBuilder {
530b57cec5SDimitry Andric using BBDomTree = DomTreeBase<BasicBlock>;
540b57cec5SDimitry Andric using BBPostDomTree = PostDomTreeBase<BasicBlock>;
550b57cec5SDimitry Andric 
560b57cec5SDimitry Andric using BBUpdates = ArrayRef<llvm::cfg::Update<BasicBlock *>>;
570b57cec5SDimitry Andric 
58e8d8bef9SDimitry Andric using BBDomTreeGraphDiff = GraphDiff<BasicBlock *, false>;
59e8d8bef9SDimitry Andric using BBPostDomTreeGraphDiff = GraphDiff<BasicBlock *, true>;
60e8d8bef9SDimitry Andric 
610b57cec5SDimitry Andric extern template void Calculate<BBDomTree>(BBDomTree &DT);
620b57cec5SDimitry Andric extern template void CalculateWithUpdates<BBDomTree>(BBDomTree &DT,
630b57cec5SDimitry Andric                                                      BBUpdates U);
640b57cec5SDimitry Andric 
650b57cec5SDimitry Andric extern template void Calculate<BBPostDomTree>(BBPostDomTree &DT);
660b57cec5SDimitry Andric 
670b57cec5SDimitry Andric extern template void InsertEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From,
680b57cec5SDimitry Andric                                            BasicBlock *To);
690b57cec5SDimitry Andric extern template void InsertEdge<BBPostDomTree>(BBPostDomTree &DT,
700b57cec5SDimitry Andric                                                BasicBlock *From,
710b57cec5SDimitry Andric                                                BasicBlock *To);
720b57cec5SDimitry Andric 
730b57cec5SDimitry Andric extern template void DeleteEdge<BBDomTree>(BBDomTree &DT, BasicBlock *From,
740b57cec5SDimitry Andric                                            BasicBlock *To);
750b57cec5SDimitry Andric extern template void DeleteEdge<BBPostDomTree>(BBPostDomTree &DT,
760b57cec5SDimitry Andric                                                BasicBlock *From,
770b57cec5SDimitry Andric                                                BasicBlock *To);
780b57cec5SDimitry Andric 
79e8d8bef9SDimitry Andric extern template void ApplyUpdates<BBDomTree>(BBDomTree &DT,
80e8d8bef9SDimitry Andric                                              BBDomTreeGraphDiff &,
81e8d8bef9SDimitry Andric                                              BBDomTreeGraphDiff *);
82e8d8bef9SDimitry Andric extern template void ApplyUpdates<BBPostDomTree>(BBPostDomTree &DT,
83e8d8bef9SDimitry Andric                                                  BBPostDomTreeGraphDiff &,
84e8d8bef9SDimitry Andric                                                  BBPostDomTreeGraphDiff *);
850b57cec5SDimitry Andric 
860b57cec5SDimitry Andric extern template bool Verify<BBDomTree>(const BBDomTree &DT,
870b57cec5SDimitry Andric                                        BBDomTree::VerificationLevel VL);
880b57cec5SDimitry Andric extern template bool Verify<BBPostDomTree>(const BBPostDomTree &DT,
890b57cec5SDimitry Andric                                            BBPostDomTree::VerificationLevel VL);
900b57cec5SDimitry Andric }  // namespace DomTreeBuilder
910b57cec5SDimitry Andric 
920b57cec5SDimitry Andric using DomTreeNode = DomTreeNodeBase<BasicBlock>;
930b57cec5SDimitry Andric 
940b57cec5SDimitry Andric class BasicBlockEdge {
950b57cec5SDimitry Andric   const BasicBlock *Start;
960b57cec5SDimitry Andric   const BasicBlock *End;
970b57cec5SDimitry Andric 
980b57cec5SDimitry Andric public:
BasicBlockEdge(const BasicBlock * Start_,const BasicBlock * End_)990b57cec5SDimitry Andric   BasicBlockEdge(const BasicBlock *Start_, const BasicBlock *End_) :
1000b57cec5SDimitry Andric     Start(Start_), End(End_) {}
1010b57cec5SDimitry Andric 
BasicBlockEdge(const std::pair<BasicBlock *,BasicBlock * > & Pair)1020b57cec5SDimitry Andric   BasicBlockEdge(const std::pair<BasicBlock *, BasicBlock *> &Pair)
1030b57cec5SDimitry Andric       : Start(Pair.first), End(Pair.second) {}
1040b57cec5SDimitry Andric 
BasicBlockEdge(const std::pair<const BasicBlock *,const BasicBlock * > & Pair)1050b57cec5SDimitry Andric   BasicBlockEdge(const std::pair<const BasicBlock *, const BasicBlock *> &Pair)
1060b57cec5SDimitry Andric       : Start(Pair.first), End(Pair.second) {}
1070b57cec5SDimitry Andric 
getStart()1080b57cec5SDimitry Andric   const BasicBlock *getStart() const {
1090b57cec5SDimitry Andric     return Start;
1100b57cec5SDimitry Andric   }
1110b57cec5SDimitry Andric 
getEnd()1120b57cec5SDimitry Andric   const BasicBlock *getEnd() const {
1130b57cec5SDimitry Andric     return End;
1140b57cec5SDimitry Andric   }
1150b57cec5SDimitry Andric 
1160b57cec5SDimitry Andric   /// Check if this is the only edge between Start and End.
1170b57cec5SDimitry Andric   bool isSingleEdge() const;
1180b57cec5SDimitry Andric };
1190b57cec5SDimitry Andric 
1200b57cec5SDimitry Andric template <> struct DenseMapInfo<BasicBlockEdge> {
1210b57cec5SDimitry Andric   using BBInfo = DenseMapInfo<const BasicBlock *>;
1220b57cec5SDimitry Andric 
1230b57cec5SDimitry Andric   static unsigned getHashValue(const BasicBlockEdge *V);
1240b57cec5SDimitry Andric 
1250b57cec5SDimitry Andric   static inline BasicBlockEdge getEmptyKey() {
1260b57cec5SDimitry Andric     return BasicBlockEdge(BBInfo::getEmptyKey(), BBInfo::getEmptyKey());
1270b57cec5SDimitry Andric   }
1280b57cec5SDimitry Andric 
1290b57cec5SDimitry Andric   static inline BasicBlockEdge getTombstoneKey() {
1300b57cec5SDimitry Andric     return BasicBlockEdge(BBInfo::getTombstoneKey(), BBInfo::getTombstoneKey());
1310b57cec5SDimitry Andric   }
1320b57cec5SDimitry Andric 
1330b57cec5SDimitry Andric   static unsigned getHashValue(const BasicBlockEdge &Edge) {
1340b57cec5SDimitry Andric     return hash_combine(BBInfo::getHashValue(Edge.getStart()),
1350b57cec5SDimitry Andric                         BBInfo::getHashValue(Edge.getEnd()));
1360b57cec5SDimitry Andric   }
1370b57cec5SDimitry Andric 
1380b57cec5SDimitry Andric   static bool isEqual(const BasicBlockEdge &LHS, const BasicBlockEdge &RHS) {
1390b57cec5SDimitry Andric     return BBInfo::isEqual(LHS.getStart(), RHS.getStart()) &&
1400b57cec5SDimitry Andric            BBInfo::isEqual(LHS.getEnd(), RHS.getEnd());
1410b57cec5SDimitry Andric   }
1420b57cec5SDimitry Andric };
1430b57cec5SDimitry Andric 
1440b57cec5SDimitry Andric /// Concrete subclass of DominatorTreeBase that is used to compute a
1450b57cec5SDimitry Andric /// normal dominator tree.
1460b57cec5SDimitry Andric ///
1470b57cec5SDimitry Andric /// Definition: A block is said to be forward statically reachable if there is
1480b57cec5SDimitry Andric /// a path from the entry of the function to the block.  A statically reachable
1490b57cec5SDimitry Andric /// block may become statically unreachable during optimization.
1500b57cec5SDimitry Andric ///
1510b57cec5SDimitry Andric /// A forward unreachable block may appear in the dominator tree, or it may
1520b57cec5SDimitry Andric /// not.  If it does, dominance queries will return results as if all reachable
1530b57cec5SDimitry Andric /// blocks dominate it.  When asking for a Node corresponding to a potentially
1540b57cec5SDimitry Andric /// unreachable block, calling code must handle the case where the block was
1550b57cec5SDimitry Andric /// unreachable and the result of getNode() is nullptr.
1560b57cec5SDimitry Andric ///
1570b57cec5SDimitry Andric /// Generally, a block known to be unreachable when the dominator tree is
1580b57cec5SDimitry Andric /// constructed will not be in the tree.  One which becomes unreachable after
1590b57cec5SDimitry Andric /// the dominator tree is initially constructed may still exist in the tree,
1600b57cec5SDimitry Andric /// even if the tree is properly updated. Calling code should not rely on the
1610b57cec5SDimitry Andric /// preceding statements; this is stated only to assist human understanding.
1620b57cec5SDimitry Andric class DominatorTree : public DominatorTreeBase<BasicBlock, false> {
1630b57cec5SDimitry Andric  public:
1640b57cec5SDimitry Andric   using Base = DominatorTreeBase<BasicBlock, false>;
1650b57cec5SDimitry Andric 
1660b57cec5SDimitry Andric   DominatorTree() = default;
1670b57cec5SDimitry Andric   explicit DominatorTree(Function &F) { recalculate(F); }
1680b57cec5SDimitry Andric   explicit DominatorTree(DominatorTree &DT, DomTreeBuilder::BBUpdates U) {
1690b57cec5SDimitry Andric     recalculate(*DT.Parent, U);
1700b57cec5SDimitry Andric   }
1710b57cec5SDimitry Andric 
1720b57cec5SDimitry Andric   /// Handle invalidation explicitly.
1730b57cec5SDimitry Andric   bool invalidate(Function &F, const PreservedAnalyses &PA,
1740b57cec5SDimitry Andric                   FunctionAnalysisManager::Invalidator &);
1750b57cec5SDimitry Andric 
1760b57cec5SDimitry Andric   // Ensure base-class overloads are visible.
1770b57cec5SDimitry Andric   using Base::dominates;
1780b57cec5SDimitry Andric 
179fe6060f1SDimitry Andric   /// Return true if the (end of the) basic block BB dominates the use U.
180fe6060f1SDimitry Andric   bool dominates(const BasicBlock *BB, const Use &U) const;
181fe6060f1SDimitry Andric 
182e8d8bef9SDimitry Andric   /// Return true if value Def dominates use U, in the sense that Def is
183e8d8bef9SDimitry Andric   /// available at U, and could be substituted as the used value without
184e8d8bef9SDimitry Andric   /// violating the SSA dominance requirement.
1850b57cec5SDimitry Andric   ///
186e8d8bef9SDimitry Andric   /// In particular, it is worth noting that:
187e8d8bef9SDimitry Andric   ///  * Non-instruction Defs dominate everything.
188e8d8bef9SDimitry Andric   ///  * Def does not dominate a use in Def itself (outside of degenerate cases
189e8d8bef9SDimitry Andric   ///    like unreachable code or trivial phi cycles).
19006c3fb27SDimitry Andric   ///  * Invoke Defs only dominate uses in their default destination.
191e8d8bef9SDimitry Andric   bool dominates(const Value *Def, const Use &U) const;
192e8d8bef9SDimitry Andric   /// Return true if value Def dominates all possible uses inside instruction
193e8d8bef9SDimitry Andric   /// User. Same comments as for the Use-based API apply.
194e8d8bef9SDimitry Andric   bool dominates(const Value *Def, const Instruction *User) const;
195bdd1243dSDimitry Andric 
196bdd1243dSDimitry Andric   /// Returns true if Def would dominate a use in any instruction in BB.
197bdd1243dSDimitry Andric   /// If Def is an instruction in BB, then Def does not dominate BB.
198bdd1243dSDimitry Andric   ///
199bdd1243dSDimitry Andric   /// Does not accept Value to avoid ambiguity with dominance checks between
200bdd1243dSDimitry Andric   /// two basic blocks.
2010b57cec5SDimitry Andric   bool dominates(const Instruction *Def, const BasicBlock *BB) const;
2020b57cec5SDimitry Andric 
2030b57cec5SDimitry Andric   /// Return true if an edge dominates a use.
2040b57cec5SDimitry Andric   ///
2050b57cec5SDimitry Andric   /// If BBE is not a unique edge between start and end of the edge, it can
2060b57cec5SDimitry Andric   /// never dominate the use.
2070b57cec5SDimitry Andric   bool dominates(const BasicBlockEdge &BBE, const Use &U) const;
2080b57cec5SDimitry Andric   bool dominates(const BasicBlockEdge &BBE, const BasicBlock *BB) const;
2095ffd83dbSDimitry Andric   /// Returns true if edge \p BBE1 dominates edge \p BBE2.
2105ffd83dbSDimitry Andric   bool dominates(const BasicBlockEdge &BBE1, const BasicBlockEdge &BBE2) const;
2110b57cec5SDimitry Andric 
2120b57cec5SDimitry Andric   // Ensure base class overloads are visible.
2130b57cec5SDimitry Andric   using Base::isReachableFromEntry;
2140b57cec5SDimitry Andric 
2150b57cec5SDimitry Andric   /// Provide an overload for a Use.
2160b57cec5SDimitry Andric   bool isReachableFromEntry(const Use &U) const;
2170b57cec5SDimitry Andric 
218bdd1243dSDimitry Andric   // Ensure base class overloads are visible.
219bdd1243dSDimitry Andric   using Base::findNearestCommonDominator;
220bdd1243dSDimitry Andric 
221bdd1243dSDimitry Andric   /// Find the nearest instruction I that dominates both I1 and I2, in the sense
222bdd1243dSDimitry Andric   /// that a result produced before I will be available at both I1 and I2.
223bdd1243dSDimitry Andric   Instruction *findNearestCommonDominator(Instruction *I1,
224bdd1243dSDimitry Andric                                           Instruction *I2) const;
225bdd1243dSDimitry Andric 
2260b57cec5SDimitry Andric   // Pop up a GraphViz/gv window with the Dominator Tree rendered using `dot`.
2270b57cec5SDimitry Andric   void viewGraph(const Twine &Name, const Twine &Title);
2280b57cec5SDimitry Andric   void viewGraph();
2290b57cec5SDimitry Andric };
2300b57cec5SDimitry Andric 
2310b57cec5SDimitry Andric //===-------------------------------------
2320b57cec5SDimitry Andric // DominatorTree GraphTraits specializations so the DominatorTree can be
2330b57cec5SDimitry Andric // iterable by generic graph iterators.
2340b57cec5SDimitry Andric 
2350b57cec5SDimitry Andric template <class Node, class ChildIterator> struct DomTreeGraphTraitsBase {
2360b57cec5SDimitry Andric   using NodeRef = Node *;
2370b57cec5SDimitry Andric   using ChildIteratorType = ChildIterator;
2380b57cec5SDimitry Andric   using nodes_iterator = df_iterator<Node *, df_iterator_default_set<Node*>>;
2390b57cec5SDimitry Andric 
2400b57cec5SDimitry Andric   static NodeRef getEntryNode(NodeRef N) { return N; }
2410b57cec5SDimitry Andric   static ChildIteratorType child_begin(NodeRef N) { return N->begin(); }
2420b57cec5SDimitry Andric   static ChildIteratorType child_end(NodeRef N) { return N->end(); }
2430b57cec5SDimitry Andric 
2440b57cec5SDimitry Andric   static nodes_iterator nodes_begin(NodeRef N) {
2450b57cec5SDimitry Andric     return df_begin(getEntryNode(N));
2460b57cec5SDimitry Andric   }
2470b57cec5SDimitry Andric 
2480b57cec5SDimitry Andric   static nodes_iterator nodes_end(NodeRef N) { return df_end(getEntryNode(N)); }
2490b57cec5SDimitry Andric };
2500b57cec5SDimitry Andric 
2510b57cec5SDimitry Andric template <>
2520b57cec5SDimitry Andric struct GraphTraits<DomTreeNode *>
2535ffd83dbSDimitry Andric     : public DomTreeGraphTraitsBase<DomTreeNode, DomTreeNode::const_iterator> {
2545ffd83dbSDimitry Andric };
2550b57cec5SDimitry Andric 
2560b57cec5SDimitry Andric template <>
2570b57cec5SDimitry Andric struct GraphTraits<const DomTreeNode *>
2580b57cec5SDimitry Andric     : public DomTreeGraphTraitsBase<const DomTreeNode,
2590b57cec5SDimitry Andric                                     DomTreeNode::const_iterator> {};
2600b57cec5SDimitry Andric 
2610b57cec5SDimitry Andric template <> struct GraphTraits<DominatorTree*>
2620b57cec5SDimitry Andric   : public GraphTraits<DomTreeNode*> {
2630b57cec5SDimitry Andric   static NodeRef getEntryNode(DominatorTree *DT) { return DT->getRootNode(); }
2640b57cec5SDimitry Andric 
2650b57cec5SDimitry Andric   static nodes_iterator nodes_begin(DominatorTree *N) {
2660b57cec5SDimitry Andric     return df_begin(getEntryNode(N));
2670b57cec5SDimitry Andric   }
2680b57cec5SDimitry Andric 
2690b57cec5SDimitry Andric   static nodes_iterator nodes_end(DominatorTree *N) {
2700b57cec5SDimitry Andric     return df_end(getEntryNode(N));
2710b57cec5SDimitry Andric   }
2720b57cec5SDimitry Andric };
2730b57cec5SDimitry Andric 
2740b57cec5SDimitry Andric /// Analysis pass which computes a \c DominatorTree.
2750b57cec5SDimitry Andric class DominatorTreeAnalysis : public AnalysisInfoMixin<DominatorTreeAnalysis> {
2760b57cec5SDimitry Andric   friend AnalysisInfoMixin<DominatorTreeAnalysis>;
2770b57cec5SDimitry Andric   static AnalysisKey Key;
2780b57cec5SDimitry Andric 
2790b57cec5SDimitry Andric public:
2800b57cec5SDimitry Andric   /// Provide the result typedef for this analysis pass.
2810b57cec5SDimitry Andric   using Result = DominatorTree;
2820b57cec5SDimitry Andric 
2830b57cec5SDimitry Andric   /// Run the analysis pass over a function and produce a dominator tree.
2840b57cec5SDimitry Andric   DominatorTree run(Function &F, FunctionAnalysisManager &);
2850b57cec5SDimitry Andric };
2860b57cec5SDimitry Andric 
2870b57cec5SDimitry Andric /// Printer pass for the \c DominatorTree.
2880b57cec5SDimitry Andric class DominatorTreePrinterPass
2890b57cec5SDimitry Andric     : public PassInfoMixin<DominatorTreePrinterPass> {
2900b57cec5SDimitry Andric   raw_ostream &OS;
2910b57cec5SDimitry Andric 
2920b57cec5SDimitry Andric public:
2930b57cec5SDimitry Andric   explicit DominatorTreePrinterPass(raw_ostream &OS);
2940b57cec5SDimitry Andric 
2950b57cec5SDimitry Andric   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
2961db9f3b2SDimitry Andric 
2971db9f3b2SDimitry Andric   static bool isRequired() { return true; }
2980b57cec5SDimitry Andric };
2990b57cec5SDimitry Andric 
3000b57cec5SDimitry Andric /// Verifier pass for the \c DominatorTree.
3010b57cec5SDimitry Andric struct DominatorTreeVerifierPass : PassInfoMixin<DominatorTreeVerifierPass> {
3020b57cec5SDimitry Andric   PreservedAnalyses run(Function &F, FunctionAnalysisManager &AM);
3031db9f3b2SDimitry Andric   static bool isRequired() { return true; }
3040b57cec5SDimitry Andric };
3050b57cec5SDimitry Andric 
306349cc55cSDimitry Andric /// Enables verification of dominator trees.
307349cc55cSDimitry Andric ///
308349cc55cSDimitry Andric /// This check is expensive and is disabled by default.  `-verify-dom-info`
309349cc55cSDimitry Andric /// allows selectively enabling the check without needing to recompile.
310349cc55cSDimitry Andric extern bool VerifyDomInfo;
311349cc55cSDimitry Andric 
3120b57cec5SDimitry Andric /// Legacy analysis pass which computes a \c DominatorTree.
3130b57cec5SDimitry Andric class DominatorTreeWrapperPass : public FunctionPass {
3140b57cec5SDimitry Andric   DominatorTree DT;
3150b57cec5SDimitry Andric 
3160b57cec5SDimitry Andric public:
3170b57cec5SDimitry Andric   static char ID;
3180b57cec5SDimitry Andric 
319480093f4SDimitry Andric   DominatorTreeWrapperPass();
3200b57cec5SDimitry Andric 
3210b57cec5SDimitry Andric   DominatorTree &getDomTree() { return DT; }
3220b57cec5SDimitry Andric   const DominatorTree &getDomTree() const { return DT; }
3230b57cec5SDimitry Andric 
3240b57cec5SDimitry Andric   bool runOnFunction(Function &F) override;
3250b57cec5SDimitry Andric 
3260b57cec5SDimitry Andric   void verifyAnalysis() const override;
3270b57cec5SDimitry Andric 
3280b57cec5SDimitry Andric   void getAnalysisUsage(AnalysisUsage &AU) const override {
3290b57cec5SDimitry Andric     AU.setPreservesAll();
3300b57cec5SDimitry Andric   }
3310b57cec5SDimitry Andric 
3325ffd83dbSDimitry Andric   void releaseMemory() override { DT.reset(); }
3330b57cec5SDimitry Andric 
3340b57cec5SDimitry Andric   void print(raw_ostream &OS, const Module *M = nullptr) const override;
3350b57cec5SDimitry Andric };
3360b57cec5SDimitry Andric } // end namespace llvm
3370b57cec5SDimitry Andric 
3380b57cec5SDimitry Andric #endif // LLVM_IR_DOMINATORS_H
339