mirror of
https://git.musl-libc.org/git/musl
synced 2025-01-21 21:52:04 +03:00
configure: replace -Os with equivalent based on -O2
aside from the documented differences, which are the contents of this patch, GCC's -Os also has hard-coded unwanted behaviors which are impossible to override, like refusing to strength-reduce division by a constant to multiplication, presumably because the div saves a couple bytes of code. for this reason, getting rid of -Os and switching to an equivalent default optimization profile based on -O2 has been a long-term goal. as follow-ups, it may make sense to evaluate which of these variations from -O2 actually do anything useful, and eliminate the ones which are not helpful or which throw away performance for insignificant size savings. but for now, I've replicated -Os as closely as possible to provide a baseline for such evaluation.
This commit is contained in:
parent
718f363bc2
commit
b90841e258
15
configure
vendored
15
configure
vendored
@ -444,7 +444,20 @@ xno|x) printf "disabled\n" ; optimize=no ;;
|
||||
*) printf "custom\n" ;;
|
||||
esac
|
||||
|
||||
test "$optimize" = no || tryflag CFLAGS_AUTO -Os || tryflag CFLAGS_AUTO -O2
|
||||
if test "$optimize" = no ; then :
|
||||
else
|
||||
tryflag CFLAGS_AUTO -O2
|
||||
tryflag CFLAGS_AUTO -fno-align-jumps
|
||||
tryflag CFLAGS_AUTO -fno-align-functions
|
||||
tryflag CFLAGS_AUTO -fno-align-loops
|
||||
tryflag CFLAGS_AUTO -fno-align-labels
|
||||
tryflag CFLAGS_AUTO -fira-region=one
|
||||
tryflag CFLAGS_AUTO -fira-hoist-pressure
|
||||
tryflag CFLAGS_AUTO -freorder-blocks-algorithm=simple \
|
||||
|| tryflag CFLAGS_AUTO -fno-reorder-blocks
|
||||
tryflag CFLAGS_AUTO -fno-prefetch-loop-arrays
|
||||
tryflag CFLAGS_AUTO -fno-tree-ch
|
||||
fi
|
||||
test "$optimize" = yes && optimize="internal,malloc,string"
|
||||
|
||||
if fnmatch 'no|size' "$optimize" ; then :
|
||||
|
Loading…
Reference in New Issue
Block a user