<div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 5, 2015 at 12:05 PM, don hinton <span dir="ltr"><<a href="mailto:hintonda@gmail.com" target="_blank">hintonda@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Steve:<div><br></div><div>llvm::errs() is unbuffered, so that might explain it. Could you try llvm::outs() instead and see if that helps.</div></div></blockquote><div><br></div><div>Don,</div><div><br></div><div>Nice tip. Switching to llvm::outs() saved about 15% for me. Not a golden bullet, but still nothing to sneeze at. Printing instructions still remains the bottleneck for my pass.</div><div><br></div><div>I'm curious how llvm-dis is able to write out so much IR text is so little time.</div><div><br></div><div>Thanks,</div><div>Steve</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><br></div><div>hth...</div><div>don</div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Mon, Oct 5, 2015 at 11:17 AM, Stephen Thomas via llvm-dev <span dir="ltr"><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr">Hi all,<div><br></div><div>When writing my custom passes, I often emit log messages to llvm::errs() like so:</div><div><br></div><div>llvm::errs() << "Could not handle instruction: " << *Inst << std::endl;</div><div><br></div><div>where Inst is a pointer to an Instruction.</div><div><br></div><div>I've profiled my code and found that this way of printing an Instruction takes a very long time: indeed, it is the bottleneck of my pass. </div><div><br></div><div>Of course, I could always switch these log messages off for production runs, but during development and debugging, I'd like to have them on to make debugging much easier.</div><div><br></div><div>Is there a faster way to print an Instruction?</div><div><br></div><div>Thanks,</div><div>Steve</div></div>
<br></div></div>_______________________________________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div>
</blockquote></div><br></div></div>