[cfe-dev] Dumping control flow graph after each optimization pass

Jayakrishna Vadayath via cfe-dev cfe-dev at lists.llvm.org
Sat Oct 16 22:24:03 PDT 2021


Dear devs,

I wanted to know if it is possible to dump the control flow graph
representation of functions before/after each optimization pass.

I found that it is possible to dump the intermediate representation
after each optimization pass using the flags -mllvm -print-after-all.
I also found that it is possible to dump the control flow graph from
the LLVM IR using the command opt -dot-cfg.

I tried to split the output of the -print-after-all flag and saved it
to multiple files.
However, when I run the opt -dot-cfg command on each of those files,
it fails because some variables are not defined.

I wanted to know if it is possible to dump the LLVM IR after every
optimization pass that could then be passed on to opt to dump the
control flow graph representation.
Or is it possible to just dump the control flow graph representation
itself after each optimization pass ?

Please let me know

Thank you

-- 
Regards
Jayakrishna Menon


More information about the cfe-dev mailing list