<div dir="rtl"><div dir="ltr">grow() does the power of 2 thing, probably to avoid quadratic behaviour<br></div><div dir="ltr"><br></div><div dir="ltr"><a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_klaus_llvm_blob_master_include_llvm_ADT_SmallVector.h-23L-2D248&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=tkjVKcF1NixU4fG2LXyGxamg-TopZh98H91MrB2QQ0g&s=EZJLpIAWV_dAQ-klPh9vDXpfytbzPz9gsSK2fats5io&e=">http://llvm.org/klaus/llvm/blob/master/include/llvm/ADT/SmallVector.h#L-248</a><br></div><div dir="ltr"><br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2015-05-29 2:00 GMT+03:00 Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><span class="">On Thu, May 28, 2015 at 2:48 AM, Benjamin Kramer <span dir="ltr"><<a href="mailto:benny.kra@gmail.com" target="_blank">benny.kra@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span>On Thu, May 28, 2015 at 3:25 AM, Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>> wrote:<br>
><br>
><br>
> On Wed, May 27, 2015 at 6:24 PM, Sean Silva <<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>> wrote:<br>
>><br>
>> I've always thought that it was confusing that SmallString internally did<br>
>> so much processing on the number you give it to actually choose the buffer<br>
>> size. Maybe we can just static_assert it is a power of 2 so it is always<br>
>> WYSIWYG?<br>
><br>
><br>
> (and all the other conditions it does, such as requiring 0 to mean "no<br>
> buffer")<br>
<br>
</span>Does it really modify the buffer size internally? I thought it just<br>
forwarded to SmallVector, which shouldn't be restricted to powers of<br>
2.<br></blockquote><div><br></div></span><div>Hmm.. not sure what I was remembering. I seem to recall SmallVector would always round the buffer size to a power of 2, but I guess not: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_klaus_llvm_blob_master_include_llvm_ADT_SmallVector.h-23L-2D843&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=9Q11tH9G2gqowmFtkwbMQvXQv-nLf4pqSkShmPhoQ2k&s=ZmHY7mQg1FsH1YGgmlOicA8YRpZ67UevR-BxlNMGVLE&e=" target="_blank">http://llvm.org/klaus/llvm/blob/master/include/llvm/ADT/SmallVector.h#L-843</a></div><span class="HOEnZb"><font color="#888888"><div> </div><div><br></div><div>-- Sean Silva</div></font></span><div><div class="h5"><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
This commit was about raw_svector_ostream always allocating 128 bytes<br>
when its created, rendering the 60 bytes of inline storage completely<br>
useless. This is very annoying but I have no idea how to fix it.<br>
<br>
- Ben<br>
<div><div><br>
>><br>
>> On Sat, May 23, 2015 at 10:20 AM, Benjamin Kramer<br>
>> <<a href="mailto:benny.kra@googlemail.com" target="_blank">benny.kra@googlemail.com</a>> wrote:<br>
>>><br>
>>> Author: d0k<br>
>>> Date: Sat May 23 12:20:53 2015<br>
>>> New Revision: 238104<br>
>>><br>
>>> URL: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject-3Frev-3D238104-26view-3Drev&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=9Q11tH9G2gqowmFtkwbMQvXQv-nLf4pqSkShmPhoQ2k&s=68kVpHm58qHqnifgI4sZAKvLwQHhJiTDfkcRB2NJX_0&e=" target="_blank">http://llvm.org/viewvc/llvm-project?rev=238104&view=rev</a><br>
>>> Log:<br>
>>> Bump SmallString to the minimum required amount for raw_ostream to avoid<br>
>>> allocation.<br>
>>><br>
>>> NFC.<br>
>>><br>
>>> Modified:<br>
>>>     llvm/trunk/lib/Target/TargetMachine.cpp<br>
>>><br>
>>> Modified: llvm/trunk/lib/Target/TargetMachine.cpp<br>
>>> URL:<br>
>>> <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__llvm.org_viewvc_llvm-2Dproject_llvm_trunk_lib_Target_TargetMachine.cpp-3Frev-3D238104-26r1-3D238103-26r2-3D238104-26view-3Ddiff&d=AwMFaQ&c=8hUWFZcy2Z-Za5rBPlktOQ&r=mQ4LZ2PUj9hpadE3cDHZnIdEwhEBrbAstXeMaFoB9tg&m=9Q11tH9G2gqowmFtkwbMQvXQv-nLf4pqSkShmPhoQ2k&s=cyhaMAOkJrpQl0TWmHbwVXKICaMpb028BvNSV3IfxZw&e=" target="_blank">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=238104&r1=238103&r2=238104&view=diff</a><br>
>>><br>
>>> ==============================================================================<br>
>>> --- llvm/trunk/lib/Target/TargetMachine.cpp (original)<br>
>>> +++ llvm/trunk/lib/Target/TargetMachine.cpp Sat May 23 12:20:53 2015<br>
>>> @@ -185,7 +185,7 @@ void TargetMachine::getNameWithPrefix(Sm<br>
>>>  }<br>
>>><br>
>>>  MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang)<br>
>>> const {<br>
>>> -  SmallString<60> NameStr;<br>
>>> +  SmallString<128> NameStr;<br>
>>>    getNameWithPrefix(NameStr, GV, Mang);<br>
>>>    const TargetLoweringObjectFile *TLOF = getObjFileLowering();<br>
>>>    return TLOF->getContext().getOrCreateSymbol(NameStr);<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" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
>><br>
>><br>
><br>
</div></div></blockquote></div></div></div><br></div></div>
<br>_______________________________________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
<br></blockquote></div><br></div>