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

Chandler Carruth chandlerc at google.com
Mon Apr 21 20:53:45 PDT 2014


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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140421/f47eb64e/attachment.html>


More information about the llvm-commits mailing list