[llvm] r234535 - Simplify use of formatted_raw_ostream.

Mehdi Amini mehdi.amini at apple.com
Thu Jun 11 10:57:24 PDT 2015


> On Jun 11, 2015, at 9:12 AM, Rafael Espíndola <rafael.espindola at gmail.com> wrote:
> 
>> Interesting idea. I wonder why we went with disabling the buffer of
>> the passed stream. I will take a look at git log and play with the
>> idea of flipping it.
> 
> The attached patch changes the buffering as you suggested.
> 
> One of the issues is that it is slower. The outer caching is
> non-virtual. Running
> 
> llvm-mc all-of-clang-lto.s -o /dev/null
> 
> goes from 0m22.230s to 0m23.673s on my laptop. Do we care?


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”. 

Can you try "llvm-mc all-of-clang-lto.s -o - > /dev/null”?
I wonder if the problem isn’t the lack of buffering from llvm-mc when the output is a file.

Thanks,

Mehdi

 


> 
> The other issues are:
> 
> * test/CodeGen/R600/cf-stack-bug.ll fails because it uses 2>&1 and so
> depends on the buffering differences of stdout and stderr :-(
> 
> * A hack in r600 to pad to a column:
> 
> void AMDGPUInstPrinter::printLast(const MCInst *MI, unsigned OpNo,
>                                  raw_ostream &O) {
>  printIfSet(MI, OpNo, O.indent(25 - O.GetNumBytesInBuffer()), "*", " ");
> }
> 
> since now GetNumBytesInBuffer is 0.
> 
> The issue can be fixed by giving up on aligning the "*" or passing in
> a formatted_raw_stream that actually knows the current column.
> 
> The other attached patch is a start at passing a formatted_raw_steam,
> but it might not be necessary.
> 
> Cheers,
> Rafael
> <t.patch><formatted.patch>





More information about the llvm-commits mailing list