[llvm-dev] Why is printing an Instruction so slow?
Stephen Thomas via llvm-dev
llvm-dev at lists.llvm.org
Mon Oct 5 08:17:51 PDT 2015
When writing my custom passes, I often emit log messages to llvm::errs()
llvm::errs() << "Could not handle instruction: " << *Inst << std::endl;
where Inst is a pointer to an Instruction.
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.
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.
Is there a faster way to print an Instruction?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the llvm-dev