[PATCH] Single function IR dump

Duncan P. N. Exon Smith dexonsmith at apple.com
Wed Nov 19 17:39:37 PST 2014


> On 2014-Nov-19, at 13:30, Gerolf Hoflehner <ghoflehner at apple.com> wrote:
> 
> Hi dexonsmith, echristo,
> 
> 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
> 
> http://reviews.llvm.org/D6326
> 
> Files:
>  lib/Analysis/IPA/CallGraphSCCPass.cpp
>  lib/Analysis/LoopPass.cpp
>  lib/CodeGen/MachineFunction.cpp
>  lib/CodeGen/MachineFunctionPrinterPass.cpp
>  lib/IR/IRPrintingPasses.cpp
> <D6326.16397.patch>

This seems really useful.  A couple of things:

  - You should add a testcase.  Looks like `-print-after-all` is tested
    in test/Other.

  - You should remove (and commit separately if at all) the whitespace
    changes to code you didn't touch.

I guess we could bikeshed on the option name, but -dump-function seems
fine to me.



More information about the llvm-commits mailing list