<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, Jul 1, 2015 at 11:31 AM Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com">dexonsmith@apple.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
> On 2015-Jun-30, at 22:58, Eric Christopher <<a href="mailto:echristo@gmail.com" target="_blank">echristo@gmail.com</a>> wrote:<br>
><br>
><br>
><br>
> On Tue, Jun 30, 2015 at 10:54 PM Duncan Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>> wrote:<br>
> I agree it's probably worth formalizing a smaller vector type, but nothing specifically in mind -- I just noticed when looking at the struct layout of MCRelaxableFragment with Pete that the SmallVector<MCFixup,1> was 56 bytes instead of the 48 bytes I thought it would be.<br>
><br>
> (BTW, it's crazy that every relaxable fragment carries around a full copy of the MCSubtargetInfo.  Until today I thought that was a reference!)<br>
><br>
> -- dpn<br>
><br>
> Gack. That's pretty painful. Perhaps changing it to a reference to a unique STI that's kept on the side somewhere in a map? Or something...<br>
><br>
> -eric<br>
<br>
Yeah, something like that should work.  Note that this is *only* necessary<br>
when we're coming from actual assembly (such as inline asm).  If we're<br>
getting the STI from the MI-layer it's already immutable (thanks to the<br>
subtarget cache stuff you did).  Maybe a MCSubtargetInfo cache in the<br>
MCContext or something?<br>
<br></blockquote><div><br></div><div>Yep. That sounds like a decent place to stick it.</div><div><br></div><div>-eric</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
><br>
> es<br>
><br>
> On Jun 30, 2015, at 8:52 PM, Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>> wrote:<br>
><br>
>> Is there a specific place where we're storing SmallVectors in a datastructure that you're trying to optimize with this? It might be worth investing in a more general small-sizeof vector than TinyPtrVector. The way the SmallVector currently works (such as actually containing a 3 pointer "vector header") imposes some fundamental limitations on its sizeof.<br>
>><br>
>> There are various standard ways to greatly reduce sizeof of vectors especially in 64-bit address spaces (and certain assumptions on the OS...) where often the high bits are redundant, allowing the vector header to be compressed to a single pointer in size across a very large size range. Even without the spacious high-bits of a 64-bit address space, we can often store at least up to size 4 or 8 in the low bits, which for many use cases is plenty in the common case.<br>
>><br>
>> (to be clear, I think this patch makes sense; just had a high-level question)<br>
>><br>
>> -- Sean Silva<br>
>><br>
>> On Tue, Jun 30, 2015 at 5:34 PM, Duncan P. N. Exon Smith <<a href="mailto:dexonsmith@apple.com" target="_blank">dexonsmith@apple.com</a>> wrote:<br>
>> I'd just commit this, but I want to check:<br>
>><br>
>>  1. Are my static asserts valid under MSVC?  Sanitizers?  If not, what<br>
>>     *is* a portable way to check that we don't waste memory here?<br>
>>  2. I like them in SmallVector.h (assuming they're portable).<br>
>>     Anyone strongly prefer ADTTests?<br>
>><br>
>> Avoid an unused byte -- which for `sizeof(T) >= sizeof(void *)` costs<br>
>> a pointer -- on `SmallVector<T, 1>`.  Shave the same byte off of<br>
>> `SmallVector<T, 0>`.  Otherwise, no functionality change.<br>
>><br>
>> Note that `SmallVector<T, 0>` has the same memory footprint as<br>
>> `SmallVector<T, 1>`, which seems like a bug to me.  We should probably<br>
>> fix that too.<br>
>><br>
>><br>
>> _______________________________________________<br>
>> llvm-commits mailing list<br>
>> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
>> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br>
</blockquote></div></div>