我正在編譯一個我一直在用LLVM 2.6和llvm-gcc前端進行編譯的項目。我試圖用LLVM 3.1和clang來測試它的編譯。當我這樣做,我得到了以下錯誤消息有關-O5優化級別:LLVM和Clang中的優化級別
error: invalid value '5' in '-O5'
然而,LLVM 2.6和LLVM-GCC已經工作得很好與-O5
標誌。我看到了有關鐺優化級別以下文件:
-O0 -O1 -O2 -Os -O3 -O4
Specify which optimization level to use. -O0 means "no optimization": this level compiles the
fastest and generates the most debuggable code. -O2 is a moderate level of optimization which
enables most optimizations. -Os is like -O2 with extra optimizations to reduce code size. -O3
is like -O2, except that it enables optimizations that take longer to perform or that may
generate larger code (in an attempt to make the program run faster). On supported platforms, -O4
enables link-time optimization; object files are stored in the LLVM bitcode file format and whole
program optimization is done at link time. -O1 is somewhere between -O0 and -O2.
所以我試圖找出什麼在我與擺在首位在做工作的Makefile中的-O5
(我沒有寫Makefile文件)。這是否改變了並用於LLVM?或者它仍然是一個有用的功能,我只需要以其他方式激活它。
此外,在情況下,它是非常有用的,我運行的是給錯誤的命令基本上是:
/bin/clang -g -c -mcmodel=medium -fstrict-aliasing -Wstrict-aliasing -O5 -emit-llvm -fkeep-inline-functions -fno-stack-protector -c -o foo.bc foo.cpp
同樣的情況下,它很重要,我一個Linux(Ubuntu的10.04)x86_64的系統上運行。