Skip to content

Commit 7357ef4

Browse files
committed
Ofast deprecation clarifications
Following up on the RFC discussion, this is clarifying that the main purpose and effect of the -Ofast deprecation is to discourage its usage and that everything else is more or less open for discussion, e.g. there is no timeline yet for removal.
1 parent 002fcbd commit 7357ef4

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

clang/docs/CommandGuide/clang.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -429,8 +429,11 @@ Code Generation Options
429429

430430
:option:`-Ofast` Enables all the optimizations from :option:`-O3` along
431431
with other aggressive optimizations that may violate strict compliance with
432-
language standards. This is deprecated in favor of :option:`-O3`
433-
in combination with :option:`-ffast-math`.
432+
language standards. This is deprecated in Clang-19 and a warning is emitted
433+
that :option:`-O3` in combination with :option:`-ffast-math` should be used
434+
instead if the request for non-standard math behavior is intended. Thus, as
435+
there is no timeline yet for removal, the aim is to discourage its usage
436+
due to the compliance violating optimizations.
434437

435438
:option:`-Os` Like :option:`-O2` with extra optimizations to reduce code
436439
size.

clang/docs/ReleaseNotes.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,12 @@ New Compiler Flags
495495
Deprecated Compiler Flags
496496
-------------------------
497497

498-
- The ``-Ofast`` command-line option has been deprecated. This option both
499-
enables the ``-O3`` optimization-level, as well as enabling non-standard
500-
``-ffast-math`` behaviors. As such, it is somewhat misleading as an
501-
"optimization level". Users are advised to switch to ``-O3 -ffast-math`` if
498+
- The ``-Ofast`` command-line option has been deprecated, but there is no
499+
timeline for removal yet. Thus, the main effect of emitting a deprecation
500+
warning message is to discourage its usage due to the problems of ``-Ofast``:
501+
it enables both the ``-O3`` optimization-level as well as non-standard
502+
``-ffast-math`` behaviors and as such it is perceived to be misleading as an
503+
optimization level. Users are advised to switch to ``-O3 -ffast-math`` if
502504
the use of non-standard math behavior is intended, and ``-O3`` otherwise.
503505
See `RFC <https://discourse.llvm.org/t/rfc-deprecate-ofast/78687>`_ for details.
504506

0 commit comments

Comments
 (0)