Closed compor closed 6 years ago
From so far use it seems not to affect:
These can get unoptimized IR that can be optimized later with --emit-llvm -O0
.
Since we simply add -emit-llvm
to the already provided options, if we just want to get raw unoptimized IR, but with the ability to further optimize it (i.e. IR without the optnone
attribute) we need to add the following options for clang
:
-O1 -Xclang -disable-llvm-passes
or
-O0 -Xclang -disable-O0-optnone
Please note that cmake
uses -O1
if no optimization level is explicitly specified.
Addressed in documentation in a7058f9fe5b662fce7076c857ff2c96ffee839b7 with version tag 2.6.0.
There seems to have been a change in the way
-O0
works in conjunction with--emit-llvm
.If
-O0
is used with the latest LLVM versions, functions get annotated withoptnone
attribute, which prohibits further optimizations. The workaround seems to be to use-O1
along with-disable-llvm-optzns
and/or-disable-llvm-passes
.The related discussion can be found here.