Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
BUILD: Modernize default code optimization strategy #1285
Originally from PR #1128
This change is controversial and needs to be checked by the affected porters. As we're obviously losing few platform-specific cases, like the set of directives for DC, and -O0 for the recent PSP2 port in debug build mode.
Generalising like that loses flexibility big time.
Why not reduce it to introducing the new command line switch, but leave the platform-specific overrides?
This new strategy eliminates platform-specific optimization flags and replaces them with -Os or -O2 (plus auto-vectorization where supported), which should provide the best balance of performance and memory usage across pretty much all devices. It also eliminates forced optimizations to ensure that the build system operates in a consistent manner. When optimization is auto, the newer -Og flag will be used when available to get "free" optimizations that don't impact debugging.
These flags either crash the compiler on -Og level because they are incompatible, or are not needed because they are already included in -Os.