summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-04-22 03:31:44 +0000
committerDuncan P. N. Exon Smith <dexonsmith@apple.com>2014-04-22 03:31:44 +0000
commit40a483e980bb2ec89bd962d341f9a8fce3152c5b (patch)
tree376e6fa601cbec49a60ebfa63b3ac1a8e08ca1bd /include
parent92897fda32f8df464e0056a7f1c7259303f6015e (diff)
downloadllvm-40a483e980bb2ec89bd962d341f9a8fce3152c5b.tar.gz
llvm-40a483e980bb2ec89bd962d341f9a8fce3152c5b.tar.bz2
llvm-40a483e980bb2ec89bd962d341f9a8fce3152c5b.tar.xz
blockfreq: Use a pointer for ContainingLoop too
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206858 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r--include/llvm/Analysis/BlockFrequencyInfoImpl.h23
1 files changed, 16 insertions, 7 deletions
diff --git a/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/include/llvm/Analysis/BlockFrequencyInfoImpl.h
index ca98a2e1d2..3faec52669 100644
--- a/include/llvm/Analysis/BlockFrequencyInfoImpl.h
+++ b/include/llvm/Analysis/BlockFrequencyInfoImpl.h
@@ -958,16 +958,25 @@ public:
/// \brief Index of loop information.
struct WorkingData {
LoopData *Loop; ///< The loop this block is the header of.
- BlockNode ContainingLoop; ///< The block whose loop this block is inside.
- bool IsPackaged; ///< Has ContainingLoop been packaged up?
+ LoopData *ContainingLoop; ///< The block whose loop this block is inside.
BlockMass Mass; ///< Mass distribution from the entry block.
- WorkingData() : Loop(nullptr), IsPackaged(false) {}
+ WorkingData() : Loop(nullptr), ContainingLoop(nullptr) {}
- bool hasLoopHeader() const { return ContainingLoop.isValid(); }
+ bool hasLoopHeader() const { return ContainingLoop; }
bool isLoopHeader() const { return Loop; }
- /// \brief Has this block's loop been packaged up?
+ BlockNode getContainingHeader() const {
+ if (ContainingLoop)
+ return ContainingLoop->Header;
+ return BlockNode();
+ }
+
+ /// \brief Has ContainingLoop been packaged up?
+ bool isPackaged() const {
+ return ContainingLoop && ContainingLoop->IsPackaged;
+ }
+ /// \brief Has Loop been packaged up?
bool isAPackage() const { return Loop && Loop->IsPackaged; }
};
@@ -1041,7 +1050,7 @@ public:
/// \brief Loop data: see initializeLoops().
std::vector<WorkingData> Working;
- /// \brief Indexed information about packaged loops.
+ /// \brief Indexed information about loops.
std::vector<std::unique_ptr<LoopData>> PackagedLoops;
/// \brief Add all edges out of a packaged loop to the distribution.
@@ -1452,7 +1461,7 @@ template <class BT> void BlockFrequencyInfoImpl<BT>::initializeLoops() {
const auto &HeaderData = Working[Header.Index];
assert(HeaderData.isLoopHeader());
- Working[Index].ContainingLoop = Header;
+ Working[Index].ContainingLoop = HeaderData.Loop;
HeaderData.Loop->Members.push_back(Index);
DEBUG(dbgs() << " - loop = " << getBlockName(Header)
<< ": member = " << getBlockName(Index) << "\n");