[llvm] r234535 - Simplify use of formatted_raw_ostream.
Mehdi Amini
mehdi.amini at apple.com
Thu Jun 11 13:03:34 PDT 2015
> On Jun 11, 2015, at 12:14 PM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
>
>> Thanks for the patch!
>> The slowdown is non-negligible, but I’m not sure I understand what you mean by "The outer caching is
>> non-virtual”.
>
> The write call in raw_ostream in non-virtual and writes to a buffer.
> If buffering is disable, it just calls write_impl, which is virtual.
> In the case of formatted_raw_ostream that then puts data in a buffer.
>
>> Can you try "llvm-mc all-of-clang-lto.s -o - > /dev/null”?
>
> That still puts the output in a file and will buffer the same.
llvm-mc conditionally buffers the output based on:
if (!Out->os().supportsSeeking()) {
BOS = make_unique<buffer_ostream>(Out->os());
OS = BOS.get();
}
Redirecting to a file is not the same from the producer point of view, my thought was that stdout would not “supportsSeeking()“ and llvm-mc would add the buffering.
>
> BTW, at which point do you need to access the generated assembly?
> Could MCAsmStreamer::FinishImpl flush the stream?
When PassManager.run() finishes I expect my stream to be populated. If MCAsmStreamer::FinishImpl is called at the end of the process, that’s fine with me.
—
Mehdi
More information about the llvm-commits
mailing list