[llvm-dev] How to invoke simplifycfg from code

Russell Wallace via llvm-dev llvm-dev at lists.llvm.org
Sat Sep 19 23:28:56 PDT 2015


Simplifycfg doesn't get run by default even with -O3, but 'opt
-simplifycfg' can do it. I'm looking to add this functionality to an
optimizer program that uses the llvm libraries. What's the best way to do
this? I don't really mind whether it becomes available as a command line
option as in opt, or I need to hardcode it as always on.

To make it available as a command line option... I'm looking at the code
for opt, but it makes no reference to simplifycfg anywhere in the code. I'm
guessing it does something else that gets that option linked in and somehow
thereby connects that to activating the actual pass; how is this done?

Alternatively in an attempt to hardwire it I got as far as FPM.add(new
SimplifyCFGPass); but that fails to compile because SimplifyCFGPass isn't
of a compatible type, which indeed it isn't; what should I be doing here?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150920/ed626eca/attachment.html>


More information about the llvm-dev mailing list