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

Yaron Keren yaron.keren at gmail.com
Thu May 28 03:34:44 PDT 2015


>This commit was about raw_svector_ostream always allocating 128 bytes
>when its created, rendering the 60 bytes of inline storage completely
>useless. This is very annoying but I have no idea how to fix it.

The patch for raw_svector_ostream I posted on llvm-commits fixes this issue
as well as making raw_svector_ostream faster, if you'd like to review it.

Yaron




2015-05-28 12:48 GMT+03:00 Benjamin Kramer <benny.kra at gmail.com>:
>
> On Thu, May 28, 2015 at 3:25 AM, Sean Silva <chisophugis at gmail.com> wrote:
> >
> >
> > 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")
>
> Does it really modify the buffer size internally? I thought it just
> forwarded to SmallVector, which shouldn't be restricted to powers of
> 2.
>
> This commit was about raw_svector_ostream always allocating 128 bytes
> when its created, rendering the 60 bytes of inline storage completely
> useless. This is very annoying but I have no idea how to fix it.
>
> - Ben
>
> >>
> >> 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
> >>
> >>
> >
> _______________________________________________
> 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/20150528/252f3d5a/attachment.html>


More information about the llvm-commits mailing list