[llvm] r206857 - blockfreq: Use pointers to loops instead of an index

Duncan P. N. Exon Smith dexonsmith at apple.com
Mon Apr 21 20:59:19 PDT 2014


On 2014 Apr 21, at 20:53, Chandler Carruth <chandlerc at google.com> wrote:

> 
> On Mon, Apr 21, 2014 at 8:31 PM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> Store pointers directly to loops inside the nodes.  This could have been
> done without changing the type stored in `std::vector<>`.  However,
> rather than computing the number of loops before constructing them
> (which `LoopInfo` doesn't provide directly), I've switched to a
> `vector<unique_ptr<LoopData>>`.
> 
> This adds some heap overhead, but the number of loops is typically
> small.
> 
> The other option is to use a BumpPtrAllocator rather than a unique_ptr to batch the allocation and clearing. Not sure its warranted here, just wanted to mention it.

It's probably not warranted here (not very many loops), but I'll
keep it in mind.  Thanks!



More information about the llvm-commits mailing list