Dumping the IR of an entire module can take a long time. I found a
patch I wrote a while back that allows me to dump the IR for one function.
It is not pretty but gets the job done. You might find it useful and/or have ideas
to improve it etc.
LTO usage example: -Wl,-mllvm,-dump-function=foo -Wl,-mllvm,-mdump-function=foo
-Wl,-mllvm,-print-before-all