Questions about Julia Compilation Optimization Levels

I couldn’t find documentation on optimization flags. Is there such a documentation?

I know one can pass optimization flags (e.g. O0) when calling Julia. Is this O0 the same as Clang’s O0?

What is the default optimization level that Julia uses?

If I am embedding Julia inside C or C++, how would I control Julia’s optimization level?

3 Likes

Did you find an answer yet?

Julia’s O0 has no relation to any C compiler O0 other than that it has the same goal of less compile time in exchange for more runtime. I’m not aware of anywhere where all the differences are laid out, but it’s basically just that O3 infers more and runs some extra compiler passes.

1 Like

In Julia 1.3.1, the LLVM optimization passes are listed in jitlayers.cpp, while on master they’re given in aotcompile.cpp.

Basically the only difference between -O2 and -O3 as far as I can tell is that -O3 adds a basic alias analysis pass.

-O2 is the default.

1 Like