What optimization steps are done for -O4 in clang?

We are trying to implement a jit compiler whose performance should be the same as with clang -o4. Is there a place where I could easily get a list of optimization options called by clang with -o4 specified?

+4
clang llvm llvm-clang
Dec 17
source share
2 answers

As far as I know, -O4 means the same as -O3 + with LTO support (Link Time Optimization). See snippets of the following code:

Also see here :

You can create bitcode files from clang using -emit-llvm or -flto, or the -O4 flag, which is synonymous with -O3 -flto.

For optimizations used with the -O3 flag, see this PassManagerBuilder.cpp file (find the OptLevel variable - it will have a value of 3).

+8
Dec 18
source share

Please note that with LLVM 5.1-O4, link time optimization is no longer required. If you want you to have to go -flto. See Xcode 5 Release Notes .

+7
Mar 10 '14 at 22:24
source share



All Articles