[PATCH] D36210: [LLVM] [RegionInfo] Introduce getExitingBlocks to get all predecessors of Exit in the current region.
Phabricator via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 18 22:01:20 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL313611: [LLVM] [RegionInfo] Introduce getExitingBlocks to get all predecessors of Exit… (authored by ether).
Changed prior to commit:
https://reviews.llvm.org/D36210?vs=109275&id=115788#toc
Repository:
rL LLVM
https://reviews.llvm.org/D36210
Files:
llvm/trunk/include/llvm/Analysis/RegionInfo.h
llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h
Index: llvm/trunk/include/llvm/Analysis/RegionInfo.h
===================================================================
--- llvm/trunk/include/llvm/Analysis/RegionInfo.h
+++ llvm/trunk/include/llvm/Analysis/RegionInfo.h
@@ -407,6 +407,11 @@
/// else NULL.
BlockT *getExitingBlock() const;
+ /// @brief Collect all blocks of this region's single exit edge, if existing.
+ ///
+ /// @return True if this region contains all the predecessors of the exit.
+ bool getExitingBlocks(SmallVectorImpl<BlockT *> &Exitings) const;
+
/// @brief Is this a simple region?
///
/// A region is simple if it has exactly one exit and one entry edge.
Index: llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h
===================================================================
--- llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h
+++ llvm/trunk/include/llvm/Analysis/RegionInfoImpl.h
@@ -178,6 +178,29 @@
}
template <class Tr>
+bool RegionBase<Tr>::getExitingBlocks(
+ SmallVectorImpl<BlockT *> &Exitings) const {
+ bool CoverAll = true;
+
+ if (!exit)
+ return CoverAll;
+
+ for (PredIterTy PI = InvBlockTraits::child_begin(exit),
+ PE = InvBlockTraits::child_end(exit);
+ PI != PE; ++PI) {
+ BlockT *Pred = *PI;
+ if (contains(Pred)) {
+ Exitings.push_back(Pred);
+ continue;
+ }
+
+ CoverAll = false;
+ }
+
+ return CoverAll;
+}
+
+template <class Tr>
typename RegionBase<Tr>::BlockT *RegionBase<Tr>::getExitingBlock() const {
BlockT *exit = getExit();
BlockT *exitingBlock = nullptr;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36210.115788.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170919/0d5a691d/attachment.bin>
More information about the llvm-commits
mailing list