Author: Orlando Cazalet-Hyams
Date: 2025-07-14T11:21:20+01:00
New Revision: 34bb38ffbf12539bd403794ac2f7c29e50094d5f

URL: 
https://github.com/llvm/llvm-project/commit/34bb38ffbf12539bd403794ac2f7c29e50094d5f
DIFF: 
https://github.com/llvm/llvm-project/commit/34bb38ffbf12539bd403794ac2f7c29e50094d5f.diff

LOG: [KeyInstr] Add release note & update option (#148244)

Make the option visible, improve the help text, and add a release note.

Added: 
    

Modified: 
    clang/docs/ReleaseNotes.rst
    clang/include/clang/Driver/Options.td
    clang/test/DebugInfo/KeyInstructions/flag.cpp

Removed: 
    


################################################################################
diff  --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 6996066826cbc..9f745e8e0dca3 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -376,6 +376,8 @@ New Compiler Flags
 
 - New option ``-ignore-pch`` added to disable precompiled headers. It 
overrides ``-emit-pch`` and ``-include-pch``. (#GH142409, `PCHDocs 
<https://clang.llvm.org/docs/UsersManual.html#ignoring-a-pch-file>`_).
 
+- New options ``-g[no-]key-instructions`` added, disabled by default. Reduces 
jumpiness of debug stepping for optimized code in some debuggers (not LLDB at 
this time). Not recommended for use without optimizations. DWARF only. Note 
both the positive and negative flags imply ``-g``.
+
 Deprecated Compiler Flags
 -------------------------
 

diff  --git a/clang/include/clang/Driver/Options.td 
b/clang/include/clang/Driver/Options.td
index b1314f2c53a79..2e070d6d64508 100644
--- a/clang/include/clang/Driver/Options.td
+++ b/clang/include/clang/Driver/Options.td
@@ -4720,9 +4720,9 @@ def gno_embed_source : Flag<["-"], "gno-embed-source">, 
Group<g_flags_Group>,
 defm key_instructions : BoolGOption<"key-instructions",
     CodeGenOpts<"DebugKeyInstructions">, DefaultFalse,
     NegFlag<SetFalse>, PosFlag<SetTrue, [], [],
-        "Enable Key Instructions, which reduces the jumpiness of optimized 
code stepping (DWARF only)."
-        " Requires LLVM built with LLVM_EXPERIMENTAL_KEY_INSTRUCTIONS.">,
-    BothFlags<[HelpHidden], [ClangOption, CLOption, CC1Option]>>;
+        "Enable Key Instructions, which reduces the jumpiness of debug 
stepping in optimized C/C++ code"
+        " in some debuggers. DWARF only. Implies -g.">,
+    BothFlags<[], [ClangOption, CLOption, CC1Option]>>;
 def headerpad__max__install__names : Joined<["-"], 
"headerpad_max_install_names">;
 def help : Flag<["-", "--"], "help">,
     Visibility<[ClangOption, CC1Option, CC1AsOption,

diff  --git a/clang/test/DebugInfo/KeyInstructions/flag.cpp 
b/clang/test/DebugInfo/KeyInstructions/flag.cpp
index 813f7e908011c..e34faa6cbb347 100644
--- a/clang/test/DebugInfo/KeyInstructions/flag.cpp
+++ b/clang/test/DebugInfo/KeyInstructions/flag.cpp
@@ -3,6 +3,10 @@
 //// Default: Off.
 // RUN: %clang -### -target x86_64 -c -gdwarf %s 2>&1 | FileCheck %s 
--check-prefixes=NO-KEY-INSTRUCTIONS
 
+//// Help.
+// RUN %clang --help | FileCheck %s --check-prefix=HELP
+// HELP: -gkey-instructions  Enable Key Instructions, which reduces the 
jumpiness of debug stepping in optimized C/C++ code in some debuggers. DWARF 
only. Implies -g.
+
 // KEY-INSTRUCTIONS: "-gkey-instructions"
 // NO-KEY-INSTRUCTIONS-NOT: key-instructions
 


        
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to