Skip to content

Commit 2dc6e98

Browse files
committed
Revert "[Clang] Enable -fextend-lifetimes at -Og (#118026)"
Reverted following several issues appearing related to fake uses, reported on the github PR. This reverts commit a9dff35.
1 parent accee2b commit 2dc6e98

File tree

4 files changed

+4
-18
lines changed

4 files changed

+4
-18
lines changed

clang/docs/CommandGuide/clang.rst

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -443,11 +443,8 @@ Code Generation Options
443443
:option:`-Oz` Like :option:`-Os` (and thus :option:`-O2`), but reduces code
444444
size further.
445445

446-
:option:`-Og` Similar to :option:`-O1`, but with slightly reduced
447-
optimization and better variable visibility. The same optimizations are run
448-
as at :option:`-O1`, but the ``-fextend-variable-liveness`` flag is
449-
also set, which tries to prevent optimizations from reducing the liveness of
450-
user variables, improving their availability when debugging.
446+
:option:`-Og` Like :option:`-O1`. In future versions, this option might
447+
disable different optimizations in order to improve debuggability.
451448

452449
:option:`-O` Equivalent to :option:`-O1`.
453450

clang/docs/ReleaseNotes.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,6 @@ Modified Compiler Flags
230230

231231
- The ``-mexecute-only`` and ``-mpure-code`` flags are now accepted for AArch64 targets. (#GH125688)
232232

233-
- The ``-Og`` optimization flag now sets ``-fextend-variable-liveness``,
234-
reducing performance slightly while reducing the number of optimized-out
235-
variables.
236-
237233
Removed Compiler Flags
238234
-------------------------
239235

clang/lib/Driver/ToolChains/Clang.cpp

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7683,13 +7683,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
76837683
if (Args.hasArg(options::OPT_fretain_comments_from_system_headers))
76847684
CmdArgs.push_back("-fretain-comments-from-system-headers");
76857685

7686-
if (Arg *A = Args.getLastArg(options::OPT_fextend_variable_liveness_EQ)) {
7687-
A->render(Args, CmdArgs);
7688-
} else if (Arg *A = Args.getLastArg(options::OPT_O_Group);
7689-
A && A->containsValue("g")) {
7690-
// Set -fextend-variable-liveness=all by default at -Og.
7691-
CmdArgs.push_back("-fextend-variable-liveness=all");
7692-
}
7686+
Args.AddLastArg(CmdArgs, options::OPT_fextend_variable_liveness_EQ);
76937687

76947688
// Forward -fcomment-block-commands to -cc1.
76957689
Args.AddAllArgs(CmdArgs, options::OPT_fcomment_block_commands);

clang/test/Driver/extend-variable-liveness.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
// Tests that -fextend-variable-liveness and its aliases are correctly passed
2-
// by the driver, and are set by default at -Og.
2+
// by the driver.
33

44
// RUN: %clang -### -c %s 2>&1 | FileCheck %s --check-prefixes=CHECK,DEFAULT
5-
// RUN: %clang -### -Og -c %s 2>&1 | FileCheck %s --check-prefixes=CHECK,ALL
65
// RUN: %clang -fextend-variable-liveness=none -### -c %s 2>&1 | FileCheck %s --check-prefixes=CHECK,NONE
76
// RUN: %clang -fextend-variable-liveness=this -### -c %s 2>&1 | FileCheck %s --check-prefixes=CHECK,THIS
87
// RUN: %clang -fextend-variable-liveness=all -### -c %s 2>&1 | FileCheck %s --check-prefixes=CHECK,ALL

0 commit comments

Comments
 (0)