Following through llvm passes with print-after-all, convenience


when using “JULIA_LLVM_ARGS=’-print-after-all’” and a debug build, then you can follow through optimization passes.

Now, I tend to get ~30-160 MB of output on stderr, for very short and simple scripts.

Most of this is garbage from startup/REPL, and it is not entirely trivial to find relevant sections (grep functionname does not work, because the REPL produces lots of garbage on every call; and I know no sensible way of trigering compilation without calling)

Do you people have any tricks to share on how to deal with this? Maybe magic command line arguments, or ways of organizing script files that minimize unneeded compilation output, or little scripts that organize these giant dumps? Or tricks where to include grep-able markers in a source file (that have no false positives)?

Sorry if the question is somewhat naive.


Annoyingly, the PrintAfterAll option set by -print-after-all is only used when scheduling passes, which happens during Julia start-up. So we can’t set -print-after-all dynamically with eg. LLVM.jl. Another clean approach would be to use -filter-print-funcs, but that only does exact function name matches.

To avoid REPL output, you can use julia -e, eg. JULIA_LLVM_ARGS="-print-after-all" julia -e "sin(1)"