1 //===- RegionInfoImpl.h - SESE region detection analysis --------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
9 // Detects single entry single exit regions in the control flow graph.
10 //===----------------------------------------------------------------------===//
12 #ifndef LLVM_ANALYSIS_REGIONINFOIMPL_H
13 #define LLVM_ANALYSIS_REGIONINFOIMPL_H
15 #include "llvm/ADT/GraphTraits.h"
16 #include "llvm/ADT/PostOrderIterator.h"
17 #include "llvm/ADT/STLExtras.h"
18 #include "llvm/ADT/SmallVector.h"
19 #include "llvm/ADT/iterator_range.h"
20 #include "llvm/Analysis/DominanceFrontier.h"
21 #include "llvm/Analysis/LoopInfo.h"
22 #include "llvm/Analysis/PostDominators.h"
23 #include "llvm/Analysis/RegionInfo.h"
24 #include "llvm/Analysis/RegionIterator.h"
25 #include "llvm/Config/llvm-config.h"
26 #include "llvm/Support/Debug.h"
27 #include "llvm/Support/ErrorHandling.h"
28 #include "llvm/Support/raw_ostream.h"
35 #include <type_traits>
38 #define DEBUG_TYPE "region"
42 //===----------------------------------------------------------------------===//
43 /// RegionBase Implementation
45 RegionBase<Tr>::RegionBase(BlockT *Entry, BlockT *Exit,
46 typename Tr::RegionInfoT *RInfo, DomTreeT *dt,
48 : RegionNodeBase<Tr>(Parent, Entry, 1), RI(RInfo), DT(dt), exit(Exit) {}
51 RegionBase<Tr>::~RegionBase() {
52 // Only clean the cache for this Region. Caches of child Regions will be
53 // cleaned when the child Regions are deleted.
58 void RegionBase<Tr>::replaceEntry(BlockT *BB) {
59 this->entry.setPointer(BB);
63 void RegionBase<Tr>::replaceExit(BlockT *BB) {
64 assert(exit && "No exit to replace!");
69 void RegionBase<Tr>::replaceEntryRecursive(BlockT *NewEntry) {
70 std::vector<RegionT *> RegionQueue;
71 BlockT *OldEntry = getEntry();
73 RegionQueue.push_back(static_cast<RegionT *>(this));
74 while (!RegionQueue.empty()) {
75 RegionT *R = RegionQueue.back();
76 RegionQueue.pop_back();
78 R->replaceEntry(NewEntry);
79 for (std::unique_ptr<RegionT> &Child : *R) {
80 if (Child->getEntry() == OldEntry)
81 RegionQueue.push_back(Child.get());
87 void RegionBase<Tr>::replaceExitRecursive(BlockT *NewExit) {
88 std::vector<RegionT *> RegionQueue;
89 BlockT *OldExit = getExit();
91 RegionQueue.push_back(static_cast<RegionT *>(this));
92 while (!RegionQueue.empty()) {
93 RegionT *R = RegionQueue.back();
94 RegionQueue.pop_back();
96 R->replaceExit(NewExit);
97 for (std::unique_ptr<RegionT> &Child : *R) {
98 if (Child->getExit() == OldExit)
99 RegionQueue.push_back(Child.get());
105 bool RegionBase<Tr>::contains(const BlockT *B) const {
106 BlockT *BB = const_cast<BlockT *>(B);
108 if (!DT->getNode(BB))
111 BlockT *entry = getEntry(), *exit = getExit();
117 return (DT->dominates(entry, BB) &&
118 !(DT->dominates(exit, BB) && DT->dominates(entry, exit)));
122 bool RegionBase<Tr>::contains(const LoopT *L) const {
123 // BBs that are not part of any loop are element of the Loop
124 // described by the NULL pointer. This loop is not part of any region,
125 // except if the region describes the whole function.
127 return getExit() == nullptr;
129 if (!contains(L->getHeader()))
132 SmallVector<BlockT *, 8> ExitingBlocks;
133 L->getExitingBlocks(ExitingBlocks);
135 for (BlockT *BB : ExitingBlocks) {
144 typename Tr::LoopT *RegionBase<Tr>::outermostLoopInRegion(LoopT *L) const {
148 while (L && contains(L->getParentLoop())) {
149 L = L->getParentLoop();
156 typename Tr::LoopT *RegionBase<Tr>::outermostLoopInRegion(LoopInfoT *LI,
158 assert(LI && BB && "LI and BB cannot be null!");
159 LoopT *L = LI->getLoopFor(BB);
160 return outermostLoopInRegion(L);
164 typename RegionBase<Tr>::BlockT *RegionBase<Tr>::getEnteringBlock() const {
165 BlockT *entry = getEntry();
166 BlockT *enteringBlock = nullptr;
168 for (BlockT *Pred : make_range(InvBlockTraits::child_begin(entry),
169 InvBlockTraits::child_end(entry))) {
170 if (DT->getNode(Pred) && !contains(Pred)) {
174 enteringBlock = Pred;
178 return enteringBlock;
182 bool RegionBase<Tr>::getExitingBlocks(
183 SmallVectorImpl<BlockT *> &Exitings) const {
184 bool CoverAll = true;
189 for (PredIterTy PI = InvBlockTraits::child_begin(exit),
190 PE = InvBlockTraits::child_end(exit);
193 if (contains(Pred)) {
194 Exitings.push_back(Pred);
205 typename RegionBase<Tr>::BlockT *RegionBase<Tr>::getExitingBlock() const {
206 BlockT *exit = getExit();
207 BlockT *exitingBlock = nullptr;
212 for (BlockT *Pred : make_range(InvBlockTraits::child_begin(exit),
213 InvBlockTraits::child_end(exit))) {
214 if (contains(Pred)) {
226 bool RegionBase<Tr>::isSimple() const {
227 return !isTopLevelRegion() && getEnteringBlock() && getExitingBlock();
231 std::string RegionBase<Tr>::getNameStr() const {
232 std::string exitName;
233 std::string entryName;
235 if (getEntry()->getName().empty()) {
236 raw_string_ostream OS(entryName);
238 getEntry()->printAsOperand(OS, false);
240 entryName = getEntry()->getName();
243 if (getExit()->getName().empty()) {
244 raw_string_ostream OS(exitName);
246 getExit()->printAsOperand(OS, false);
248 exitName = getExit()->getName();
250 exitName = "<Function Return>";
252 return entryName + " => " + exitName;
256 void RegionBase<Tr>::verifyBBInRegion(BlockT *BB) const {
258 report_fatal_error("Broken region found: enumerated BB not in region!");
260 BlockT *entry = getEntry(), *exit = getExit();
263 make_range(BlockTraits::child_begin(BB), BlockTraits::child_end(BB))) {
264 if (!contains(Succ) && exit != Succ)
265 report_fatal_error("Broken region found: edges leaving the region must go "
266 "to the exit node!");
270 for (BlockT *Pred : make_range(InvBlockTraits::child_begin(BB),
271 InvBlockTraits::child_end(BB))) {
273 report_fatal_error("Broken region found: edges entering the region must "
274 "go to the entry node!");
280 void RegionBase<Tr>::verifyWalk(BlockT *BB, std::set<BlockT *> *visited) const {
281 BlockT *exit = getExit();
285 verifyBBInRegion(BB);
288 make_range(BlockTraits::child_begin(BB), BlockTraits::child_end(BB))) {
289 if (Succ != exit && visited->find(Succ) == visited->end())
290 verifyWalk(Succ, visited);
295 void RegionBase<Tr>::verifyRegion() const {
296 // Only do verification when user wants to, otherwise this expensive check
297 // will be invoked by PMDataManager::verifyPreservedAnalysis when
298 // a regionpass (marked PreservedAll) finish.
299 if (!RegionInfoBase<Tr>::VerifyRegionInfo)
302 std::set<BlockT *> visited;
303 verifyWalk(getEntry(), &visited);
307 void RegionBase<Tr>::verifyRegionNest() const {
308 for (const std::unique_ptr<RegionT> &R : *this)
309 R->verifyRegionNest();
315 typename RegionBase<Tr>::element_iterator RegionBase<Tr>::element_begin() {
316 return GraphTraits<RegionT *>::nodes_begin(static_cast<RegionT *>(this));
320 typename RegionBase<Tr>::element_iterator RegionBase<Tr>::element_end() {
321 return GraphTraits<RegionT *>::nodes_end(static_cast<RegionT *>(this));
325 typename RegionBase<Tr>::const_element_iterator
326 RegionBase<Tr>::element_begin() const {
327 return GraphTraits<const RegionT *>::nodes_begin(
328 static_cast<const RegionT *>(this));
332 typename RegionBase<Tr>::const_element_iterator
333 RegionBase<Tr>::element_end() const {
334 return GraphTraits<const RegionT *>::nodes_end(
335 static_cast<const RegionT *>(this));
339 typename Tr::RegionT *RegionBase<Tr>::getSubRegionNode(BlockT *BB) const {
340 using RegionT = typename Tr::RegionT;
342 RegionT *R = RI->getRegionFor(BB);
347 // If we pass the BB out of this region, that means our code is broken.
348 assert(contains(R) && "BB not in current region!");
350 while (contains(R->getParent()) && R->getParent() != this)
353 if (R->getEntry() != BB)
360 typename Tr::RegionNodeT *RegionBase<Tr>::getBBNode(BlockT *BB) const {
361 assert(contains(BB) && "Can get BB node out of this region!");
363 typename BBNodeMapT::const_iterator at = BBNodeMap.find(BB);
365 if (at == BBNodeMap.end()) {
366 auto Deconst = const_cast<RegionBase<Tr> *>(this);
367 typename BBNodeMapT::value_type V = {
369 llvm::make_unique<RegionNodeT>(static_cast<RegionT *>(Deconst), BB)};
370 at = BBNodeMap.insert(std::move(V)).first;
372 return at->second.get();
376 typename Tr::RegionNodeT *RegionBase<Tr>::getNode(BlockT *BB) const {
377 assert(contains(BB) && "Can get BB node out of this region!");
378 if (RegionT *Child = getSubRegionNode(BB))
379 return Child->getNode();
381 return getBBNode(BB);
385 void RegionBase<Tr>::transferChildrenTo(RegionT *To) {
386 for (std::unique_ptr<RegionT> &R : *this) {
388 To->children.push_back(std::move(R));
394 void RegionBase<Tr>::addSubRegion(RegionT *SubRegion, bool moveChildren) {
395 assert(!SubRegion->parent && "SubRegion already has a parent!");
396 assert(llvm::find_if(*this,
397 [&](const std::unique_ptr<RegionT> &R) {
398 return R.get() == SubRegion;
399 }) == children.end() &&
400 "Subregion already exists!");
402 SubRegion->parent = static_cast<RegionT *>(this);
403 children.push_back(std::unique_ptr<RegionT>(SubRegion));
408 assert(SubRegion->children.empty() &&
409 "SubRegions that contain children are not supported");
411 for (RegionNodeT *Element : elements()) {
412 if (!Element->isSubRegion()) {
413 BlockT *BB = Element->template getNodeAs<BlockT>();
415 if (SubRegion->contains(BB))
416 RI->setRegionFor(BB, SubRegion);
420 std::vector<std::unique_ptr<RegionT>> Keep;
421 for (std::unique_ptr<RegionT> &R : *this) {
422 if (SubRegion->contains(R.get()) && R.get() != SubRegion) {
423 R->parent = SubRegion;
424 SubRegion->children.push_back(std::move(R));
426 Keep.push_back(std::move(R));
432 std::move_iterator<typename RegionSet::iterator>(Keep.begin()),
433 std::move_iterator<typename RegionSet::iterator>(Keep.end()));
437 typename Tr::RegionT *RegionBase<Tr>::removeSubRegion(RegionT *Child) {
438 assert(Child->parent == this && "Child is not a child of this region!");
439 Child->parent = nullptr;
440 typename RegionSet::iterator I =
441 llvm::find_if(children, [&](const std::unique_ptr<RegionT> &R) {
442 return R.get() == Child;
444 assert(I != children.end() && "Region does not exit. Unable to remove.");
445 children.erase(children.begin() + (I - begin()));
450 unsigned RegionBase<Tr>::getDepth() const {
453 for (RegionT *R = getParent(); R != nullptr; R = R->getParent())
460 typename Tr::RegionT *RegionBase<Tr>::getExpandedRegion() const {
461 unsigned NumSuccessors = Tr::getNumSuccessors(exit);
463 if (NumSuccessors == 0)
466 RegionT *R = RI->getRegionFor(exit);
468 if (R->getEntry() != exit) {
469 for (BlockT *Pred : make_range(InvBlockTraits::child_begin(getExit()),
470 InvBlockTraits::child_end(getExit())))
473 if (Tr::getNumSuccessors(exit) == 1)
474 return new RegionT(getEntry(), *BlockTraits::child_begin(exit), RI, DT);
478 while (R->getParent() && R->getParent()->getEntry() == exit)
481 for (BlockT *Pred : make_range(InvBlockTraits::child_begin(getExit()),
482 InvBlockTraits::child_end(getExit()))) {
483 if (!(contains(Pred) || R->contains(Pred)))
487 return new RegionT(getEntry(), R->getExit(), RI, DT);
491 void RegionBase<Tr>::print(raw_ostream &OS, bool print_tree, unsigned level,
492 PrintStyle Style) const {
494 OS.indent(level * 2) << '[' << level << "] " << getNameStr();
496 OS.indent(level * 2) << getNameStr();
500 if (Style != PrintNone) {
501 OS.indent(level * 2) << "{\n";
502 OS.indent(level * 2 + 2);
504 if (Style == PrintBB) {
505 for (const auto *BB : blocks())
506 OS << BB->getName() << ", "; // TODO: remove the last ","
507 } else if (Style == PrintRN) {
508 for (const RegionNodeT *Element : elements()) {
509 OS << *Element << ", "; // TODO: remove the last ",
517 for (const std::unique_ptr<RegionT> &R : *this)
518 R->print(OS, print_tree, level + 1, Style);
521 if (Style != PrintNone)
522 OS.indent(level * 2) << "} \n";
525 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
527 void RegionBase<Tr>::dump() const {
528 print(dbgs(), true, getDepth(), RegionInfoBase<Tr>::printStyle);
533 void RegionBase<Tr>::clearNodeCache() {
535 for (std::unique_ptr<RegionT> &R : *this)
539 //===----------------------------------------------------------------------===//
540 // RegionInfoBase implementation
544 RegionInfoBase<Tr>::RegionInfoBase() = default;
547 RegionInfoBase<Tr>::~RegionInfoBase() {
552 void RegionInfoBase<Tr>::verifyBBMap(const RegionT *R) const {
553 assert(R && "Re must be non-null");
554 for (const typename Tr::RegionNodeT *Element : R->elements()) {
555 if (Element->isSubRegion()) {
556 const RegionT *SR = Element->template getNodeAs<RegionT>();
559 BlockT *BB = Element->template getNodeAs<BlockT>();
560 if (getRegionFor(BB) != R)
561 report_fatal_error("BB map does not match region nesting");
567 bool RegionInfoBase<Tr>::isCommonDomFrontier(BlockT *BB, BlockT *entry,
568 BlockT *exit) const {
569 for (BlockT *P : make_range(InvBlockTraits::child_begin(BB),
570 InvBlockTraits::child_end(BB))) {
571 if (DT->dominates(entry, P) && !DT->dominates(exit, P))
579 bool RegionInfoBase<Tr>::isRegion(BlockT *entry, BlockT *exit) const {
580 assert(entry && exit && "entry and exit must not be null!");
582 using DST = typename DomFrontierT::DomSetType;
584 DST *entrySuccs = &DF->find(entry)->second;
586 // Exit is the header of a loop that contains the entry. In this case,
587 // the dominance frontier must only contain the exit.
588 if (!DT->dominates(entry, exit)) {
589 for (typename DST::iterator SI = entrySuccs->begin(),
590 SE = entrySuccs->end();
592 if (*SI != exit && *SI != entry)
599 DST *exitSuccs = &DF->find(exit)->second;
601 // Do not allow edges leaving the region.
602 for (BlockT *Succ : *entrySuccs) {
603 if (Succ == exit || Succ == entry)
605 if (exitSuccs->find(Succ) == exitSuccs->end())
607 if (!isCommonDomFrontier(Succ, entry, exit))
611 // Do not allow edges pointing into the region.
612 for (BlockT *Succ : *exitSuccs) {
613 if (DT->properlyDominates(entry, Succ) && Succ != exit)
621 void RegionInfoBase<Tr>::insertShortCut(BlockT *entry, BlockT *exit,
622 BBtoBBMap *ShortCut) const {
623 assert(entry && exit && "entry and exit must not be null!");
625 typename BBtoBBMap::iterator e = ShortCut->find(exit);
627 if (e == ShortCut->end())
628 // No further region at exit available.
629 (*ShortCut)[entry] = exit;
631 // We found a region e that starts at exit. Therefore (entry, e->second)
632 // is also a region, that is larger than (entry, exit). Insert the
634 BlockT *BB = e->second;
635 (*ShortCut)[entry] = BB;
640 typename Tr::DomTreeNodeT *
641 RegionInfoBase<Tr>::getNextPostDom(DomTreeNodeT *N, BBtoBBMap *ShortCut) const {
642 typename BBtoBBMap::iterator e = ShortCut->find(N->getBlock());
644 if (e == ShortCut->end())
647 return PDT->getNode(e->second)->getIDom();
651 bool RegionInfoBase<Tr>::isTrivialRegion(BlockT *entry, BlockT *exit) const {
652 assert(entry && exit && "entry and exit must not be null!");
654 unsigned num_successors =
655 BlockTraits::child_end(entry) - BlockTraits::child_begin(entry);
657 if (num_successors <= 1 && exit == *(BlockTraits::child_begin(entry)))
664 typename Tr::RegionT *RegionInfoBase<Tr>::createRegion(BlockT *entry,
666 assert(entry && exit && "entry and exit must not be null!");
668 if (isTrivialRegion(entry, exit))
672 new RegionT(entry, exit, static_cast<RegionInfoT *>(this), DT);
673 BBtoRegion.insert({entry, region});
675 #ifdef EXPENSIVE_CHECKS
676 region->verifyRegion();
678 LLVM_DEBUG(region->verifyRegion());
681 updateStatistics(region);
686 void RegionInfoBase<Tr>::findRegionsWithEntry(BlockT *entry,
687 BBtoBBMap *ShortCut) {
690 DomTreeNodeT *N = PDT->getNode(entry);
694 RegionT *lastRegion = nullptr;
695 BlockT *lastExit = entry;
697 // As only a BasicBlock that postdominates entry can finish a region, walk the
698 // post dominance tree upwards.
699 while ((N = getNextPostDom(N, ShortCut))) {
700 BlockT *exit = N->getBlock();
705 if (isRegion(entry, exit)) {
706 RegionT *newRegion = createRegion(entry, exit);
709 newRegion->addSubRegion(lastRegion);
711 lastRegion = newRegion;
715 // This can never be a region, so stop the search.
716 if (!DT->dominates(entry, exit))
720 // Tried to create regions from entry to lastExit. Next time take a
721 // shortcut from entry to lastExit.
722 if (lastExit != entry)
723 insertShortCut(entry, lastExit, ShortCut);
727 void RegionInfoBase<Tr>::scanForRegions(FuncT &F, BBtoBBMap *ShortCut) {
728 using FuncPtrT = typename std::add_pointer<FuncT>::type;
730 BlockT *entry = GraphTraits<FuncPtrT>::getEntryNode(&F);
731 DomTreeNodeT *N = DT->getNode(entry);
733 // Iterate over the dominance tree in post order to start with the small
734 // regions from the bottom of the dominance tree. If the small regions are
735 // detected first, detection of bigger regions is faster, as we can jump
736 // over the small regions.
737 for (auto DomNode : post_order(N))
738 findRegionsWithEntry(DomNode->getBlock(), ShortCut);
742 typename Tr::RegionT *RegionInfoBase<Tr>::getTopMostParent(RegionT *region) {
743 while (region->getParent())
744 region = region->getParent();
750 void RegionInfoBase<Tr>::buildRegionsTree(DomTreeNodeT *N, RegionT *region) {
751 BlockT *BB = N->getBlock();
753 // Passed region exit
754 while (BB == region->getExit())
755 region = region->getParent();
757 typename BBtoRegionMap::iterator it = BBtoRegion.find(BB);
759 // This basic block is a start block of a region. It is already in the
760 // BBtoRegion relation. Only the child basic blocks have to be updated.
761 if (it != BBtoRegion.end()) {
762 RegionT *newRegion = it->second;
763 region->addSubRegion(getTopMostParent(newRegion));
766 BBtoRegion[BB] = region;
769 for (DomTreeNodeBase<BlockT> *C : *N) {
770 buildRegionsTree(C, region);
774 #ifdef EXPENSIVE_CHECKS
776 bool RegionInfoBase<Tr>::VerifyRegionInfo = true;
779 bool RegionInfoBase<Tr>::VerifyRegionInfo = false;
783 typename Tr::RegionT::PrintStyle RegionInfoBase<Tr>::printStyle =
784 RegionBase<Tr>::PrintNone;
787 void RegionInfoBase<Tr>::print(raw_ostream &OS) const {
788 OS << "Region tree:\n";
789 TopLevelRegion->print(OS, true, 0, printStyle);
790 OS << "End region tree\n";
793 #if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
795 void RegionInfoBase<Tr>::dump() const { print(dbgs()); }
799 void RegionInfoBase<Tr>::releaseMemory() {
802 delete TopLevelRegion;
803 TopLevelRegion = nullptr;
807 void RegionInfoBase<Tr>::verifyAnalysis() const {
808 // Do only verify regions if explicitely activated using EXPENSIVE_CHECKS or
809 // -verify-region-info
810 if (!RegionInfoBase<Tr>::VerifyRegionInfo)
813 TopLevelRegion->verifyRegionNest();
815 verifyBBMap(TopLevelRegion);
818 // Region pass manager support.
820 typename Tr::RegionT *RegionInfoBase<Tr>::getRegionFor(BlockT *BB) const {
821 typename BBtoRegionMap::const_iterator I = BBtoRegion.find(BB);
822 return I != BBtoRegion.end() ? I->second : nullptr;
826 void RegionInfoBase<Tr>::setRegionFor(BlockT *BB, RegionT *R) {
831 typename Tr::RegionT *RegionInfoBase<Tr>::operator[](BlockT *BB) const {
832 return getRegionFor(BB);
836 typename RegionInfoBase<Tr>::BlockT *
837 RegionInfoBase<Tr>::getMaxRegionExit(BlockT *BB) const {
838 BlockT *Exit = nullptr;
841 // Get largest region that starts at BB.
842 RegionT *R = getRegionFor(BB);
843 while (R && R->getParent() && R->getParent()->getEntry() == BB)
846 // Get the single exit of BB.
847 if (R && R->getEntry() == BB)
849 else if (++BlockTraits::child_begin(BB) == BlockTraits::child_end(BB))
850 Exit = *BlockTraits::child_begin(BB);
851 else // No single exit exists.
854 // Get largest region that starts at Exit.
855 RegionT *ExitR = getRegionFor(Exit);
856 while (ExitR && ExitR->getParent() &&
857 ExitR->getParent()->getEntry() == Exit)
858 ExitR = ExitR->getParent();
860 for (BlockT *Pred : make_range(InvBlockTraits::child_begin(Exit),
861 InvBlockTraits::child_end(Exit))) {
862 if (!R->contains(Pred) && !ExitR->contains(Pred))
866 // This stops infinite cycles.
867 if (DT->dominates(Exit, BB))
877 typename Tr::RegionT *RegionInfoBase<Tr>::getCommonRegion(RegionT *A,
879 assert(A && B && "One of the Regions is NULL");
884 while (!B->contains(A))
891 typename Tr::RegionT *
892 RegionInfoBase<Tr>::getCommonRegion(SmallVectorImpl<RegionT *> &Regions) const {
893 RegionT *ret = Regions.back();
896 for (RegionT *R : Regions)
897 ret = getCommonRegion(ret, R);
903 typename Tr::RegionT *
904 RegionInfoBase<Tr>::getCommonRegion(SmallVectorImpl<BlockT *> &BBs) const {
905 RegionT *ret = getRegionFor(BBs.back());
908 for (BlockT *BB : BBs)
909 ret = getCommonRegion(ret, getRegionFor(BB));
915 void RegionInfoBase<Tr>::calculate(FuncT &F) {
916 using FuncPtrT = typename std::add_pointer<FuncT>::type;
918 // ShortCut a function where for every BB the exit of the largest region
919 // starting with BB is stored. These regions can be threated as single BBS.
920 // This improves performance on linear CFGs.
923 scanForRegions(F, &ShortCut);
924 BlockT *BB = GraphTraits<FuncPtrT>::getEntryNode(&F);
925 buildRegionsTree(DT->getNode(BB), TopLevelRegion);
928 } // end namespace llvm
932 #endif // LLVM_ANALYSIS_REGIONINFOIMPL_H