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

Duncan P. N. Exon Smith via llvm-dev llvm-dev at lists.llvm.org
Sat Jun 23 16:17:35 PDT 2018


(add back llvm-dev)

> On Jun 23, 2018, at 16:16, Duncan P. N. Exon Smith <dexonsmith at apple.com> wrote:
> 
> 
> 
>> On Jun 23, 2018, at 16:13, Chris Lattner <clattner at nondot.org <mailto:clattner at nondot.org>> wrote:
>> 
>> 
>> 
>>> On Jun 23, 2018, at 11:27 AM, Duncan P. N. Exon Smith <dexonsmith at apple.com <mailto: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.
> 
> Right, it won't be as good the Ptr version for anything sizeof >= 8, but we could fairly blindly move SmallVector with N=0 over to it.

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


More information about the llvm-dev mailing list