]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
doc: Document -O1 as the preferred level for large machine-generated code
authorSam James <sam@gentoo.org>
Tue, 23 Jul 2024 14:06:10 +0000 (15:06 +0100)
committerThomas Koenig <tkoenig@gcc.gnu.org>
Sun, 28 Jul 2024 17:05:57 +0000 (19:05 +0200)
At -O1, the intention is that we compile things in a "reasonable" amount
of time (ditto memory use). In particular, we try to especially avoid
optimizations which scale poorly on pathological cases, as is the case
for large machine-generated code.

Recommend -O1 for large machine-generated code, as has been informally
done on bugs for a while now.

This applies (broadly speaking) for both large machine-generated functions
but also to a lesser extent repetitive small-but-still-not-tiny functions
from a generator program.

gcc/ChangeLog:
PR middle-end/114855
* doc/invoke.texi (Optimize options): Mention machine-generated
code for -O1.

gcc/doc/invoke.texi

index e0a641213ae401f4ff41fbc29e53913a175f2b75..9fb0925ed2922af57b3efee9457bbb15c5d85ef7 100644 (file)
@@ -12560,6 +12560,11 @@ With @option{-O}, the compiler tries to reduce code size and execution
 time, without performing any optimizations that take a great deal of
 compilation time.
 
+@option{-O} is the recommended optimization level for large machine-generated
+code as a sensible balance between time taken to compile and memory use:
+higher optimization levels perform optimizations with greater algorithmic
+complexity than at @option{-O}.
+
 @c Note that in addition to the default_options_table list in opts.cc,
 @c several optimization flags default to true but control optimization
 @c passes that are explicitly disabled at -O0.