[llvm-dev] How to run all available optimisations

Russell Wallace via llvm-dev llvm-dev at lists.llvm.org
Thu Sep 17 15:41:00 PDT 2015


Given a generated module in memory, how do you run all available
optimisations on it?

Tutorial section 4.3 at http://llvm.org/docs/tutorial/LangImpl4.html picks
out just a few optimisations, which makes sense for a JIT compiler on short
running code, but I'm looking at long-running code where it would be
worthwhile to start off applying all of them and possibly selectively
disable any that turn out not to be useful.

C:\llvm\tools\opt\opt.cpp seems to be a program that runs optimisations
from IR to IR, and perhaps runs all of the applicable ones; main() seems to
contain a list of optimisation pass initialisations (though only the ones
applicable where we aren't generating machine code yet). Would copy-pasting
the code from that file be the right starting point?

On the other hand, if so, I would have expected that code to occur again in
the clang source tree, because clang likewise has a -O3 option, but it
doesn't seem to. That suggests to me that I'm confused about how things are
organized. What am I missing?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150917/d5a51994/attachment.html>


More information about the llvm-dev mailing list