-
-
Notifications
You must be signed in to change notification settings - Fork 21.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Review use of -fomit-frame-pointer
and -ftree-vectorize
flags for optimized builds
#66296
Comments
Did some tests inspired by the MRP in this (not directly related) bug report: https://bugs.llvm.org/show_bug.cgi?id=9825
GCC 12.2.1
So Clang 15.0.0
Like GCC I confirmed that |
For
So it's included by default in Back in 2007 when GCC devs did work on this According to LLVM docs, both the Loop and SLP vectorizers are enabled by default. So it seems like we can also remove that one. |
- `-fomit-frame-pointer` is included automatically by both GCC and Clang in `-O1` and above. - `-ftree-vectorize` is included automatically by GCC in `-O2` and beyond, and seems always enabled by Clang. Closes godotengine#66296. See that issue for a detailed investigation.
- `-fomit-frame-pointer` is included automatically by both GCC and Clang in `-O1` and above. - `-ftree-vectorize` is included automatically by GCC in `-O2` and beyond, and seems always enabled by Clang. Closes godotengine#66296. See that issue for a detailed investigation. (cherry picked from commit c5c3d13)
- `-fomit-frame-pointer` is included automatically by both GCC and Clang in `-O1` and above. - `-ftree-vectorize` is included automatically by GCC in `-O2` and beyond, and seems always enabled by Clang. Closes godotengine#66296. See that issue for a detailed investigation. (cherry picked from commit c5c3d13)
Godot version
4.0.beta (006e345)
System information
All
Issue description
As discussed in #66242, we have inconsistent usage of the
-fomit-frame-pointer
and-ftree-vectorize
compiler flags in the various platform ports currently.In current
master
, we apply these flags ontarget=release
export templates on macOS, iOS and Android only, with the following logic:target=release optimize=speed
-> both flagstarget=release optimize=size
-> only-ftree-vectorize
macOS, iOS and Android are three platforms which rely on Clang as compiler, but these flags are also supported by GCC and the LLVM-based Emscripten so in theory we should be able to use them for all platforms aside from MSVC (where the
/Oy
flag, implicit in/O1
and/O2
which we use, should do something similar).So we just need to assess what they do and whether we want them for release builds made with GCC (Linux, Windows) and Emscripten (Web) too. This may also be relevant for thirdparty platform ports (consoles, Haiku, etc.).
But first some history to know when this flags were introduced or removed:
-fomit-frame-pointer
In the first open source commit 0b806ee, it seems like all platforms used this flag, aside from iOS and JavaScript:
During Godot 2.0 development, it was removed from Windows/MinGW and X11 builds by two separate commits:
-ffast-math
, which is indeed problematic and was eventually removed for all platforms by @HP in Don't use -ffast-math or other unsafe math optimizations #24855).During Godot 3.0 development the flag was finally added to iOS by @RandomShaper in #8949 in an effort to harmonize the config between Android and iOS.
Finally during Godot 3.1 development the flag was removed for the server platform by @Calinou in #26666 while syncing it with X11.
Considerations
-fomit-frame-pointer
: https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer-fomit-frame-pointer
is already implied by-O1
,-O2
, and-O3
... so we don't need to specify it for GCC. For Clang, I can't find exhaustive information on what flags they enable for each optimization level, Clang docs are extremely terse.-ftree-vectorize
When Godot was open sourced, this was used for Android and macOS:
It was added to iOS in #8949 like
-fomit-frame-pointer
.The text was updated successfully, but these errors were encountered: