[llvm-dev] RFC: Should SmallVectors be smaller?

Chris Lattner via llvm-dev llvm-dev at lists.llvm.org
Sat Jun 23 16:13:40 PDT 2018



> On Jun 23, 2018, at 11:27 AM, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 
>> 
>> Also if you’re not familiar with it, TinyPtrVector is a very useful type for vectors that are highly biased towards 0/1 element and whose elements are pointer size.  It was added relatively late in LLVM’s evolution, so I wouldn’t be surprised if there are still smallvectors that should be upgraded.  TinyPtrVector is designed for use on the heap.
> 
> Yup, it's great for pointers.  Maybe we should make a TinyVector for non-pointers and call it a day.

Sure.  The nice thing about TinyPtrVector is that sizeof(TinyPtrVector) is sizeof(void*) through bitstealing, which you can’t achieve with an arbitrary T.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20180623/ab294ff9/attachment.html>


More information about the llvm-dev mailing list