[llvm] r238104 - Bump SmallString to the minimum required amount for raw_ostream to avoid allocation.

Sean Silva chisophugis at gmail.com
Wed May 27 18:25:44 PDT 2015


On Wed, May 27, 2015 at 6:24 PM, Sean Silva <chisophugis at gmail.com> wrote:

> I've always thought that it was confusing that SmallString internally did
> so much processing on the number you give it to actually choose the buffer
> size. Maybe we can just static_assert it is a power of 2 so it is always
> WYSIWYG?
>

(and all the other conditions it does, such as requiring 0 to mean "no
buffer")

-- Sean Silva


>
> -- Sean Silva
>
> On Sat, May 23, 2015 at 10:20 AM, Benjamin Kramer <
> benny.kra at googlemail.com> wrote:
>
>> Author: d0k
>> Date: Sat May 23 12:20:53 2015
>> New Revision: 238104
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=238104&view=rev
>> Log:
>> Bump SmallString to the minimum required amount for raw_ostream to avoid
>> allocation.
>>
>> NFC.
>>
>> Modified:
>>     llvm/trunk/lib/Target/TargetMachine.cpp
>>
>> Modified: llvm/trunk/lib/Target/TargetMachine.cpp
>> URL:
>> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=238104&r1=238103&r2=238104&view=diff
>>
>> ==============================================================================
>> --- llvm/trunk/lib/Target/TargetMachine.cpp (original)
>> +++ llvm/trunk/lib/Target/TargetMachine.cpp Sat May 23 12:20:53 2015
>> @@ -185,7 +185,7 @@ void TargetMachine::getNameWithPrefix(Sm
>>  }
>>
>>  MCSymbol *TargetMachine::getSymbol(const GlobalValue *GV, Mangler &Mang)
>> const {
>> -  SmallString<60> NameStr;
>> +  SmallString<128> NameStr;
>>    getNameWithPrefix(NameStr, GV, Mang);
>>    const TargetLoweringObjectFile *TLOF = getObjFileLowering();
>>    return TLOF->getContext().getOrCreateSymbol(NameStr);
>>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150527/839498ab/attachment.html>


More information about the llvm-commits mailing list