[llvm-branch-commits] [clang] release/19.x: Ofast deprecation clarifications (#101005) (PR #101663)

via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Fri Aug 2 05:40:40 PDT 2024


https://github.com/llvmbot created https://github.com/llvm/llvm-project/pull/101663

Backport 48d4d4b641702bf6db03a1bac73b7e13dea28349

Requested by: @AaronBallman

>From 9ac3941f8f15241934f05d16df77233af510d1b9 Mon Sep 17 00:00:00 2001
From: Sjoerd Meijer <smeijer at nvidia.com>
Date: Fri, 2 Aug 2024 13:25:35 +0100
Subject: [PATCH] Ofast deprecation clarifications (#101005)

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.

---------

Co-authored-by: Aaron Ballman <aaron at aaronballman.com>
(cherry picked from commit 48d4d4b641702bf6db03a1bac73b7e13dea28349)
---
 clang/docs/CommandGuide/clang.rst | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/clang/docs/CommandGuide/clang.rst b/clang/docs/CommandGuide/clang.rst
index 663aca1f6ddcb..a0c2594d06c61 100644
--- a/clang/docs/CommandGuide/clang.rst
+++ b/clang/docs/CommandGuide/clang.rst
@@ -429,8 +429,12 @@ Code Generation Options
 
     :option:`-Ofast` Enables all the optimizations from :option:`-O3` along
     with other aggressive optimizations that may violate strict compliance with
-    language standards. This is deprecated in favor of :option:`-O3`
-    in combination with :option:`-ffast-math`.
+    language standards. This is deprecated in Clang 19 and a warning is emitted
+    that :option:`-O3` in combination with :option:`-ffast-math` should be used
+    instead if the request for non-standard math behavior is intended. There
+    is no timeline yet for removal; the aim is to discourage use of
+    :option:`-Ofast` due to the surprising behavior of an optimization flag
+    changing the observable behavior of correct code.
 
     :option:`-Os` Like :option:`-O2` with extra optimizations to reduce code
     size.



More information about the llvm-branch-commits mailing list