diff options
author | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-04-25 04:30:06 +0000 |
---|---|---|
committer | Duncan P. N. Exon Smith <dexonsmith@apple.com> | 2014-04-25 04:30:06 +0000 |
commit | 6f1f9f4c7f8a5de44c2bcd610fa909f17860fbd1 (patch) | |
tree | a997f159953790df353207743a55cf3523d5173c /include | |
parent | 573faecacf5277b338f27c541c93c364ff284304 (diff) | |
download | llvm-6f1f9f4c7f8a5de44c2bcd610fa909f17860fbd1.tar.gz llvm-6f1f9f4c7f8a5de44c2bcd610fa909f17860fbd1.tar.bz2 llvm-6f1f9f4c7f8a5de44c2bcd610fa909f17860fbd1.tar.xz |
blockfreq: Use a std::list for Loops
As pointed out by David Blaikie in code review, a `std::list<T>` is
simpler than a `std::vector<std::unique_ptr<T>>`. Another option is a
`std::deque<T>` (which allocates in chunks), but I'd like to leave open
the option of inserting in the middle of the sequence for handling
irreducible control flow on the fly.
<rdar://problem/14292693>
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@207177 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/Analysis/BlockFrequencyInfoImpl.h | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/include/llvm/Analysis/BlockFrequencyInfoImpl.h b/include/llvm/Analysis/BlockFrequencyInfoImpl.h index da39ba0e47..310b23f0ea 100644 --- a/include/llvm/Analysis/BlockFrequencyInfoImpl.h +++ b/include/llvm/Analysis/BlockFrequencyInfoImpl.h @@ -23,6 +23,7 @@ #include "llvm/Support/raw_ostream.h" #include <string> #include <vector> +#include <list> #define DEBUG_TYPE "block-freq" @@ -1051,7 +1052,7 @@ public: std::vector<WorkingData> Working; /// \brief Indexed information about loops. - std::vector<std::unique_ptr<LoopData>> Loops; + std::list<LoopData> Loops; /// \brief Add all edges out of a packaged loop to the distribution. /// @@ -1438,8 +1439,8 @@ template <class BT> void BlockFrequencyInfoImpl<BT>::initializeLoops() { BlockNode Header = getNode(Loop->getHeader()); assert(Header.isValid()); - Loops.emplace_back(new LoopData(Header)); - Working[Header.Index].Loop = Loops.back().get(); + Loops.emplace_back(Header); + Working[Header.Index].Loop = &Loops.back(); DEBUG(dbgs() << " - loop = " << getBlockName(Header) << "\n"); } @@ -1471,7 +1472,7 @@ template <class BT> void BlockFrequencyInfoImpl<BT>::initializeLoops() { template <class BT> void BlockFrequencyInfoImpl<BT>::computeMassInLoops() { // Visit loops with the deepest first, and the top-level loops last. for (const auto &L : make_range(Loops.rbegin(), Loops.rend())) - computeMassInLoop(L->Header); + computeMassInLoop(L.Header); } template <class BT> |