Ich arbeite an einem Projekt, das ich mit LLVM 2.6 und dem Frontend llvm-gcc kompiliert habe. Ich versuche, es mit LLVM 3.1 und clang zu kompilieren. Als ich das tat, bekam ich folgende Fehlermeldung über -O5 Optimierungsstufe:Optimierungsstufen in LLVM und Clang
error: invalid value '5' in '-O5'
jedoch LLVM 2.6 und llvm-gcc haben mit der -O5
Flagge hat gut funktioniert. Ich sah die folgende Dokumentation über die Clang Optimierungsstufen:
-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.
Also ich versuche, die -O5
im Makefile, um herauszufinden, was ich arbeite mit in erster Linie zu tun (ich nicht geschrieben hätte Makefile). Ist das etwas, das sich geändert hat und früher mit LLVM verwendet wurde? Oder ist es immer noch ein nützliches Feature und ich muss es nur auf andere Weise aktivieren.
Auch in dem Fall ist es sinnvoll, der Befehl ich ausgeführt habe, dass der Fehler gibt im Grunde ist:
/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
Auch falls es zählt ich auf einem Linux (Ubuntu 10.04) x86_64-System am Laufen.