[llvm-branch-commits] [clang] [lld] [llvm] CodeGen: Replace TargetOptions::DebuggerTuning with module flag (PR #235051)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Oct 24 01:40:49 PDT 2026


https://github.com/arsenm updated https://github.com/llvm/llvm-project/pull/235051

>From 250c4051c596b990386c43c9fbdc36011e29c802 Mon Sep 17 00:00:00 2001
From: Matt Arsenault <Matthew.Arsenault at amd.com>
Date: Thu, 1 Oct 2026 09:18:36 +0200
Subject: [PATCH] CodeGen: Replace TargetOptions::DebuggerTuning with module
 flag

Read the debugger tuning from the module's "debugger-tuning" flag instead of
TargetOptions. Delete the now-dead -debugger-tune= cl::opt and the
TargetOptions::DebuggerTuning field.

Update the tests relying on it to directly use the module flag. The cases
that exercise multiple values do a text substitution to swap the value.
Alternatively this could be changed to synthesize the module flag in the
llc flag like some of the other widely used module flags do.

Co-authored-by: Claude Sonnet 5 <noreply at anthropic.com>
---
 clang/lib/CodeGen/BackendUtil.cpp             |  1 -
 clang/lib/Driver/ToolChains/CommonArgs.cpp    | 17 --------
 clang/test/Driver/lto-aix.c                   | 20 +++------
 clang/test/Driver/lto.c                       |  9 ----
 lld/test/ELF/lto/debugger-tune.ll             |  9 ++--
 llvm/docs/ReleaseNotes.md                     |  4 ++
 llvm/include/llvm/CodeGen/CommandFlags.h      |  2 -
 .../llvm/CodeGen/LiveDebugValuesPass.h        |  9 ----
 .../llvm/Passes/MachinePassRegistry.def       | 12 +-----
 llvm/include/llvm/Target/TargetMachine.h      |  2 +-
 llvm/include/llvm/Target/TargetOptions.h      |  3 --
 llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp    | 22 +++-------
 llvm/lib/CodeGen/CommandFlags.cpp             | 12 ------
 .../LiveDebugValues/LiveDebugValues.cpp       | 15 +++----
 llvm/lib/LTO/LTO.cpp                          |  5 +--
 llvm/lib/Passes/CodeGenPassBuilder.cpp        |  3 +-
 llvm/lib/Target/TargetMachine.cpp             |  9 ++--
 llvm/test/CodeGen/RISCV/O0-newpm-pipeline.ll  |  2 +-
 llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll  |  2 +-
 llvm/test/CodeGen/X86/llc-pipeline-npm.ll     |  8 ++--
 .../test/DebugInfo/ARM/big-endian-bitfield.ll |  5 ++-
 llvm/test/DebugInfo/COFF/thunk.ll             |  2 +-
 .../DebugInfo/Generic/2010-04-19-FramePtr.ll  | 10 +++--
 .../Generic/debug-info-enum-dwarf2.ll         |  4 +-
 .../test/DebugInfo/Generic/debug-info-enum.ll |  4 +-
 .../Generic/debug-names-accel-table-types.ll  |  2 +-
 .../Generic/debug-names-empty-name.ll         |  5 ++-
 .../Generic/debug-names-nameless-var.ll       |  5 ++-
 .../DebugInfo/Generic/dwarf-public-names.ll   |  5 ++-
 .../Generic/linkage-name-abstract.ll          |  5 ++-
 .../MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir | 43 +++++++++++--------
 .../MIR/X86/debug-call-site-param.mir         |  8 ++--
 .../MIR/X86/debug-entry-value-operation.mir   |  8 ++--
 llvm/test/DebugInfo/PowerPC/debugger-tune.ll  | 11 +++--
 llvm/test/DebugInfo/X86/2010-04-13-PubType.ll |  5 ++-
 ...DW_AT_object_pointer-non-standard-index.ll |  2 +-
 .../DebugInfo/X86/DW_AT_object_pointer.ll     | 10 +++--
 .../test/DebugInfo/X86/accel-tables-dwarf5.ll |  6 +--
 llvm/test/DebugInfo/X86/accel-tables.ll       | 12 ++++--
 llvm/test/DebugInfo/X86/bitfields-dwarf4.ll   |  2 +-
 llvm/test/DebugInfo/X86/c-type-units.ll       |  2 +-
 llvm/test/DebugInfo/X86/constant-loclist.ll   |  2 +-
 llvm/test/DebugInfo/X86/convert-debugloc.ll   | 21 +++++----
 .../X86/debug-aranges-sce-tuning.test         |  5 ++-
 llvm/test/DebugInfo/X86/debugger-tune.ll      | 18 +++++---
 .../dwarf-callsite-related-attrs-indirect.ll  |  2 +-
 .../X86/dwarf-callsite-related-attrs.ll       |  2 +-
 .../X86/dwarf-gnu-call-target-clobbered.mir   |  5 ++-
 .../test/DebugInfo/X86/dwarf-linkage-names.ll |  5 ++-
 llvm/test/DebugInfo/X86/gnu-names.ll          | 12 ++++--
 .../DebugInfo/X86/implicit_value-double.ll    | 12 ++++--
 .../DebugInfo/X86/implicit_value-float.ll     | 12 ++++--
 .../DebugInfo/X86/no-entry-values-with-O0.ll  | 11 ++---
 .../X86/no-public-sections-metadata.ll        |  5 ++-
 llvm/test/DebugInfo/X86/packed_bitfields2.ll  |  5 ++-
 .../DebugInfo/X86/sections_as_references.ll   |  5 ++-
 llvm/test/DebugInfo/X86/set.ll                |  2 +-
 .../DebugInfo/XCOFF/dbx-inlinedstrings.ll     | 11 ++---
 llvm/test/DebugInfo/XCOFF/empty.ll            |  8 ++--
 llvm/test/DebugInfo/XCOFF/explicit-section.ll |  5 ++-
 .../test/DebugInfo/XCOFF/function-sections.ll |  7 +--
 llvm/test/ThinLTO/X86/cache-config.ll         |  7 ++-
 .../AArch64/debug-names-accel-table-types.ll  |  5 ++-
 .../tools/llvm-dwarfdump/X86/statistics.ll    |  5 ++-
 64 files changed, 243 insertions(+), 251 deletions(-)

diff --git a/clang/lib/CodeGen/BackendUtil.cpp b/clang/lib/CodeGen/BackendUtil.cpp
index 8331ad64df3dff..fd4bb670f211e3 100644
--- a/clang/lib/CodeGen/BackendUtil.cpp
+++ b/clang/lib/CodeGen/BackendUtil.cpp
@@ -431,7 +431,6 @@ static bool initTargetOptions(const CompilerInstance &CI,
   Options.TLSSize = CodeGenOpts.TLSSize;
   Options.EnableTLSDESC = CodeGenOpts.EnableTLSDESC;
   Options.EmulatedTLS = CodeGenOpts.EmulatedTLS;
-  Options.DebuggerTuning = CodeGenOpts.getDebuggerTuning();
   Options.EmitStackSizeSection = CodeGenOpts.StackSizeSection;
   Options.StackUsageFile = CodeGenOpts.StackUsageFile;
   Options.EmitAddrsig = CodeGenOpts.Addrsig;
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 7d77cd0b916324..634a58d8a4ce5a 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -1222,23 +1222,6 @@ void tools::addLTOOptions(const ToolChain &ToolChain, const ArgList &Args,
         (A->getOption().matches(options::OPT_fglobal_isel) ? "1" : "0")));
   }
 
-  // If an explicit debugger tuning argument appeared, pass it along.
-  if (Arg *A =
-          Args.getLastArg(options::OPT_gTune_Group, options::OPT_ggdbN_Group)) {
-    if (A->getOption().matches(options::OPT_glldb))
-      CmdArgs.push_back(
-          Args.MakeArgString(Twine(PluginOptPrefix) + "-debugger-tune=lldb"));
-    else if (A->getOption().matches(options::OPT_gsce))
-      CmdArgs.push_back(
-          Args.MakeArgString(Twine(PluginOptPrefix) + "-debugger-tune=sce"));
-    else if (A->getOption().matches(options::OPT_gdbx))
-      CmdArgs.push_back(
-          Args.MakeArgString(Twine(PluginOptPrefix) + "-debugger-tune=dbx"));
-    else
-      CmdArgs.push_back(
-          Args.MakeArgString(Twine(PluginOptPrefix) + "-debugger-tune=gdb"));
-  }
-
   if (IsOSAIX) {
     if (!ToolChain.useIntegratedAs())
       CmdArgs.push_back(
diff --git a/clang/test/Driver/lto-aix.c b/clang/test/Driver/lto-aix.c
index 381d9207e3ea20..ed628b6ffd159b 100644
--- a/clang/test/Driver/lto-aix.c
+++ b/clang/test/Driver/lto-aix.c
@@ -36,22 +36,18 @@
 // NOVECEXTABI-NOT: "-bplugin_opt:-vec-extabi"
 
 // Test debugging options
-// RUN: %clang --target=powerpc-ibm-aix -### %s -flto -fuse-ld=ld -gdbx 2>&1 \
-// RUN:   | FileCheck -check-prefix=DBX %s
-// RUN: %clang --target=powerpc-ibm-aix -### %s -flto -fuse-ld=ld -g 2>&1 \
-// RUN:   | FileCheck -check-prefix=NODEBUGGER-TUNE %s
 // RUN: %clang --target=powerpc-ibm-aix-xcoff -### %s -flto -g 2>&1 \
-// RUN:   | FileCheck -check-prefixes=STRICT,NODEBUGGER-TUNE %s
+// RUN:   | FileCheck -check-prefix=STRICT %s
 // RUN: %clang --target=powerpc64-ibm-aix-xcoff -### %s -flto -g 2>&1 \
-// RUN:   | FileCheck -check-prefixes=STRICT,NODEBUGGER-TUNE %s
+// RUN:   | FileCheck -check-prefix=STRICT %s
 // RUN: %clang --target=powerpc-ibm-aix-xcoff -### %s -flto -g -gdbx 2>&1 \
-// RUN:   | FileCheck -check-prefix=DBX -check-prefix=STRICT %s
+// RUN:   | FileCheck -check-prefix=STRICT %s
 // RUN: %clang --target=powerpc-ibm-aix-xcoff -### %s -flto -g -ggdb 2>&1 \
-// RUN:   | FileCheck -check-prefix=GDB -check-prefix=STRICT %s
+// RUN:   | FileCheck -check-prefix=STRICT %s
 // RUN: %clang --target=powerpc-ibm-aix-xcoff -### %s -flto -g -ggdb0 2>&1 \
-// RUN:   | FileCheck -check-prefix=GDB -check-prefix=NOSTRICT %s
+// RUN:   | FileCheck -check-prefix=NOSTRICT %s
 // RUN: %clang --target=powerpc-ibm-aix-xcoff -### %s -flto -g -ggdb1 2>&1 \
-// RUN:   | FileCheck -check-prefix=GDB -check-prefix=STRICT %s
+// RUN:   | FileCheck -check-prefix=STRICT %s
 // RUN: %clang --target=powerpc-ibm-aix-xcoff -### %s -flto -g -g0 2>&1 \
 // RUN:   | FileCheck -check-prefix=NOSTRICT %s
 // RUN: %clang --target=powerpc-ibm-aix-xcoff -### %s -flto -g -gno-strict-dwarf 2>&1 \
@@ -59,10 +55,6 @@
 // RUN: %clang --target=powerpc-ibm-aix-xcoff -### %s -flto -gstrict-dwarf 2>&1 \
 // RUN:   | FileCheck -check-prefix=NOSTRICT %s
 //
-// DBX:    "-bplugin_opt:-debugger-tune=dbx"
-// GDB:    "-bplugin_opt:-debugger-tune=gdb"
-// NODEBUGGER-TUNE-NOT: "-bplugin_opt:-debugger-tune="
-//
 // STRICT:       "-bplugin_opt:-strict-dwarf=true"
 // NOSTRICT-NOT: "-bplugin_opt:-strict-dwarf=true"
 
diff --git a/clang/test/Driver/lto.c b/clang/test/Driver/lto.c
index 838eb740863752..61ac0c8c2226d7 100644
--- a/clang/test/Driver/lto.c
+++ b/clang/test/Driver/lto.c
@@ -73,15 +73,6 @@
 // O2: -plugin-opt=O2
 // O3: -plugin-opt=O3
 
-// -flto passes along an explicit debugger tuning argument.
-// RUN: %clang --target=x86_64-unknown-linux -### %s -flto -glldb 2> %t
-// RUN: FileCheck -check-prefix=CHECK-TUNING-LLDB < %t %s
-// RUN: %clang --target=x86_64-unknown-linux -### %s -flto -g 2> %t
-// RUN: FileCheck -check-prefix=CHECK-NO-TUNING < %t %s
-//
-// CHECK-TUNING-LLDB:   "-plugin-opt=-debugger-tune=lldb"
-// CHECK-NO-TUNING-NOT: "-plugin-opt=-debugger-tune
-//
 // -flto=auto and -flto=jobserver pass along -flto=full
 // RUN: %clang --target=x86_64-unknown-linux -### %s -flto=auto 2>&1 | FileCheck --check-prefix=FLTO-AUTO %s
 // RUN: %clang --target=x86_64-unknown-linux -### %s -flto=jobserver 2>&1 | FileCheck --check-prefix=FLTO-JOBSERVER %s
diff --git a/lld/test/ELF/lto/debugger-tune.ll b/lld/test/ELF/lto/debugger-tune.ll
index 193bc632aae054..e120400a510ea3 100644
--- a/lld/test/ELF/lto/debugger-tune.ll
+++ b/lld/test/ELF/lto/debugger-tune.ll
@@ -1,7 +1,7 @@
 ; REQUIRES: x86
 ; RUN: llvm-as %s -o %t.o
 
-; Here we verify that -debugger-tune=<value> option is
+; Here we verify that the "debugger-tuning" module flag is
 ; handled by LLD. DWARF linkage name attributes are optional,
 ; they normally present, but are missing for SCE debugger tune.
 
@@ -9,7 +9,9 @@
 ; RUN: llvm-dwarfdump %t.exe | FileCheck %s
 ; CHECK: DW_AT_linkage_name ("name_of_foo")
 
-; RUN: ld.lld -plugin-opt=-debugger-tune=sce %t.o -o %t.exe
+; RUN: sed 's/TUNE_PLACEHOLDER/sce/' %s | \
+; RUN:   llvm-as -o %t.sce.o
+; RUN: ld.lld %t.sce.o -o %t.exe
 ; RUN: llvm-dwarfdump %t.exe | FileCheck --check-prefix=SCE %s
 ; SCE-NOT: name_of_foo
 
@@ -19,7 +21,7 @@ target triple = "x86_64-unknown-linux-gnu"
 @foo = global i32 0, align 4, !dbg !0
 
 !llvm.dbg.cu = !{!5}
-!llvm.module.flags = !{!8, !9}
+!llvm.module.flags = !{!8, !9, !10}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
 !1 = distinct !DIGlobalVariable(name: "global_foo", linkageName: "name_of_foo", scope: !2,
@@ -33,3 +35,4 @@ target triple = "x86_64-unknown-linux-gnu"
 !7 = !{!0}
 !8 = !{i32 2, !"Dwarf Version", i32 4}
 !9 = !{i32 2, !"Debug Info Version", i32 3}
+!10 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
diff --git a/llvm/docs/ReleaseNotes.md b/llvm/docs/ReleaseNotes.md
index 48bd91c2598601..283c625be7aeb8 100644
--- a/llvm/docs/ReleaseNotes.md
+++ b/llvm/docs/ReleaseNotes.md
@@ -184,6 +184,10 @@ Makes programs 10x faster by doing Special New Thing.
   GNU-vs-EABI distinction is now derived entirely from the target triple's
   environment (e.g. `arm-none-gnueabi` vs `arm-none-eabi`).
 
+* Removed `TargetOptions::DebuggerTuning` and the `llc`/`opt`
+  `-debugger-tune=` flag. The debugger to tune debug info for is now
+  controlled by setting the `"debugger-tuning"` module flag.
+
 * Replaced `TargetOptions::EnableMachineFunctionSplitter` with
   `TargetOptions::FunctionSplitting`, and the `-split-machine-functions` and
   `-enable-split-machine-functions` flags with
diff --git a/llvm/include/llvm/CodeGen/CommandFlags.h b/llvm/include/llvm/CodeGen/CommandFlags.h
index cbaffbba98eaef..dda8efc50a07b6 100644
--- a/llvm/include/llvm/CodeGen/CommandFlags.h
+++ b/llvm/include/llvm/CodeGen/CommandFlags.h
@@ -105,8 +105,6 @@ LLVM_ABI bool getUniqueBasicBlockSectionNames();
 
 LLVM_ABI bool getSeparateNamedSections();
 
-LLVM_ABI llvm::DebuggerKind getDebuggerTuningOpt();
-
 LLVM_ABI llvm::VectorLibrary getVectorLibrary();
 
 LLVM_ABI bool getEnableStackSizeSection();
diff --git a/llvm/include/llvm/CodeGen/LiveDebugValuesPass.h b/llvm/include/llvm/CodeGen/LiveDebugValuesPass.h
index b098cf27f80579..be83b5c6afb6b5 100644
--- a/llvm/include/llvm/CodeGen/LiveDebugValuesPass.h
+++ b/llvm/include/llvm/CodeGen/LiveDebugValuesPass.h
@@ -14,18 +14,9 @@
 namespace llvm {
 
 class LiveDebugValuesPass : public RequiredPassInfoMixin<LiveDebugValuesPass> {
-  const bool ShouldEmitDebugEntryValues;
-
 public:
-  LiveDebugValuesPass(bool ShouldEmitDebugEntryValues)
-      : ShouldEmitDebugEntryValues(ShouldEmitDebugEntryValues) {}
-
   LLVM_ABI PreservedAnalyses run(MachineFunction &MF,
                                  MachineFunctionAnalysisManager &MFAM);
-
-  LLVM_ABI void
-  printPipeline(raw_ostream &OS,
-                function_ref<StringRef(StringRef)> MapClassName2PassName);
 };
 
 } // namespace llvm
diff --git a/llvm/include/llvm/Passes/MachinePassRegistry.def b/llvm/include/llvm/Passes/MachinePassRegistry.def
index 3e5f26ddb488de..d532f7ee7a8898 100644
--- a/llvm/include/llvm/Passes/MachinePassRegistry.def
+++ b/llvm/include/llvm/Passes/MachinePassRegistry.def
@@ -90,6 +90,7 @@ MACHINE_FUNCTION_PASS("ir-translator", IRTranslatorPass(TM->getOptLevel()))
 MACHINE_FUNCTION_PASS("kcfi", MachineKCFIPass())
 MACHINE_FUNCTION_PASS("gc-empty-basic-blocks", GCEmptyBasicBlocksPass())
 MACHINE_FUNCTION_PASS("legalizer", LegalizerPass())
+MACHINE_FUNCTION_PASS("live-debug-values", LiveDebugValuesPass())
 MACHINE_FUNCTION_PASS("load-store-opt", LoadStoreOptPass())
 MACHINE_FUNCTION_PASS("localizer", LocalizerPass())
 MACHINE_FUNCTION_PASS("localstackalloc", LocalStackSlotAllocationPass())
@@ -193,17 +194,6 @@ MACHINE_FUNCTION_PASS_WITH_PARAMS(
     },
     "enable-tail-merge")
 
-MACHINE_FUNCTION_PASS_WITH_PARAMS(
-    "live-debug-values", "LiveDebugValuesPass",
-    [](bool ShouldEmitDebugEntryValues) {
-      return LiveDebugValuesPass(ShouldEmitDebugEntryValues);
-    },
-    [](StringRef Params) {
-      return parseSinglePassOption(Params, "emit-debug-entry-values",
-                                   "LiveDebugValuesPass");
-    },
-    "emit-debug-entry-values")
-
 MACHINE_FUNCTION_PASS_WITH_PARAMS(
     "machine-sink", "MachineSinkingPass",
     [](bool EnableSinkAndFold) {
diff --git a/llvm/include/llvm/Target/TargetMachine.h b/llvm/include/llvm/Target/TargetMachine.h
index bc151c3ea8f55e..20ff2bdd13e1af 100644
--- a/llvm/include/llvm/Target/TargetMachine.h
+++ b/llvm/include/llvm/Target/TargetMachine.h
@@ -293,7 +293,7 @@ class LLVM_ABI TargetMachine {
 
   /// NOTE: There are targets that still do not support the debug entry values
   /// production.
-  bool shouldEmitDebugEntryValues() const;
+  bool shouldEmitDebugEntryValues(DebuggerKind Tuning) const;
 
   /// Whether the fast register allocator lowers tied operands itself instead
   /// of running TwoAddressInstructionPass. AMDGPU anchors passes on
diff --git a/llvm/include/llvm/Target/TargetOptions.h b/llvm/include/llvm/Target/TargetOptions.h
index da83dd76835d6f..dd010590a80b0a 100644
--- a/llvm/include/llvm/Target/TargetOptions.h
+++ b/llvm/include/llvm/Target/TargetOptions.h
@@ -282,9 +282,6 @@ class TargetOptions {
   /// If greater than 0, override TargetLoweringBase::PrefLoopAlignment.
   unsigned LoopAlignment = 0;
 
-  /// Which debugger to tune for.
-  DebuggerKind DebuggerTuning = DebuggerKind::Default;
-
   /// Vector math library to use.
   VectorLibrary VecLib = VectorLibrary::NoLibrary;
 
diff --git a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 12fb2829e1ed6d..6e4c73079690b8 100644
--- a/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -339,21 +339,15 @@ DwarfDebug::DwarfDebug(AsmPrinter *A)
     : DebugHandlerBase(A), DebugLocs(A->OutStreamer->isVerboseAsm()),
       SkeletonHolder(A, "skel_string", DIEValueAllocator),
       IsDarwin(A->TM.getTargetTriple().isOSDarwin()),
+      DebuggerTuning(MMI->getModule()->getDebuggerTuning()),
       InfoHolder(A, "info_string", DIEValueAllocator) {
   const Triple &TT = Asm->TM.getTargetTriple();
 
-  // Make sure we know our "debugger tuning".  The target option takes
-  // precedence; fall back to triple-based defaults.
-  if (Asm->TM.Options.DebuggerTuning != DebuggerKind::Default)
-    DebuggerTuning = Asm->TM.Options.DebuggerTuning;
-  else if (IsDarwin)
-    DebuggerTuning = DebuggerKind::LLDB;
-  else if (TT.isPS())
-    DebuggerTuning = DebuggerKind::SCE;
-  else if (TT.isOSAIX())
-    DebuggerTuning = DebuggerKind::DBX;
-  else
-    DebuggerTuning = DebuggerKind::GDB;
+  // Emit call-site-param debug info for GDB and LLDB, if the target supports
+  // the debug entry values feature. It can also be enabled explicitly.
+  EmitDebugEntryValues = Asm->TM.shouldEmitDebugEntryValues(DebuggerTuning);
+  if (DebuggerTuning == DebuggerKind::Default)
+    DebuggerTuning = TT.getDefaultDebuggerTuning();
 
   if (DwarfInlinedStrings == Default)
     UseInlineStrings = tuneForDBX();
@@ -424,10 +418,6 @@ DwarfDebug::DwarfDebug(AsmPrinter *A)
   // a monolithic string offsets table without any header.
   UseSegmentedStringOffsetsTable = DwarfVersion >= 5;
 
-  // Emit call-site-param debug info for GDB and LLDB, if the target supports
-  // the debug entry values feature. It can also be enabled explicitly.
-  EmitDebugEntryValues = Asm->TM.shouldEmitDebugEntryValues();
-
   // It is unclear if the GCC .debug_macro extension is well-specified
   // for split DWARF. For now, do not allow LLVM to emit it.
   UseDebugMacroSection =
diff --git a/llvm/lib/CodeGen/CommandFlags.cpp b/llvm/lib/CodeGen/CommandFlags.cpp
index a780abce7e5bb5..bc56b0d0aeca1e 100644
--- a/llvm/lib/CodeGen/CommandFlags.cpp
+++ b/llvm/lib/CodeGen/CommandFlags.cpp
@@ -98,7 +98,6 @@ CGOPT_EXP(bool, EnableTLSDESC)
 CGOPT(bool, UniqueSectionNames)
 CGOPT(bool, UniqueBasicBlockSectionNames)
 CGOPT(bool, SeparateNamedSections)
-CGOPT(DebuggerKind, DebuggerTuningOpt)
 CGOPT(VectorLibrary, VectorLibrary)
 CGOPT(bool, EnableStackSizeSection)
 CGOPT(bool, EnableAddrsig)
@@ -370,16 +369,6 @@ codegen::RegisterCodeGenFlags::RegisterCodeGenFlags() {
       cl::init(false));
   CGBINDOPT(SeparateNamedSections);
 
-  static cl::opt<DebuggerKind> DebuggerTuningOpt(
-      "debugger-tune", cl::desc("Tune debug info for a particular debugger"),
-      cl::init(DebuggerKind::Default),
-      cl::values(
-          clEnumValN(DebuggerKind::GDB, "gdb", "gdb"),
-          clEnumValN(DebuggerKind::LLDB, "lldb", "lldb"),
-          clEnumValN(DebuggerKind::DBX, "dbx", "dbx"),
-          clEnumValN(DebuggerKind::SCE, "sce", "SCE targets (e.g. PS4)")));
-  CGBINDOPT(DebuggerTuningOpt);
-
   static cl::opt<VectorLibrary> VectorLibrary(
       "vector-library", cl::Hidden, cl::desc("Vector functions library"),
       cl::init(VectorLibrary::NoLibrary),
@@ -555,7 +544,6 @@ codegen::InitTargetOptionsFromCodeGenFlags(const Triple &TheTriple) {
 
   Options.MCOptions = mc::InitMCTargetOptionsFromFlags();
 
-  Options.DebuggerTuning = getDebuggerTuningOpt();
   Options.SwiftAsyncFramePointer = getSwiftAsyncFramePointer();
   return Options;
 }
diff --git a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
index 72760fbe2846e7..a546d53de61c58 100644
--- a/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
+++ b/llvm/lib/CodeGen/LiveDebugValues/LiveDebugValues.cpp
@@ -111,6 +111,10 @@ LiveDebugValues::LiveDebugValues() {
 PreservedAnalyses
 LiveDebugValuesPass::run(MachineFunction &MF,
                          MachineFunctionAnalysisManager &MFAM) {
+
+  const Module *M = MF.getFunction().getParent();
+  bool ShouldEmitDebugEntryValues =
+      MF.getTarget().shouldEmitDebugEntryValues(M->getDebuggerTuning());
   if (!LiveDebugValues().run(MF, ShouldEmitDebugEntryValues))
     return PreservedAnalyses::all();
   auto PA = getMachineFunctionPassPreservedAnalyses();
@@ -118,17 +122,12 @@ LiveDebugValuesPass::run(MachineFunction &MF,
   return PA;
 }
 
-void LiveDebugValuesPass::printPipeline(
-    raw_ostream &OS, function_ref<StringRef(StringRef)> MapClassName2PassName) {
-  OS << MapClassName2PassName(name());
-  if (ShouldEmitDebugEntryValues)
-    OS << "<emit-debug-entry-values>";
-}
-
 bool LiveDebugValuesLegacy::runOnMachineFunction(MachineFunction &MF) {
   auto *TPC = &getAnalysis<TargetPassConfig>();
+  const Module *M = MF.getFunction().getParent();
   return LiveDebugValues().run(
-      MF, TPC->getTM<TargetMachine>().shouldEmitDebugEntryValues());
+      MF, TPC->getTM<TargetMachine>().shouldEmitDebugEntryValues(
+              M->getDebuggerTuning()));
 }
 
 bool LiveDebugValues::run(MachineFunction &MF,
diff --git a/llvm/lib/LTO/LTO.cpp b/llvm/lib/LTO/LTO.cpp
index 22097c28d4e3a2..49061dadb0124b 100644
--- a/llvm/lib/LTO/LTO.cpp
+++ b/llvm/lib/LTO/LTO.cpp
@@ -174,12 +174,11 @@ std::string llvm::computeLTOCacheKey(
   AddString(Conf.CPU);
   // FIXME: Hash more of Options. For now all clients initialize Options from
   // command-line flags (which is unsupported in production), but may set
-  // X86RelaxRelocations. The clang driver can also pass FunctionSections,
-  // DataSections and DebuggerTuning via command line flags.
+  // X86RelaxRelocations. The clang driver can also pass FunctionSections and
+  // DataSections via command line flags.
   AddUnsigned(Conf.Options.MCOptions.X86RelaxRelocations);
   AddUnsigned(Conf.Options.FunctionSections);
   AddUnsigned(Conf.Options.DataSections);
-  AddUnsigned((unsigned)Conf.Options.DebuggerTuning);
   for (auto &A : Conf.MAttrs)
     AddString(A);
   if (Conf.RelocModel)
diff --git a/llvm/lib/Passes/CodeGenPassBuilder.cpp b/llvm/lib/Passes/CodeGenPassBuilder.cpp
index 7f03546944fc16..ae858f23b135e3 100644
--- a/llvm/lib/Passes/CodeGenPassBuilder.cpp
+++ b/llvm/lib/Passes/CodeGenPassBuilder.cpp
@@ -710,8 +710,7 @@ Error CodeGenPassBuilder::addMachinePasses(PassManagerWrapper &PMW) {
 
   addMachineFunctionPass(RemoveLoadsIntoFakeUsesPass(), PMW);
   addMachineFunctionPass(StackMapLivenessPass(), PMW);
-  addMachineFunctionPass(LiveDebugValuesPass(TM.shouldEmitDebugEntryValues()),
-                         PMW);
+  addMachineFunctionPass(LiveDebugValuesPass(), PMW);
   addMachineFunctionPass(MachineSanitizerBinaryMetadataPass(), PMW);
 
   if (TM.Options.EnableMachineOutliner &&
diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp
index b01dfb9f09a5bb..93968babdbd701 100644
--- a/llvm/lib/Target/TargetMachine.cpp
+++ b/llvm/lib/Target/TargetMachine.cpp
@@ -91,10 +91,11 @@ TargetMachine::~TargetMachine() = default;
 /// In addition, SCE debugger does not have the feature implemented, so prefer
 /// not to emit the debug entry values in that case.
 /// The EnableDebugEntryValues can be used for the testing purposes.
-bool TargetMachine::shouldEmitDebugEntryValues() const {
-  return (SupportsDebugEntryValues &&
-          Options.DebuggerTuning != DebuggerKind::SCE) ||
-         Options.EnableDebugEntryValues;
+bool TargetMachine::shouldEmitDebugEntryValues(DebuggerKind Tuning) const {
+  // Only the explicitly-set "debugger-tuning" module flag suppresses entry
+  // values.
+  return Options.EnableDebugEntryValues ||
+         (SupportsDebugEntryValues && Tuning != DebuggerKind::SCE);
 }
 
 Expected<std::unique_ptr<MCStreamer>>
diff --git a/llvm/test/CodeGen/RISCV/O0-newpm-pipeline.ll b/llvm/test/CodeGen/RISCV/O0-newpm-pipeline.ll
index 6eebf695e3a9a1..e9a56f7a332073 100644
--- a/llvm/test/CodeGen/RISCV/O0-newpm-pipeline.ll
+++ b/llvm/test/CodeGen/RISCV/O0-newpm-pipeline.ll
@@ -51,7 +51,7 @@
 ; CHECK-NEXT:     funclet-layout
 ; CHECK-NEXT:     remove-loads-into-fake-uses
 ; CHECK-NEXT:     StackMapLivenessPass
-; CHECK-NEXT:     live-debug-values<emit-debug-entry-values>
+; CHECK-NEXT:     live-debug-values
 ; CHECK-NEXT:     machine-sanmd
 ; CHECK-NEXT:     stack-frame-layout
 ; CHECK-NEXT:     riscv-expand-pseudo-pre-emit
diff --git a/llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll b/llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll
index 6663d6762b03d0..419b6d5a1c545d 100644
--- a/llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll
+++ b/llvm/test/CodeGen/RISCV/O3-newpm-pipeline.ll
@@ -102,7 +102,7 @@
 ; CHECK-NEXT:     funclet-layout
 ; CHECK-NEXT:     remove-loads-into-fake-uses
 ; CHECK-NEXT:     StackMapLivenessPass
-; CHECK-NEXT:     live-debug-values<emit-debug-entry-values>
+; CHECK-NEXT:     live-debug-values
 ; CHECK-NEXT:     machine-sanmd
 ; CHECK-NEXT: MachineOutlinerPass
 ; CHECK-NEXT: function
diff --git a/llvm/test/CodeGen/X86/llc-pipeline-npm.ll b/llvm/test/CodeGen/X86/llc-pipeline-npm.ll
index ad7f99a82fb619..cdc202e7a8eb6e 100644
--- a/llvm/test/CodeGen/X86/llc-pipeline-npm.ll
+++ b/llvm/test/CodeGen/X86/llc-pipeline-npm.ll
@@ -70,7 +70,7 @@
 ; O0-NEXT:     funclet-layout
 ; O0-NEXT:     remove-loads-into-fake-uses
 ; O0-NEXT:     StackMapLivenessPass
-; O0-NEXT:     live-debug-values<emit-debug-entry-values>
+; O0-NEXT:     live-debug-values
 ; O0-NEXT:     machine-sanmd
 ; O0-NEXT:     stack-frame-layout
 ; O0-NEXT:     x86-seses
@@ -202,7 +202,7 @@
 ; O2-NEXT:     funclet-layout
 ; O2-NEXT:     remove-loads-into-fake-uses
 ; O2-NEXT:     StackMapLivenessPass
-; O2-NEXT:     live-debug-values<emit-debug-entry-values>
+; O2-NEXT:     live-debug-values
 ; O2-NEXT:     machine-sanmd
 ; O2-NEXT:     stack-frame-layout
 ; O2-NEXT:     x86-seses
@@ -278,7 +278,7 @@
 ; O0-WINDOWS-NEXT:     funclet-layout
 ; O0-WINDOWS-NEXT:     remove-loads-into-fake-uses
 ; O0-WINDOWS-NEXT:     StackMapLivenessPass
-; O0-WINDOWS-NEXT:     live-debug-values<emit-debug-entry-values>
+; O0-WINDOWS-NEXT:     live-debug-values
 ; O0-WINDOWS-NEXT:     machine-sanmd
 ; O0-WINDOWS-NEXT:     stack-frame-layout
 ; O0-WINDOWS-NEXT:     x86-seses
@@ -415,7 +415,7 @@
 ; O3-WINDOWS-NEXT:     funclet-layout
 ; O3-WINDOWS-NEXT:     remove-loads-into-fake-uses
 ; O3-WINDOWS-NEXT:     StackMapLivenessPass
-; O3-WINDOWS-NEXT:     live-debug-values<emit-debug-entry-values>
+; O3-WINDOWS-NEXT:     live-debug-values
 ; O3-WINDOWS-NEXT:     machine-sanmd
 ; O3-WINDOWS-NEXT:     stack-frame-layout
 ; O3-WINDOWS-NEXT:     x86-seses
diff --git a/llvm/test/DebugInfo/ARM/big-endian-bitfield.ll b/llvm/test/DebugInfo/ARM/big-endian-bitfield.ll
index 168c88a5e480ac..6e4f9b25e637ba 100644
--- a/llvm/test/DebugInfo/ARM/big-endian-bitfield.ll
+++ b/llvm/test/DebugInfo/ARM/big-endian-bitfield.ll
@@ -1,4 +1,4 @@
-; RUN: llc -O0 -filetype=obj -mtriple=armeb-none-freebsd -debugger-tune=lldb %s -o - \
+; RUN: llc -O0 -filetype=obj -mtriple=armeb-none-freebsd %s -o - \
 ; RUN: | llvm-dwarfdump -v --debug-info - | FileCheck %s
 ; Generated from:
 ;   struct S {
@@ -16,7 +16,7 @@ target datalayout = "E-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
 @s = common global %struct.S zeroinitializer, align 4, !dbg !0
 
 !llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!13, !14, !15}
+!llvm.module.flags = !{!13, !14, !15, !17}
 !llvm.ident = !{!16}
 
 !0 = distinct !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -52,4 +52,5 @@ target datalayout = "E-m:e-p:32:32-i64:64-v128:64:128-n32-S64"
 ; CHECK-NOT:  DW_TAG
 ; CHECK:      DW_AT_data_bit_offset      [DW_FORM_data1]	(0x10)
 !16 = !{!"clang version 3.9.0 (trunk 267633)"}
+!17 = !{i32 2, !"debugger-tuning", !"lldb"}
 
diff --git a/llvm/test/DebugInfo/COFF/thunk.ll b/llvm/test/DebugInfo/COFF/thunk.ll
index 7ab96c85dbf3e8..1b1644f44ed559 100644
--- a/llvm/test/DebugInfo/COFF/thunk.ll
+++ b/llvm/test/DebugInfo/COFF/thunk.ll
@@ -1,6 +1,6 @@
 ; RUN: llc < %s -filetype=obj | llvm-readobj - --codeview | FileCheck %s
 ; RUN: llc < %s | FileCheck %s --check-prefix=ASM
-; RUN: opt -S -debugger-tune=lldb %s | FileCheck -check-prefix=OPT %s
+; RUN: opt -S %s | FileCheck -check-prefix=OPT %s
 
 ; -- "thunk.cpp" begin --------------------------------------------------------
 ; class A { public: virtual bool MyMethod() { return true; } }; 
diff --git a/llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll b/llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
index 21b6c4dc1f59aa..3427011627d9b8 100644
--- a/llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
+++ b/llvm/test/DebugInfo/Generic/2010-04-19-FramePtr.ll
@@ -1,7 +1,8 @@
 ; XFAIL: target={{.*}}-aix{{.*}}
-; RUN: %llc_dwarf -debugger-tune=lldb -asm-verbose -O1 -o - < %s | FileCheck %s
-; RUN: %llc_dwarf -debugger-tune=gdb -asm-verbose -O1 -o - < %s | FileCheck %s --check-prefix=DISABLE
-; RUN: %llc_dwarf -frame-pointer=all -debugger-tune=lldb -asm-verbose -O1 -o - < %s | FileCheck %s --check-prefix=DISABLE
+; RUN: %llc_dwarf -asm-verbose -O1 -o - < %s | FileCheck %s
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s | \
+; RUN:   %llc_dwarf -asm-verbose -O1 -o - | FileCheck %s --check-prefix=DISABLE
+; RUN: %llc_dwarf -frame-pointer=all -asm-verbose -O1 -o - < %s | FileCheck %s --check-prefix=DISABLE
 
 ; CHECK: DW_AT_APPLE_omit_frame_ptr
 ; DISABLE-NOT: DW_AT_APPLE_omit_frame_ptr
@@ -23,7 +24,7 @@ return:                                           ; preds = %entry
 }
 
 !llvm.dbg.cu = !{!3}
-!llvm.module.flags = !{!12}
+!llvm.module.flags = !{!12, !13}
 !9 = !{!1}
 
 !0 = !DILocation(line: 2, scope: !1)
@@ -38,3 +39,4 @@ return:                                           ; preds = %entry
 !10 = !DIFile(filename: "a.c", directory: "/tmp")
 !11 = !{}
 !12 = !{i32 1, !"Debug Info Version", i32 3}
+!13 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
diff --git a/llvm/test/DebugInfo/Generic/debug-info-enum-dwarf2.ll b/llvm/test/DebugInfo/Generic/debug-info-enum-dwarf2.ll
index d424e17356686e..7a8b9a37093cc3 100644
--- a/llvm/test/DebugInfo/Generic/debug-info-enum-dwarf2.ll
+++ b/llvm/test/DebugInfo/Generic/debug-info-enum-dwarf2.ll
@@ -9,7 +9,7 @@
 
 ; UNSUPPORTED: target=powerpc64{{.*}}-aix{{.*}}
 
-; RUN: llc -debugger-tune=gdb -dwarf-version=2 -filetype=obj -o %t.o < %S/debug-info-enum.ll
+; RUN: llc -dwarf-version=2 -filetype=obj -o %t.o < %S/debug-info-enum.ll
 ; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %S/debug-info-enum.ll --check-prefixes=CHECK,CHECK-TYPE
-; RUN: llc -debugger-tune=gdb -dwarf-version=2 -strict-dwarf=true -filetype=obj -o %t.o < %S/debug-info-enum.ll
+; RUN: llc -dwarf-version=2 -strict-dwarf=true -filetype=obj -o %t.o < %S/debug-info-enum.ll
 ; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %S/debug-info-enum.ll --check-prefixes=CHECK,CHECK-DW2-STRICT
diff --git a/llvm/test/DebugInfo/Generic/debug-info-enum.ll b/llvm/test/DebugInfo/Generic/debug-info-enum.ll
index 67b48eeac0357f..d89df47709e719 100644
--- a/llvm/test/DebugInfo/Generic/debug-info-enum.ll
+++ b/llvm/test/DebugInfo/Generic/debug-info-enum.ll
@@ -5,9 +5,9 @@
 ; * test that DW_AT_type is present for v3 and greater, and v2 when strict DWARF
 ;   is not enabled.
 
-; RUN: llc -debugger-tune=gdb -dwarf-version=4 -filetype=obj -o %t.o < %s
+; RUN: llc -dwarf-version=4 -filetype=obj -o %t.o < %s
 ; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s --check-prefixes=CHECK,CHECK-DW4,CHECK-TYPE
-; RUN: llc -debugger-tune=gdb -dwarf-version=3 -filetype=obj -o %t.o < %s
+; RUN: llc -dwarf-version=3 -filetype=obj -o %t.o < %s
 ; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s --check-prefixes=CHECK,CHECK-TYPE
 
 ; This file is also used by the dwarf-version=2 tests in debug-info-enum-dwarf2.ll.
diff --git a/llvm/test/DebugInfo/Generic/debug-names-accel-table-types.ll b/llvm/test/DebugInfo/Generic/debug-names-accel-table-types.ll
index 2a6c89dcab5978..e5f40b1f899c5f 100644
--- a/llvm/test/DebugInfo/Generic/debug-names-accel-table-types.ll
+++ b/llvm/test/DebugInfo/Generic/debug-names-accel-table-types.ll
@@ -1,5 +1,5 @@
 ; XFAIL: target={{.*}}-aix{{.*}}, target={{.*}}-zos{{.*}}
-; RUN: %llc_dwarf -debugger-tune=lldb -accel-tables=Dwarf -filetype=obj -o %t < %s
+; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
 ; RUN: llvm-dwarfdump %t | FileCheck %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck --check-prefix=SAME-NAME %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck --check-prefix=DIFFERENT-NAME %s
diff --git a/llvm/test/DebugInfo/Generic/debug-names-empty-name.ll b/llvm/test/DebugInfo/Generic/debug-names-empty-name.ll
index aeccb03490253f..fc3d4082293b93 100644
--- a/llvm/test/DebugInfo/Generic/debug-names-empty-name.ll
+++ b/llvm/test/DebugInfo/Generic/debug-names-empty-name.ll
@@ -1,5 +1,5 @@
 ; XFAIL: target={{.*}}-aix{{.*}}
-; RUN: %llc_dwarf -debugger-tune=lldb -accel-tables=Dwarf -filetype=obj -o %t < %s
+; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
 ; RUN: llvm-dwarfdump -find=_GLOBAL__sub_I__ %t | FileCheck --check-prefix=INFO %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck --check-prefix=NAMES %s
 ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
@@ -24,7 +24,7 @@ entry:
 }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5}
+!llvm.module.flags = !{!3, !4, !5, !9}
 !llvm.ident = !{!6}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 7.0.0 (trunk 329378) (llvm/trunk 329379)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !2)
@@ -36,3 +36,4 @@ entry:
 !6 = !{!"clang version 7.0.0 (trunk 329378) (llvm/trunk 329379)"}
 !7 = distinct !DISubprogram(linkageName: "_GLOBAL__sub_I__", scope: !1, file: !1, type: !8, isLocal: true, isDefinition: true, flags: DIFlagArtificial, isOptimized: false, unit: !0, retainedNodes: !2)
 !8 = !DISubroutineType(types: !2)
+!9 = !{i32 2, !"debugger-tuning", !"lldb"}
diff --git a/llvm/test/DebugInfo/Generic/debug-names-nameless-var.ll b/llvm/test/DebugInfo/Generic/debug-names-nameless-var.ll
index dbceb6d7a14d49..dd9a9af25cca44 100644
--- a/llvm/test/DebugInfo/Generic/debug-names-nameless-var.ll
+++ b/llvm/test/DebugInfo/Generic/debug-names-nameless-var.ll
@@ -1,5 +1,5 @@
 ; XFAIL: target={{.*}}-aix{{.*}}
-; RUN: %llc_dwarf -debugger-tune=lldb -accel-tables=Dwarf -filetype=obj -o %t %s
+; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck %s
 ; RUN: llvm-dwarfdump -debug-names -verify %t | FileCheck --check-prefix=VERIFY %s
 
@@ -9,7 +9,7 @@
 ; VERIFY: No errors
 
 !llvm.dbg.cu = !{!10}
-!llvm.module.flags = !{!14, !15}
+!llvm.module.flags = !{!14, !15, !21}
 !llvm.ident = !{!20}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -21,3 +21,4 @@
 !14 = !{i32 7, !"Dwarf Version", i32 5}
 !15 = !{i32 2, !"Debug Info Version", i32 3}
 !20 = !{!"blah"}
+!21 = !{i32 2, !"debugger-tuning", !"lldb"}
diff --git a/llvm/test/DebugInfo/Generic/dwarf-public-names.ll b/llvm/test/DebugInfo/Generic/dwarf-public-names.ll
index bcb16172b7bcf4..01504d002665a6 100644
--- a/llvm/test/DebugInfo/Generic/dwarf-public-names.ll
+++ b/llvm/test/DebugInfo/Generic/dwarf-public-names.ll
@@ -1,4 +1,4 @@
-; RUN: %llc_dwarf -debugger-tune=gdb -filetype=obj -o %t.o < %s
+; RUN: %llc_dwarf -filetype=obj -o %t.o < %s
 ; RUN: llvm-dwarfdump -debug-pubnames %t.o | FileCheck %s
 ; ModuleID = 'dwarf-public-names.cpp'
 ;
@@ -93,7 +93,7 @@ attributes #0 = { nounwind uwtable }
 attributes #1 = { nounwind readnone }
 
 !llvm.dbg.cu = !{!20}
-!llvm.module.flags = !{!22}
+!llvm.module.flags = !{!22, !39}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
 !1 = !DIGlobalVariable(name: "static_member_variable", linkageName: "_ZN1C22static_member_variableE", scope: !2, file: !3, line: 7, type: !6, isLocal: false, isDefinition: true, declaration: !5)
@@ -118,6 +118,7 @@ attributes #1 = { nounwind readnone }
 !20 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang version 3.3", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !11, retainedTypes: !11, globals: !21, imports: !11) ; previously: invalid DW_TAG_base_type
 !21 = !{!0, !15, !17}
 !22 = !{i32 1, !"Debug Info Version", i32 3}
+!39 = !{i32 2, !"debugger-tuning", !"gdb"}
 !23 = distinct !DISubprogram(name: "member_function", linkageName: "_ZN1C15member_functionEv", scope: null, file: !3, line: 9, type: !8, isLocal: false, isDefinition: true, scopeLine: 9, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !20, declaration: !7, retainedNodes: !11)
 !24 = !DILocalVariable(name: "this", arg: 1, scope: !23, file: !3, line: 9, type: !25, flags: DIFlagArtificial | DIFlagObjectPointer)
 !25 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !2, size: 64, align: 64)
diff --git a/llvm/test/DebugInfo/Generic/linkage-name-abstract.ll b/llvm/test/DebugInfo/Generic/linkage-name-abstract.ll
index 48084197af979c..8b5ab9102ed1af 100644
--- a/llvm/test/DebugInfo/Generic/linkage-name-abstract.ll
+++ b/llvm/test/DebugInfo/Generic/linkage-name-abstract.ll
@@ -2,7 +2,7 @@
 ; RUN: FileCheck %s -check-prefix=ONENAME < %t
 ; RUN: FileCheck %s -check-prefix=REF < %t 
 ; Verify tuning for SCE gets us Abstract only.
-; RUN: %llc_dwarf -O0 -filetype=obj -debugger-tune=sce < %s | llvm-dwarfdump -debug-info - > %t
+; RUN: %llc_dwarf -O0 -filetype=obj < %s | llvm-dwarfdump -debug-info - > %t
 ; RUN: FileCheck %s -check-prefix=ONENAME < %t
 ; RUN: FileCheck %s -check-prefix=REF < %t 
 
@@ -101,7 +101,7 @@ entry:
 attributes #0 = { alwaysinline }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4}
+!llvm.module.flags = !{!3, !4, !25}
 !llvm.ident = !{!5}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 4.0.0 (trunk 288231)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
@@ -129,3 +129,4 @@ attributes #0 = { alwaysinline }
 !22 = !DILocation(line: 13, column: 3, scope: !15, inlinedAt: !23)
 !23 = distinct !DILocation(line: 16, column: 3, scope: !21)
 !24 = !DILocation(line: 17, column: 1, scope: !21)
+!25 = !{i32 2, !"debugger-tuning", !"sce"}
diff --git a/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir b/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
index e5ec0a2522fa62..05c8e83f338132 100644
--- a/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
+++ b/llvm/test/DebugInfo/MIR/X86/call-site-gnu-vs-dwarf5-attrs.mir
@@ -1,49 +1,53 @@
 ## Test the call site encoding in DWARF5 vs GNU extensions.
 
+# RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s > %t.gdb.mir
+# RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s > %t.lldb.mir
+# RUN: sed 's/TUNE_PLACEHOLDER/sce/' %s > %t.sce.mir
+
 ## === DWARF4, tune for gdb ===
-# RUN: llc -emit-call-site-info -dwarf-version 4 -debugger-tune=gdb -filetype=obj \
-# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s  \
+# RUN: llc -emit-call-site-info -dwarf-version 4 -filetype=obj \
+# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %t.gdb.mir  \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU -implicit-check-not=DW_AT_call
 
 # === DWARF5, tune for gdb ===
-# RUN: llc -dwarf-version 5 -debugger-tune=gdb -emit-call-site-info -filetype=obj \
-# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s  \
+# RUN: llc -dwarf-version 5 -emit-call-site-info -filetype=obj \
+# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %t.gdb.mir  \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
 
 ## === DWARF4, tune for lldb ===
-# RUN: llc -dwarf-version 4 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
-# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s   \
+# RUN: llc -dwarf-version 4 -emit-call-site-info -filetype=obj \
+# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %t.lldb.mir   \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
 
 ## === DWARF5, tune for lldb ===
-# RUN: llc -dwarf-version 5 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
-# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s   \
+# RUN: llc -dwarf-version 5 -emit-call-site-info -filetype=obj \
+# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %t.lldb.mir   \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5 -implicit-check-not=DW_AT_call
 
 ## === DWARF4, tune for sce ===
-# RUN: llc -emit-call-site-info -dwarf-version 4 -filetype=obj -debugger-tune=sce \
+# RUN: llc -emit-call-site-info -dwarf-version 4 -filetype=obj \
 # RUN:     -debug-entry-values -mtriple=x86_64-unknown-unknown \
-# RUN:     -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
+# RUN:     -start-after=machineverifier -o - %t.sce.mir | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
 
 ## === DWARF5, tune for sce ===
-# RUN: llc -emit-call-site-info -dwarf-version 5 -filetype=obj -debugger-tune=sce \
+# RUN: llc -emit-call-site-info -dwarf-version 5 -filetype=obj \
 # RUN:     -debug-entry-values -mtriple=x86_64-unknown-unknown \
-# RUN:     -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
+# RUN:     -start-after=machineverifier -o - %t.sce.mir | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
 
 ## === DWARF3, tune for gdb ===
-# RUN: llc -emit-call-site-info -dwarf-version 3 -debugger-tune=gdb -filetype=obj \
-# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s  \
+# RUN: llc -emit-call-site-info -dwarf-version 3 -filetype=obj \
+# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %t.gdb.mir  \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call
 
 ## === DWARF3, tune for lldb ===
-# RUN: llc -dwarf-version 3 -debugger-tune=lldb -emit-call-site-info -filetype=obj \
-# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s   \
+# RUN: llc -dwarf-version 3 -emit-call-site-info -filetype=obj \
+# RUN:     -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %t.lldb.mir   \
 # RUN:     | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_GNU_call
 
 ## === DWARF3, tune for sce ===
-# RUN: llc -emit-call-site-info -dwarf-version 3 -filetype=obj -debugger-tune=sce \
+# RUN: llc -emit-call-site-info -dwarf-version 3 -filetype=obj \
 # RUN:     -debug-entry-values -mtriple=x86_64-unknown-unknown \
-# RUN:     -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call
+# RUN:     -start-after=machineverifier -o - %t.sce.mir | llvm-dwarfdump - | FileCheck %s -implicit-check-not=DW_AT_call
 
 ## This is based on the following reproducer:
 ##
@@ -131,7 +135,7 @@
   declare void @llvm.dbg.value(metadata, metadata, metadata)
   
   !llvm.dbg.cu = !{!0}
-  !llvm.module.flags = !{!14, !15, !16}
+  !llvm.module.flags = !{!14, !15, !16, !100}
   !llvm.ident = !{!17}
   
   !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !3, splitDebugInlining: false, nameTableKind: None)
@@ -151,6 +155,7 @@
   !14 = !{i32 7, !"Dwarf Version", i32 4}
   !15 = !{i32 2, !"Debug Info Version", i32 3}
   !16 = !{i32 1, !"wchar_size", i32 4}
+  !100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
   !17 = !{!"clang version 11.0.0"}
   !18 = distinct !DISubprogram(name: "fn1", scope: !1, file: !1, line: 5, type: !19, scopeLine: 5, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !22)
   !19 = !DISubroutineType(types: !20)
diff --git a/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir b/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
index 94fc87085be666..ec622668ce656f 100644
--- a/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
+++ b/llvm/test/DebugInfo/MIR/X86/debug-call-site-param.mir
@@ -2,8 +2,9 @@
 # When the debugger tuning is set to gdb, use GNU opcodes.
 # For lldb, use the standard DWARF5 opcodes.
 
-# RUN: llc -emit-call-site-info -debugger-tune=gdb -filetype=obj -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
-# RUN: llc -emit-call-site-info -debugger-tune=lldb -filetype=obj -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
+# RUN: llc -emit-call-site-info -filetype=obj -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - %s | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-GNU
+# RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s | \
+# RUN:   llc -x mir -emit-call-site-info -filetype=obj -mtriple=x86_64-unknown-unknown -start-after=machineverifier -o - | llvm-dwarfdump - | FileCheck %s -check-prefixes=CHECK-DWARF5
 #
 # extern void foo(int *a, int b, int c, int d, int e, int f);
 # extern int getVal();
@@ -102,7 +103,7 @@
   declare void @llvm.dbg.value(metadata, metadata, metadata)
   
   !llvm.dbg.cu = !{!0}
-  !llvm.module.flags = !{!6, !7, !8}
+  !llvm.module.flags = !{!6, !7, !8, !25}
   !llvm.ident = !{!9}
   
   !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
@@ -114,6 +115,7 @@
   !7 = !{i32 2, !"Debug Info Version", i32 3}
   !8 = !{i32 1, !"wchar_size", i32 4}
   !9 = !{!"clang version 9.0.0"}
+  !25 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
   !10 = distinct !DISubprogram(name: "baa", scope: !1, file: !1, line: 4, type: !11, scopeLine: 4, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
   !11 = !DISubroutineType(types: !12)
   !12 = !{null, !13, !13, !13}
diff --git a/llvm/test/DebugInfo/MIR/X86/debug-entry-value-operation.mir b/llvm/test/DebugInfo/MIR/X86/debug-entry-value-operation.mir
index 80864cb9bd4236..af95bb2207574c 100644
--- a/llvm/test/DebugInfo/MIR/X86/debug-entry-value-operation.mir
+++ b/llvm/test/DebugInfo/MIR/X86/debug-entry-value-operation.mir
@@ -4,10 +4,11 @@
 # RUN: llc -force-instr-ref-livedebugvalues=1 -start-before=live-debug-values -mtriple=x86_64-apple-darwin -o %t %s -filetype=obj
 # RUN: llvm-dwarfdump %t | FileCheck %s
 
-# RUN: llc -start-before=live-debug-values -debugger-tune=sce -mtriple=x86_64-sce-ps4 -o %t1 %s -filetype=obj
+# RUN: sed 's/TUNE_PLACEHOLDER/sce/' %s > %t.sce.mir
+# RUN: llc -start-before=live-debug-values -mtriple=x86_64-sce-ps4 -o %t1 %t.sce.mir -filetype=obj
 # RUN: llvm-dwarfdump %t1 | FileCheck %s -check-prefix=SCE
 
-# RUN: llc -force-instr-ref-livedebugvalues=1 -start-before=live-debug-values -debugger-tune=sce -mtriple=x86_64-sce-ps4 -o %t1 %s -filetype=obj
+# RUN: llc -force-instr-ref-livedebugvalues=1 -start-before=live-debug-values -mtriple=x86_64-sce-ps4 -o %t1 %t.sce.mir -filetype=obj
 # RUN: llvm-dwarfdump %t1 | FileCheck %s -check-prefix=SCE
 
 ## Based on:
@@ -45,7 +46,7 @@
   declare void @llvm.dbg.value(metadata, metadata, metadata)
 
   !llvm.dbg.cu = !{!2}
-  !llvm.module.flags = !{!7, !8, !9}
+  !llvm.module.flags = !{!7, !8, !9, !20}
   !llvm.ident = !{!10}
 
   !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -58,6 +59,7 @@
   !7 = !{i32 2, !"Dwarf Version", i32 4}
   !8 = !{i32 2, !"Debug Info Version", i32 3}
   !9 = !{i32 1, !"wchar_size", i32 4}
+  !20 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
   !10 = !{!"clang version 9.0.0 "}
   !11 = distinct !DISubprogram(name: "foo", scope: !3, file: !3, line: 9, type: !12, scopeLine: 9, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !14)
   !12 = !DISubroutineType(types: !13)
diff --git a/llvm/test/DebugInfo/PowerPC/debugger-tune.ll b/llvm/test/DebugInfo/PowerPC/debugger-tune.ll
index 2d5e7d6a391e62..003526f9e47fea 100644
--- a/llvm/test/DebugInfo/PowerPC/debugger-tune.ll
+++ b/llvm/test/DebugInfo/PowerPC/debugger-tune.ll
@@ -7,9 +7,11 @@
 ; TODO: Use -filetype-obj and llvm-dwarfdump when the obj mode is supported.
 ; RUN: llc -mtriple=powerpc64-ibm-aix-xcoff < %s | FileCheck --check-prefix=DBX --implicit-check-not DW_FROM_strp %s
 
-; We can override defaults.
-; RUN: llc -mtriple=powerpc64le-unknown-linux -filetype=obj -debugger-tune=dbx < %s | llvm-dwarfdump -debug-info --show-form - | FileCheck --check-prefix=DBX %s --implicit-check-not DW_FROM_strp
-; RUN: llc -mtriple=powerpc64-ibm-aix-xcoff -debugger-tune=gdb < %s | FileCheck --check-prefix=GDB %s --implicit-check-not DW_FORM_string
+; We can override defaults via the "debugger-tuning" module flag.
+; RUN: sed 's/TUNE_PLACEHOLDER/dbx/' %s \
+; RUN:   | llc -mtriple=powerpc64le-unknown-linux -filetype=obj | llvm-dwarfdump -debug-info --show-form - | FileCheck --check-prefix=DBX %s --implicit-check-not DW_FROM_strp
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s \
+; RUN:   | llc -mtriple=powerpc64-ibm-aix-xcoff | FileCheck --check-prefix=GDB %s --implicit-check-not DW_FORM_string
 
 ; GDB: DW_FORM_strp
 ; DBX: DW_FORM_string
@@ -23,7 +25,7 @@ entry:
 }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.module.flags = !{!3, !4, !5, !6, !100}
 !llvm.ident = !{!7}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
@@ -33,6 +35,7 @@ entry:
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 2}
 !6 = !{i32 7, !"PIC Level", i32 2}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !7 = !{!"clang version 12.0.0"}
 !8 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
 !9 = !DISubroutineType(types: !10)
diff --git a/llvm/test/DebugInfo/X86/2010-04-13-PubType.ll b/llvm/test/DebugInfo/X86/2010-04-13-PubType.ll
index 53cd629373f63f..131c5fe6519b42 100644
--- a/llvm/test/DebugInfo/X86/2010-04-13-PubType.ll
+++ b/llvm/test/DebugInfo/X86/2010-04-13-PubType.ll
@@ -1,4 +1,4 @@
-; RUN: llc -O0 -asm-verbose -mtriple=x86_64-macosx -debugger-tune=gdb < %s | FileCheck %s
+; RUN: llc -O0 -asm-verbose -mtriple=x86_64-macosx < %s | FileCheck %s
 ; CHECK-NOT: .asciz "X" ## External Name
 ; CHECK: .asciz "Y" ## External Name
 ; Test to check type with no definition is listed in pubtypes section.
@@ -29,7 +29,7 @@ return:                                           ; preds = %entry
 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 
 !llvm.dbg.cu = !{!3}
-!llvm.module.flags = !{!20}
+!llvm.module.flags = !{!20, !100}
 
 !0 = !DILocalVariable(name: "x", line: 7, arg: 1, scope: !1, file: !2, type: !7)
 !1 = distinct !DISubprogram(name: "foo", linkageName: "foo", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: false, unit: !3, scopeLine: 7, file: !18, scope: !2, type: !4)
@@ -51,3 +51,4 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone
 !18 = !DIFile(filename: "a.c", directory: "/tmp/")
 !19 = !{}
 !20 = !{i32 1, !"Debug Info Version", i32 3}
+!100 = !{i32 2, !"debugger-tuning", !"gdb"}
diff --git a/llvm/test/DebugInfo/X86/DW_AT_object_pointer-non-standard-index.ll b/llvm/test/DebugInfo/X86/DW_AT_object_pointer-non-standard-index.ll
index 40b791fd27e326..f556276f6ec164 100644
--- a/llvm/test/DebugInfo/X86/DW_AT_object_pointer-non-standard-index.ll
+++ b/llvm/test/DebugInfo/X86/DW_AT_object_pointer-non-standard-index.ll
@@ -3,7 +3,7 @@
 ; of the subprogram (which isn't something the major compilers do,
 ; but is not mandated by DWARF).
 
-; RUN: llc -mtriple=x86_64-apple-darwin -debugger-tune=lldb -dwarf-version=5 -filetype=obj < %s | \
+; RUN: llc -mtriple=x86_64-apple-darwin -dwarf-version=5 -filetype=obj < %s | \
 ; RUN:      llvm-dwarfdump -v -debug-info - | FileCheck %s --check-prefixes=CHECK
 
 ; CHECK: DW_TAG_class_type
diff --git a/llvm/test/DebugInfo/X86/DW_AT_object_pointer.ll b/llvm/test/DebugInfo/X86/DW_AT_object_pointer.ll
index 596727dce04339..2a7c4941ee1928 100644
--- a/llvm/test/DebugInfo/X86/DW_AT_object_pointer.ll
+++ b/llvm/test/DebugInfo/X86/DW_AT_object_pointer.ll
@@ -1,10 +1,11 @@
-; RUN: llc -mtriple=x86_64-apple-darwin -debugger-tune=gdb -dwarf-version=5 -filetype=obj < %s | \
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s | \
+; RUN:   llc -mtriple=x86_64-apple-darwin -dwarf-version=5 -filetype=obj | \
 ; RUN:      llvm-dwarfdump -v -debug-info - | FileCheck %s --check-prefixes=CHECK,CHECK-GDB
 
-; RUN: llc -mtriple=x86_64-apple-darwin -debugger-tune=lldb -dwarf-version=4 -filetype=obj < %s | \
+; RUN: llc -mtriple=x86_64-apple-darwin -dwarf-version=4 -filetype=obj < %s | \
 ; RUN:      llvm-dwarfdump -v -debug-info - | FileCheck %s --check-prefixes=CHECK,CHECK-LLDB-DWARF4
 
-; RUN: llc -mtriple=x86_64-apple-darwin -debugger-tune=lldb -dwarf-version=5 -filetype=obj < %s | \
+; RUN: llc -mtriple=x86_64-apple-darwin -dwarf-version=5 -filetype=obj < %s | \
 ; RUN:      llvm-dwarfdump -v -debug-info - | FileCheck %s --check-prefixes=CHECK,CHECK-LLDB-DWARF5
 
 ; CHECK: DW_TAG_formal_parameter [
@@ -63,7 +64,7 @@ entry:
 }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!38}
+!llvm.module.flags = !{!38, !100}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.2 (trunk 163586) (llvm/trunk 163570)", isOptimized: false, emissionKind: FullDebug, file: !37, enums: !1, retainedTypes: !1, globals: !1, imports:  !1)
 !1 = !{}
@@ -99,3 +100,4 @@ entry:
 !36 = !DILocalVariable(name: "", line: 7, arg: 1, scope: !5, file: !6, type: !9)
 !37 = !DIFile(filename: "bar.cpp", directory: "/Users/echristo/debug-tests")
 !38 = !{i32 1, !"Debug Info Version", i32 3}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
diff --git a/llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll b/llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll
index 243dea608a2d7f..907c2950435c10 100644
--- a/llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll
+++ b/llvm/test/DebugInfo/X86/accel-tables-dwarf5.ll
@@ -3,17 +3,17 @@
 ; debug_names should be emitted regardless of the target and debugger tuning
 ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=DEBUG_NAMES %s
-; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=gdb < %s \
+; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=DEBUG_NAMES %s
 ; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=DEBUG_NAMES %s
-; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s \
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=DEBUG_NAMES %s
 
 ; But not if also type units are enabled.
 ; TODO: This is the case because we currently don't generate DWARF v5-compatible
 ; type units. Change this once DWARF v5 type units are implemented.
-; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -generate-type-units -debugger-tune=lldb < %s \
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -generate-type-units < %s \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=NONE %s
 
 ; Debug types are ignored for non-ELF targets which means it shouldn't affect
diff --git a/llvm/test/DebugInfo/X86/accel-tables.ll b/llvm/test/DebugInfo/X86/accel-tables.ll
index b49887cbc9d056..cb3755ac581bd5 100644
--- a/llvm/test/DebugInfo/X86/accel-tables.ll
+++ b/llvm/test/DebugInfo/X86/accel-tables.ll
@@ -1,20 +1,23 @@
 ; Verify the emission of accelerator tables for various targets for the DWARF<=4 case
 
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s > %t.gdb.ll
+; RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s > %t.lldb.ll
+
 ; Darwin has the apple tables unless we specifically tune for gdb
 ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=APPLE %s
-; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=gdb < %s \
+; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %t.gdb.ll \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=PUB %s
 
 ; Linux does has debug_names tables only if we explicitly tune for lldb
 ; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=PUB %s
-; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s \
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %t.lldb.ll \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=DEBUG_NAMES %s
 
 ; No accelerator tables if type units are enabled, as DWARF v4 type units are
 ; not compatible with accelerator tables.
-; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -generate-type-units -debugger-tune=lldb < %s \
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -generate-type-units < %t.lldb.ll \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=NONE %s
 
 ; Debug types are ignored for non-ELF targets which means it shouldn't affect
@@ -59,7 +62,7 @@ attributes #0 = { norecurse nounwind readnone uwtable }
 attributes #1 = { norecurse uwtable }
 
 !llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!7, !8, !9}
+!llvm.module.flags = !{!7, !8, !9, !100}
 !llvm.ident = !{!10}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -72,6 +75,7 @@ attributes #1 = { norecurse uwtable }
 !7 = !{i32 2, !"Dwarf Version", i32 4}
 !8 = !{i32 2, !"Debug Info Version", i32 3}
 !9 = !{i32 1, !"wchar_size", i32 4}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !10 = !{!"clang version 7.0.0 (trunk 322268) (llvm/trunk 322267)"}
 !11 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 2, type: !12, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !4)
 !12 = !DISubroutineType(types: !13)
diff --git a/llvm/test/DebugInfo/X86/bitfields-dwarf4.ll b/llvm/test/DebugInfo/X86/bitfields-dwarf4.ll
index e137b1c766f950..a35904891e9011 100644
--- a/llvm/test/DebugInfo/X86/bitfields-dwarf4.ll
+++ b/llvm/test/DebugInfo/X86/bitfields-dwarf4.ll
@@ -2,7 +2,7 @@
 ; RUN: | llvm-dwarfdump -v -debug-info - | FileCheck %s
 ; RUN: llc -mtriple x86_64-gnu-linux -O0 -filetype=obj -o - %s \
 ; RUN: | llvm-dwarfdump -v -debug-info - | FileCheck %s
-; RUN: llc -mtriple x86_64-gnu-linux -O0 -debugger-tune=gdb -filetype=obj -o - %s \
+; RUN: llc -mtriple x86_64-gnu-linux -O0 -filetype=obj -o - %s \
 ; RUN: | llvm-dwarfdump -v -debug-info - | FileCheck %s
 ;
 ; Generated from:
diff --git a/llvm/test/DebugInfo/X86/c-type-units.ll b/llvm/test/DebugInfo/X86/c-type-units.ll
index 889bd79d27dec1..41e840369c691b 100644
--- a/llvm/test/DebugInfo/X86/c-type-units.ll
+++ b/llvm/test/DebugInfo/X86/c-type-units.ll
@@ -1,5 +1,5 @@
 
-; RUN: llc -o - %s -filetype=obj -O0 -debugger-tune=lldb -generate-type-units -mtriple=x86_64-unknown-linux-gnu | llvm-dwarfdump -debug-types - | FileCheck %s
+; RUN: llc -o - %s -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu | llvm-dwarfdump -debug-types - | FileCheck %s
 
 ; struct foo {
 ; } f;
diff --git a/llvm/test/DebugInfo/X86/constant-loclist.ll b/llvm/test/DebugInfo/X86/constant-loclist.ll
index 702f25ab2b71dc..d999a96abf0478 100644
--- a/llvm/test/DebugInfo/X86/constant-loclist.ll
+++ b/llvm/test/DebugInfo/X86/constant-loclist.ll
@@ -1,6 +1,6 @@
 ; RUN: llc -filetype=obj %s -o - -experimental-debug-variable-locations=true | llvm-dwarfdump -v -debug-info - | FileCheck %s
 ; RUN: llc -filetype=obj %s -o - -experimental-debug-variable-locations=true -mtriple=i386-unknown-linux-gnu -dwarf-version=4 | llvm-dwarfdump -v -debug-info - | FileCheck %s --check-prefix=I386
-; RUN: llc -filetype=obj %s -o - -experimental-debug-variable-locations=true -mtriple=i386-unknown-linux-gnu -dwarf-version=2 -debugger-tune=sce | llvm-dwarfdump -v -debug-info - | FileCheck %s --check-prefix=I386-COMPAT
+; RUN: llc -filetype=obj %s -o - -experimental-debug-variable-locations=true -mtriple=i386-unknown-linux-gnu -dwarf-version=2 | llvm-dwarfdump -v -debug-info - | FileCheck %s --check-prefix=I386-COMPAT
 
 ; A hand-written testcase to check 64-bit constant handling in location lists.
 
diff --git a/llvm/test/DebugInfo/X86/convert-debugloc.ll b/llvm/test/DebugInfo/X86/convert-debugloc.ll
index 73072eda010430..ba276d10057caf 100644
--- a/llvm/test/DebugInfo/X86/convert-debugloc.ll
+++ b/llvm/test/DebugInfo/X86/convert-debugloc.ll
@@ -1,29 +1,31 @@
 ; RUN: llc -mtriple=x86_64 -dwarf-version=4 -filetype=obj -O0 < %s | llvm-dwarfdump - \
 ; RUN:   | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
 
+; RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s > %t.lldb.ll
+
 ; Test lldb default: OP_convert is unsupported when using MachO
-; RUN: llc -mtriple=x86_64-apple-darwin -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb | llvm-dwarfdump - \
+; RUN: llc -mtriple=x86_64-apple-darwin -dwarf-version=5 -filetype=obj -O0 < %s | llvm-dwarfdump - \
 ; RUN:   | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
-; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb | llvm-dwarfdump - \
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %t.lldb.ll | llvm-dwarfdump - \
 ; RUN:   | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
 
 ; Test gdb default: OP_convert is only disabled in split DWARF
-; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb  | llvm-dwarfdump - \
+; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s  | llvm-dwarfdump - \
 ; RUN:   | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
-; RUN: llc -mtriple=x86_64-pc-linux-gnu  -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb   -split-dwarf-file=baz.dwo | llvm-dwarfdump - \
+; RUN: llc -mtriple=x86_64-pc-linux-gnu  -dwarf-version=5 -filetype=obj -O0 < %s   -split-dwarf-file=baz.dwo | llvm-dwarfdump - \
 ; RUN:   | FileCheck %s --check-prefix=NOCONV --check-prefix=SPLIT "--implicit-check-not={{DW_TAG|NULL}}"
 
 ; Test the ability to override the platform default in either direction
-; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb  -dwarf-op-convert=Disable | llvm-dwarfdump - \
+; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s  -dwarf-op-convert=Disable | llvm-dwarfdump - \
 ; RUN:   | FileCheck %s --check-prefix=NOCONV "--implicit-check-not={{DW_TAG|NULL}}"
-; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable | llvm-dwarfdump - \
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %t.lldb.ll -dwarf-op-convert=Enable | llvm-dwarfdump - \
 ; RUN:   | FileCheck %s --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
 
 ; Test DW_OP_convert + Split DWARF
-; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=lldb -dwarf-op-convert=Enable -split-dwarf-file=baz.dwo | llvm-dwarfdump - \
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -dwarf-version=5 -filetype=obj -O0 < %t.lldb.ll -dwarf-op-convert=Enable -split-dwarf-file=baz.dwo | llvm-dwarfdump - \
 ; RUN:   | FileCheck %s --check-prefix=CONV --check-prefix=SPLITCONV --check-prefix=SPLIT "--implicit-check-not={{DW_TAG|NULL}}"
 
-; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s -debugger-tune=gdb  | llvm-dwarfdump -v -debug-info - \
+; RUN: llc -mtriple=x86_64 -dwarf-version=5 -filetype=obj -O0 < %s  | llvm-dwarfdump -v -debug-info - \
 ; RUN:   | FileCheck %s --check-prefix=VERBOSE --check-prefix=CONV "--implicit-check-not={{DW_TAG|NULL}}"
 
 
@@ -105,7 +107,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
 declare void @llvm.dbg.value(metadata, metadata, metadata)
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5}
+!llvm.module.flags = !{!3, !4, !5, !100}
 !llvm.ident = !{!6}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0 (trunk 353791) (llvm/trunk 353801)", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
@@ -114,6 +116,7 @@ declare void @llvm.dbg.value(metadata, metadata, metadata)
 !3 = !{i32 2, !"Dwarf Version", i32 5}
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 4}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !6 = !{!"clang version 9.0.0 (trunk 353791) (llvm/trunk 353801)"}
 !7 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !8, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
 !8 = !DISubroutineType(types: !9)
diff --git a/llvm/test/DebugInfo/X86/debug-aranges-sce-tuning.test b/llvm/test/DebugInfo/X86/debug-aranges-sce-tuning.test
index 5729155c937e75..3c1fc474041b19 100644
--- a/llvm/test/DebugInfo/X86/debug-aranges-sce-tuning.test
+++ b/llvm/test/DebugInfo/X86/debug-aranges-sce-tuning.test
@@ -2,7 +2,7 @@
 # tuning.
 
 RUN: rm -rf %t && split-file %s %t && cd %t
-RUN: llc -debugger-tune=sce -filetype=obj foo.ll -o foo.o
+RUN: llc -filetype=obj foo.ll -o foo.o
 RUN: llvm-dwarfdump -debug-aranges foo.o | FileCheck %s
 
 CHECK:      .debug_aranges contents:
@@ -24,7 +24,7 @@ target triple = "x86_64-unknown-linux-gnu"
 @foo = dso_local global i32 0, align 4, !dbg !0
 
 !llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!6, !7, !8, !9, !10, !11, !12}
+!llvm.module.flags = !{!6, !7, !8, !9, !10, !11, !12, !13}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
 !1 = distinct !DIGlobalVariable(name: "foo", scope: !2, file: !3, line: 1, type: !5, isLocal: false, isDefinition: true)
@@ -39,3 +39,4 @@ target triple = "x86_64-unknown-linux-gnu"
 !10 = !{i32 7, !"PIE Level", i32 2}
 !11 = !{i32 7, !"uwtable", i32 2}
 !12 = !{i32 7, !"frame-pointer", i32 2}
+!13 = !{i32 2, !"debugger-tuning", !"sce"}
diff --git a/llvm/test/DebugInfo/X86/debugger-tune.ll b/llvm/test/DebugInfo/X86/debugger-tune.ll
index 4c158b1d9d1263..4134492f59924b 100644
--- a/llvm/test/DebugInfo/X86/debugger-tune.ll
+++ b/llvm/test/DebugInfo/X86/debugger-tune.ll
@@ -10,10 +10,17 @@
 ; RUN: llc -mtriple=x86_64-pc-freebsd -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=GDB %s
 ; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=GDB %s
 
-; We can override defaults.
-; RUN: llc -mtriple=x86_64-scei-ps4 -filetype=obj -debugger-tune=gdb < %s | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=GDB %s
-; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=LLDB %s
-; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=sce < %s | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=SCE %s
+; We can override defaults via the "debugger-tuning" module flag.
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s \
+; RUN:   | llc -mtriple=x86_64-scei-ps4 -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=GDB %s
+; RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s \
+; RUN:   | llc -mtriple=x86_64-pc-linux -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=LLDB %s
+; RUN: sed 's/TUNE_PLACEHOLDER/sce/' %s \
+; RUN:   | llc -mtriple=x86_64-apple-darwin12 -filetype=obj | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=SCE %s
+
+; An unrecognized tuning name (the unsubstituted placeholder) falls back to
+; the triple default rather than erroring.
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s | llvm-dwarfdump -debug-info - | FileCheck --check-prefix=GDB %s
 
 ; GDB: DW_AT_APPLE_optimized
 ; GDB-NOT: DW_OP_form_tls_address
@@ -40,7 +47,7 @@ attributes #0 = { norecurse nounwind readnone uwtable }
 attributes #1 = { norecurse uwtable }
 
 !llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!7, !8, !9}
+!llvm.module.flags = !{!7, !8, !9, !100}
 !llvm.ident = !{!10}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -53,6 +60,7 @@ attributes #1 = { norecurse uwtable }
 !7 = !{i32 2, !"Dwarf Version", i32 4}
 !8 = !{i32 2, !"Debug Info Version", i32 3}
 !9 = !{i32 1, !"wchar_size", i32 4}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !10 = !{!"clang version 7.0.0 (trunk 322268) (llvm/trunk 322267)"}
 !11 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 2, type: !12, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !4)
 !12 = !DISubroutineType(types: !13)
diff --git a/llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs-indirect.ll b/llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs-indirect.ll
index 70f91c66d4e588..e11c0598ab713d 100644
--- a/llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs-indirect.ll
+++ b/llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs-indirect.ll
@@ -2,7 +2,7 @@
 ; __attribute__((disable_tail_calls)) void call_reg(void (*f)()) { f(); }
 ; __attribute__((disable_tail_calls)) void call_mem(void (**f)()) { (*f)(); }
 
-; RUN: llc -mtriple=x86_64 -debugger-tune=lldb < %s -filetype=obj -o %t.o
+; RUN: llc -mtriple=x86_64 < %s -filetype=obj -o %t.o
 ; RUN: llvm-dwarfdump %t.o -o - | FileCheck %s -check-prefix=OBJ -implicit-check-not=DW_TAG_call_site -implicit-check-not=DW_AT_call_target
 ; RUN: llvm-dwarfdump -verify %t.o 2>&1 | FileCheck %s -check-prefix=VERIFY
 ; RUN: llvm-dwarfdump -statistics %t.o | FileCheck %s -check-prefix=STATS
diff --git a/llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs.ll b/llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs.ll
index 8ed247d436d8d7..14f7cdcb4f605a 100644
--- a/llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs.ll
+++ b/llvm/test/DebugInfo/X86/dwarf-callsite-related-attrs.ll
@@ -13,7 +13,7 @@
 ; UNSUPPORTED: target={{.*-(cygwin|windows-gnu|windows-msvc)}}
 
 ; RUN: llc -mtriple=x86_64 < %s -o - | FileCheck %s -check-prefix=ASM
-; RUN: llc -mtriple=x86_64 -debugger-tune=lldb < %s -filetype=obj -o %t.o
+; RUN: llc -mtriple=x86_64 < %s -filetype=obj -o %t.o
 ; RUN: llvm-dwarfdump %t.o -o - | FileCheck %s -check-prefix=OBJ -implicit-check-not=DW_TAG_call -implicit-check-not=DW_AT_call
 ; RUN: llvm-dwarfdump -verify %t.o 2>&1 | FileCheck %s -check-prefix=VERIFY
 ; RUN: llvm-dwarfdump -statistics %t.o | FileCheck %s -check-prefix=STATS
diff --git a/llvm/test/DebugInfo/X86/dwarf-gnu-call-target-clobbered.mir b/llvm/test/DebugInfo/X86/dwarf-gnu-call-target-clobbered.mir
index 2dfd1efdf196bd..6730a6b68a52ee 100644
--- a/llvm/test/DebugInfo/X86/dwarf-gnu-call-target-clobbered.mir
+++ b/llvm/test/DebugInfo/X86/dwarf-gnu-call-target-clobbered.mir
@@ -1,4 +1,4 @@
-# RUN: llc %s -start-after=live-debug-values -debugger-tune=gdb --filetype=obj -o - \
+# RUN: llc %s -start-after=live-debug-values --filetype=obj -o - \
 # RUN: | llvm-dwarfdump - | FileCheck %s
 
 # Generated from IR crash reproducer with `llc -stop-after=live-debug-values -simplify-mir`.
@@ -18,7 +18,7 @@
   }
 
   !llvm.dbg.cu = !{!0}
-  !llvm.module.flags = !{!3, !4}
+  !llvm.module.flags = !{!3, !4, !8}
 
   !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2, globals: !2, imports: !2, splitDebugInlining: false)
   !1 = !DIFile(filename: "test.cpp", directory: ".")
@@ -28,6 +28,7 @@
   !5 = distinct !DISubprogram(name: "foo", linkageName: "foo", scope: !1, file: !1, line: 479, type: !6, scopeLine: 479, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2, keyInstructions: true)
   !6 = distinct !DISubroutineType(types: !7)
   !7 = !{null}
+  !8 = !{i32 2, !"debugger-tuning", !"gdb"}
 ...
 ---
 name:            foo
diff --git a/llvm/test/DebugInfo/X86/dwarf-linkage-names.ll b/llvm/test/DebugInfo/X86/dwarf-linkage-names.ll
index 3afe1c66dbe655..b6198f443b021d 100644
--- a/llvm/test/DebugInfo/X86/dwarf-linkage-names.ll
+++ b/llvm/test/DebugInfo/X86/dwarf-linkage-names.ll
@@ -4,7 +4,7 @@
 ; RUN: llc -O0 -mtriple=x86_64-unknown-unknown < %s | FileCheck %s -check-prefix LINKAGE1
 ; RUN: llc -O0 -mtriple=x86_64-unknown-unknown < %s | FileCheck %s -check-prefix LINKAGE2
 ; RUN: llc -O0 -mtriple=x86_64-scei-ps4 < %s | FileCheck %s -check-prefix NOLINKAGE
-; RUN: llc -O0 -mtriple=x86_64-unknown-unknown -debugger-tune=sce < %s | FileCheck %s -check-prefix NOLINKAGE
+; RUN: sed 's/TUNE_PLACEHOLDER/sce/' %s | llc -O0 -mtriple=x86_64-unknown-unknown | FileCheck %s -check-prefix NOLINKAGE
 
 ; $ clang++ -emit-llvm -S -g dwarf-linkage-names.cpp
 ; namespace test {
@@ -52,7 +52,7 @@ entry:
 attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="all" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+sse,+sse2" "use-soft-float"="false" }
 
 !llvm.dbg.cu = !{!5}
-!llvm.module.flags = !{!8, !9}
+!llvm.module.flags = !{!8, !9, !100}
 !llvm.ident = !{!10}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -65,6 +65,7 @@ attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fp
 !7 = !{!0}
 !8 = !{i32 2, !"Dwarf Version", i32 4}
 !9 = !{i32 2, !"Debug Info Version", i32 3}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !10 = !{!"clang version 3.8.0 (trunk 244662)"}
 !11 = distinct !DISubprogram(name: "bar", linkageName: "_ZN4test3barEv", scope: !2, file: !3, line: 3, type: !12, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: false, unit: !5, retainedNodes: !6)
 !12 = !DISubroutineType(types: !13)
diff --git a/llvm/test/DebugInfo/X86/gnu-names.ll b/llvm/test/DebugInfo/X86/gnu-names.ll
index fe535e662dc048..05f7431e3ac1ad 100644
--- a/llvm/test/DebugInfo/X86/gnu-names.ll
+++ b/llvm/test/DebugInfo/X86/gnu-names.ll
@@ -1,21 +1,24 @@
 ; Verify the emission of accelerator tables for various targets for the DWARF<=4 case
 
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s > %t.gdb.ll
+; RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s > %t.lldb.ll
+
 ; Darwin has the apple tables unless we specifically tune for gdb
 ; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %s > %t
 ; RUN: llvm-readobj --sections %t | FileCheck --check-prefix=APPLE %s
 ; RUN: llvm-dwarfdump -apple-names %t | FileCheck --check-prefix=APPLE-NAMES %s
-; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj -debugger-tune=gdb < %s \
+; RUN: llc -mtriple=x86_64-apple-darwin12 -filetype=obj < %t.gdb.ll \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=GNU %s
 
 ; Linux does has debug_names tables only if we explicitly tune for lldb
 ; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %s \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=GNU %s
-; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -debugger-tune=lldb < %s \
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj < %t.lldb.ll \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=GNU %s
 
 ; No accelerator tables if type units are enabled, as DWARF v4 type units are
 ; not compatible with accelerator tables.
-; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -generate-type-units -debugger-tune=lldb < %s \
+; RUN: llc -mtriple=x86_64-pc-linux -filetype=obj -generate-type-units < %t.lldb.ll \
 ; RUN:   | llvm-readobj --sections - | FileCheck --check-prefix=NONE %s
 
 ; Debug types are ignored for non-ELF targets which means it shouldn't affect
@@ -57,7 +60,7 @@ attributes #0 = { norecurse nounwind readnone uwtable }
 attributes #1 = { norecurse uwtable }
 
 !llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!7, !8, !9}
+!llvm.module.flags = !{!7, !8, !9, !100}
 !llvm.ident = !{!10}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -70,6 +73,7 @@ attributes #1 = { norecurse uwtable }
 !7 = !{i32 2, !"Dwarf Version", i32 4}
 !8 = !{i32 2, !"Debug Info Version", i32 3}
 !9 = !{i32 1, !"wchar_size", i32 4}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !10 = !{!"clang version 7.0.0 (trunk 322268) (llvm/trunk 322267)"}
 !11 = distinct !DISubprogram(name: "fun", linkageName: "_Z3funv", scope: !3, file: !3, line: 2, type: !12, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !4)
 !12 = !DISubroutineType(types: !13)
diff --git a/llvm/test/DebugInfo/X86/implicit_value-double.ll b/llvm/test/DebugInfo/X86/implicit_value-double.ll
index 6ce26cf59d7481..52b8bea82f7647 100644
--- a/llvm/test/DebugInfo/X86/implicit_value-double.ll
+++ b/llvm/test/DebugInfo/X86/implicit_value-double.ll
@@ -1,9 +1,12 @@
 ;; This test checks for emission of DW_OP_implicit_value operation
 ;; for double type.
 
-; RUN: llc -O0 -debugger-tune=gdb -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s --check-prefixes=CHECK,BOTH
+; RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s > %t.lldb.ll
+; RUN: sed 's/TUNE_PLACEHOLDER/sce/' %s > %t.sce.ll
 
-; RUN: llc -O0 -debugger-tune=lldb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s --check-prefixes=CHECK,BOTH
+; RUN: llc -O0 -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s --check-prefixes=CHECK,BOTH
+
+; RUN: llc -O0 -filetype=obj %t.lldb.ll -o - | llvm-dwarfdump - | FileCheck %s --check-prefixes=CHECK,BOTH
 
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_variable
@@ -11,7 +14,7 @@
 ; CHECK-NEXT:                     [{{.*}}): DW_OP_implicit_value 0x8 0x1f 0x85 0xeb 0x51 0xb8 0x1e 0x09 0x40)
 ; CHECK-NEXT:  DW_AT_name    ("d")
 
-; RUN: llc -O0 -debugger-tune=sce -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s -check-prefixes=SCE-CHECK,BOTH
+; RUN: llc -O0 -filetype=obj %t.sce.ll -o -  | llvm-dwarfdump - | FileCheck %s -check-prefixes=SCE-CHECK,BOTH
 
 ; SCE-CHECK: .debug_info contents:
 ; SCE-CHECK: DW_TAG_variable
@@ -54,7 +57,7 @@ attributes #1 = { nounwind readnone speculatable willreturn }
 attributes #2 = { nofree nounwind }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5}
+!llvm.module.flags = !{!3, !4, !5, !100}
 !llvm.ident = !{!6}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
@@ -63,6 +66,7 @@ attributes #2 = { nofree nounwind }
 !3 = !{i32 7, !"Dwarf Version", i32 4}
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 4}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !6 = !{!"clang version 11.0.0"}
 !7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
 !8 = !DISubroutineType(types: !9)
diff --git a/llvm/test/DebugInfo/X86/implicit_value-float.ll b/llvm/test/DebugInfo/X86/implicit_value-float.ll
index bf8ff0bb280ac0..c52686e6fc7540 100644
--- a/llvm/test/DebugInfo/X86/implicit_value-float.ll
+++ b/llvm/test/DebugInfo/X86/implicit_value-float.ll
@@ -1,8 +1,11 @@
 ;; This test checks for emission of DW_OP_implicit_value operation
 ;; for float type.
 
-; RUN: llc -debugger-tune=gdb -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s
-; RUN: llc -debugger-tune=lldb -filetype=obj %s -o - | llvm-dwarfdump - | FileCheck %s
+; RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s > %t.lldb.ll
+; RUN: sed 's/TUNE_PLACEHOLDER/sce/' %s > %t.sce.ll
+
+; RUN: llc -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s
+; RUN: llc -filetype=obj %t.lldb.ll -o - | llvm-dwarfdump - | FileCheck %s
 
 ; CHECK: .debug_info contents:
 ; CHECK: DW_TAG_variable
@@ -10,7 +13,7 @@
 ; CHECK-NEXT:                     [{{.*}}): DW_OP_implicit_value 0x4 0xc3 0xf5 0x48 0x40)
 ; CHECK-NEXT:  DW_AT_name    ("f")
 
-; RUN: llc -debugger-tune=sce -filetype=obj %s -o -  | llvm-dwarfdump - | FileCheck %s -check-prefix=SCE-CHECK
+; RUN: llc -filetype=obj %t.sce.ll -o -  | llvm-dwarfdump - | FileCheck %s -check-prefix=SCE-CHECK
 
 ; SCE-CHECK: .debug_info contents:
 ; SCE-CHECK: DW_TAG_variable
@@ -52,7 +55,7 @@ attributes #1 = { nounwind readnone speculatable willreturn }
 attributes #2 = { nofree nounwind }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5}
+!llvm.module.flags = !{!3, !4, !5, !100}
 !llvm.ident = !{!6}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
@@ -61,6 +64,7 @@ attributes #2 = { nofree nounwind }
 !3 = !{i32 7, !"Dwarf Version", i32 4}
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 4}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !6 = !{!"clang version 11.0.0"}
 !7 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !8, scopeLine: 1, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !11)
 !8 = !DISubroutineType(types: !9)
diff --git a/llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll b/llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll
index 4659e630024db2..168deee06a04b2 100644
--- a/llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll
+++ b/llvm/test/DebugInfo/X86/no-entry-values-with-O0.ll
@@ -1,10 +1,10 @@
-; RUN: llc -O0 -dwarf-version=5 -debugger-tune=lldb -filetype=obj < %s \
+; RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s | llc -O0 -dwarf-version=5 -filetype=obj \
 ; RUN:  | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
-; RUN: llc -O0 -dwarf-version=5 -debugger-tune=gdb -filetype=obj < %s \
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s | llc -O0 -dwarf-version=5 -filetype=obj \
 ; RUN:  | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
-; RUN: llc -force-instr-ref-livedebugvalues=1 -O0 -dwarf-version=5 -debugger-tune=lldb -filetype=obj < %s \
+; RUN: sed 's/TUNE_PLACEHOLDER/lldb/' %s | llc -force-instr-ref-livedebugvalues=1 -O0 -dwarf-version=5 -filetype=obj \
 ; RUN:  | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
-; RUN: llc -force-instr-ref-livedebugvalues=1 -O0 -dwarf-version=5 -debugger-tune=gdb -filetype=obj < %s \
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s | llc -force-instr-ref-livedebugvalues=1 -O0 -dwarf-version=5 -filetype=obj \
 ; RUN:  | llvm-dwarfdump - | FileCheck --implicit-check-not=DW_OP_entry_value %s
 
 ; The call-site-params are created iff corresponding DISubprogram contains
@@ -67,7 +67,7 @@ declare void @llvm.dbg.declare(metadata, metadata, metadata)
 declare dso_local void @fn2(i32)
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5}
+!llvm.module.flags = !{!3, !4, !5, !20}
 !llvm.ident = !{!6}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 11.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, splitDebugInlining: false, nameTableKind: None)
@@ -90,3 +90,4 @@ declare dso_local void @fn2(i32)
 !17 = !DILocation(line: 7, column: 7, scope: !18)
 !18 = distinct !DILexicalBlock(scope: !7, file: !1, line: 7, column: 7)
 !19 = !DILocalVariable(name: "a", scope: !7, file: !1, line: 11, type: !10)
+!20 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
diff --git a/llvm/test/DebugInfo/X86/no-public-sections-metadata.ll b/llvm/test/DebugInfo/X86/no-public-sections-metadata.ll
index 9eb0d61c8b2d94..21bc6f175c9922 100644
--- a/llvm/test/DebugInfo/X86/no-public-sections-metadata.ll
+++ b/llvm/test/DebugInfo/X86/no-public-sections-metadata.ll
@@ -1,4 +1,4 @@
-; RUN: llc -mtriple=x86_64-pc-linux-gnu -debugger-tune=gdb -filetype=asm < %s | FileCheck %s --check-prefix=DISABLED
+; RUN: llc -mtriple=x86_64-pc-linux-gnu -filetype=asm < %s | FileCheck %s --check-prefix=DISABLED
 
 ; DISABLED-NOT: pub{{names|types}}
 
@@ -8,7 +8,7 @@
 @b = global %struct.bar zeroinitializer, align 1, !dbg !0
 
 !llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!11, !12}
+!llvm.module.flags = !{!11, !12, !14}
 !llvm.ident = !{!13}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -25,4 +25,5 @@
 !11 = !{i32 2, !"Dwarf Version", i32 4}
 !12 = !{i32 2, !"Debug Info Version", i32 3}
 !13 = !{!"clang"}
+!14 = !{i32 2, !"debugger-tuning", !"gdb"}
 
diff --git a/llvm/test/DebugInfo/X86/packed_bitfields2.ll b/llvm/test/DebugInfo/X86/packed_bitfields2.ll
index 904187aa89a524..ead15c2e0cadca 100644
--- a/llvm/test/DebugInfo/X86/packed_bitfields2.ll
+++ b/llvm/test/DebugInfo/X86/packed_bitfields2.ll
@@ -1,4 +1,4 @@
-; RUN: llc -dwarf-version=5 -debugger-tune=lldb -mtriple x86_64-unknown-linux-gnu -O0 -filetype=obj -o %t_2_le.o %s
+; RUN: llc -dwarf-version=5 -mtriple x86_64-unknown-linux-gnu -O0 -filetype=obj -o %t_2_le.o %s
 ; RUN: llvm-dwarfdump -v -debug-info %t_2_le.o | FileCheck %s
 
 ; Produced at -O0 from:
@@ -29,7 +29,7 @@ target triple = "x86_64-pc-linux-gnu"
 @bitfield = dso_local global %struct.bitfield zeroinitializer, align 1, !dbg !0
 
 !llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!11, !12, !13, !14, !15}
+!llvm.module.flags = !{!11, !12, !13, !14, !15, !17}
 !llvm.ident = !{!16}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -49,3 +49,4 @@ target triple = "x86_64-pc-linux-gnu"
 !14 = !{i32 7, !"PIC Level", i32 2}
 !15 = !{i32 7, !"PIE Level", i32 2}
 !16 = !{!"clang version 11.0.1"}
+!17 = !{i32 2, !"debugger-tuning", !"lldb"}
diff --git a/llvm/test/DebugInfo/X86/sections_as_references.ll b/llvm/test/DebugInfo/X86/sections_as_references.ll
index e94398e51392f4..cddb2df0ff11c1 100644
--- a/llvm/test/DebugInfo/X86/sections_as_references.ll
+++ b/llvm/test/DebugInfo/X86/sections_as_references.ll
@@ -1,4 +1,4 @@
-; RUN: llc -filetype=asm -O0 -mtriple=x86_64-linux-gnu < %s -dwarf-sections-as-references=Enable -dwarf-inlined-strings=Enable -no-dwarf-ranges-section -dwarf-version 3 -debugger-tune=gdb | FileCheck %s
+; RUN: llc -filetype=asm -O0 -mtriple=x86_64-linux-gnu < %s -dwarf-sections-as-references=Enable -dwarf-inlined-strings=Enable -no-dwarf-ranges-section -dwarf-version 3 | FileCheck %s
 
 ; CHECK:      .file
 
@@ -33,7 +33,7 @@ source_filename = "test/DebugInfo/X86/sections_as_references.ll"
 @g = global %struct.foo zeroinitializer, align 1, !dbg !6
 
 !llvm.dbg.cu = !{!9, !12}
-!llvm.module.flags = !{!14, !15}
+!llvm.module.flags = !{!14, !15, !16}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
 !1 = !DIGlobalVariable(name: "f", scope: null, file: !2, line: 2, type: !3, isLocal: false, isDefinition: true)
@@ -51,4 +51,5 @@ source_filename = "test/DebugInfo/X86/sections_as_references.ll"
 !13 = !{!6}
 !14 = !{i32 2, !"Dwarf Version", i32 3}
 !15 = !{i32 1, !"Debug Info Version", i32 3}
+!16 = !{i32 2, !"debugger-tuning", !"gdb"}
 
diff --git a/llvm/test/DebugInfo/X86/set.ll b/llvm/test/DebugInfo/X86/set.ll
index 89e855ca32c42a..868e1a8fb44167 100644
--- a/llvm/test/DebugInfo/X86/set.ll
+++ b/llvm/test/DebugInfo/X86/set.ll
@@ -1,6 +1,6 @@
 ; Test set representation in DWARF debug info:
 
-; RUN: llc -debugger-tune=gdb -dwarf-version=4 -filetype=obj -o %t.o < %s
+; RUN: llc -dwarf-version=4 -filetype=obj -o %t.o < %s
 ; RUN: llvm-dwarfdump -debug-info %t.o | FileCheck %s --check-prefix=CHECK
 
 ; ModuleID = 'Main.mb'
diff --git a/llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll b/llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
index 493615977ad43e..6ac835081c370a 100644
--- a/llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
+++ b/llvm/test/DebugInfo/XCOFF/dbx-inlinedstrings.ll
@@ -1,9 +1,9 @@
-; The original purpose of this test case was to verify DBX under AIX, 
-; but XCOFF does not support object mode for now. Since the option
-; `-debugger-tune=dbx` is target-independent, set `-mtriple` to 
+; The original purpose of this test case was to verify DBX under AIX,
+; but XCOFF does not support object mode for now. Since the
+; `"debugger-tuning"` module flag is target-independent, set `-mtriple` to
 ; `powerpc-unknown-linux` for now.
 
-; RUN: llc -mtriple powerpc-unknown-linux -debugger-tune=dbx -filetype=obj < %s \
+; RUN: llc -mtriple powerpc-unknown-linux -filetype=obj < %s \
 ; RUN:   | llvm-dwarfdump -v - | FileCheck %s -implicit-check-not DW_FORM_strp
 
 ; CHECK:  DW_AT_producer [DW_FORM_string]	("clang version 12.0.0")
@@ -20,7 +20,7 @@ entry:
 }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.module.flags = !{!3, !4, !5, !6, !13}
 !llvm.ident = !{!7}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
@@ -35,4 +35,5 @@ entry:
 !9 = !DISubroutineType(types: !10)
 !10 = !{!11}
 !11 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
+!13 = !{i32 2, !"debugger-tuning", !"dbx"}
 !12 = !DILocation(line: 3, column: 3, scope: !8)
diff --git a/llvm/test/DebugInfo/XCOFF/empty.ll b/llvm/test/DebugInfo/XCOFF/empty.ll
index 24655e5837bdfd..94836c4929aaab 100644
--- a/llvm/test/DebugInfo/XCOFF/empty.ll
+++ b/llvm/test/DebugInfo/XCOFF/empty.ll
@@ -1,6 +1,7 @@
-; RUN: llc -debugger-tune=gdb -mcpu=ppc -mtriple powerpc-ibm-aix-xcoff < %s | \
+; RUN: sed 's/TUNE_PLACEHOLDER/gdb/' %s > %t.gdb.ll
+; RUN: llc -mcpu=ppc -mtriple powerpc-ibm-aix-xcoff < %t.gdb.ll | \
 ; RUN:   FileCheck %s --check-prefix=ASM32
-; RUN: llc -debugger-tune=gdb -mcpu=ppc -mtriple powerpc64-ibm-aix-xcoff < %s | \
+; RUN: llc -mcpu=ppc -mtriple powerpc64-ibm-aix-xcoff < %t.gdb.ll | \
 ; RUN:   FileCheck %s --check-prefix=ASM64
 ; RUN: llc -mtriple powerpc-ibm-aix-xcoff -mcpu=ppc -filetype=obj < %s | \
 ; RUN:   llvm-dwarfdump --all - | FileCheck %s --check-prefix=DWARF32
@@ -17,7 +18,7 @@ entry:
 }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.module.flags = !{!3, !4, !5, !6, !100}
 !llvm.ident = !{!7}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 12.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
@@ -27,6 +28,7 @@ entry:
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 2}
 !6 = !{i32 7, !"PIC Level", i32 2}
+!100 = !{i32 2, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
 !7 = !{!"clang version 12.0.0"}
 !8 = distinct !DISubprogram(name: "main", scope: !1, file: !1, line: 1, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
 !9 = !DISubroutineType(types: !10)
diff --git a/llvm/test/DebugInfo/XCOFF/explicit-section.ll b/llvm/test/DebugInfo/XCOFF/explicit-section.ll
index 3bcc0f940cc352..04b5d254d28ce2 100644
--- a/llvm/test/DebugInfo/XCOFF/explicit-section.ll
+++ b/llvm/test/DebugInfo/XCOFF/explicit-section.ll
@@ -1,5 +1,5 @@
 
-; RUN: llc -debugger-tune=gdb -mcpu=ppc -mtriple powerpc-ibm-aix-xcoff < %s | \
+; RUN: llc -mcpu=ppc -mtriple powerpc-ibm-aix-xcoff < %s | \
 ; RUN:   FileCheck %s
 
 source_filename = "2.c"
@@ -21,7 +21,7 @@ entry:
 }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.module.flags = !{!3, !4, !5, !6, !100}
 !llvm.ident = !{!7}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
@@ -31,6 +31,7 @@ entry:
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 2}
 !6 = !{i32 7, !"PIC Level", i32 2}
+!100 = !{i32 2, !"debugger-tuning", !"gdb"}
 !7 = !{!"clang version 13.0.0"}
 !8 = distinct !DISubprogram(name: "bar", scope: !9, file: !9, line: 1, type: !10, scopeLine: 1, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
 !9 = !DIFile(filename: "2.c", directory: "debug")
diff --git a/llvm/test/DebugInfo/XCOFF/function-sections.ll b/llvm/test/DebugInfo/XCOFF/function-sections.ll
index 0b7a03b447aac0..7fc360aaf1dda6 100644
--- a/llvm/test/DebugInfo/XCOFF/function-sections.ll
+++ b/llvm/test/DebugInfo/XCOFF/function-sections.ll
@@ -1,6 +1,6 @@
 
-; RUN: llc -debugger-tune=gdb -mcpu=ppc -mtriple powerpc-ibm-aix-xcoff -function-sections \
-; RUN:   < %s | FileCheck %s
+; RUN: llc -mcpu=ppc -mtriple powerpc-ibm-aix-xcoff -function-sections < %s \
+; RUN:   | FileCheck %s
 
 source_filename = "1.c"
 target datalayout = "E-m:a-p:32:32-i64:64-n32"
@@ -18,7 +18,7 @@ entry:
 }
 
 !llvm.dbg.cu = !{!0}
-!llvm.module.flags = !{!3, !4, !5, !6}
+!llvm.module.flags = !{!3, !4, !5, !6, !100}
 !llvm.ident = !{!7}
 
 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 13.0.0", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
@@ -28,6 +28,7 @@ entry:
 !4 = !{i32 2, !"Debug Info Version", i32 3}
 !5 = !{i32 1, !"wchar_size", i32 2}
 !6 = !{i32 7, !"PIC Level", i32 2}
+!100 = !{i32 2, !"debugger-tuning", !"gdb"}
 !7 = !{!"clang version 13.0.0"}
 !8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 1, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2)
 !9 = !DISubroutineType(types: !10)
diff --git a/llvm/test/ThinLTO/X86/cache-config.ll b/llvm/test/ThinLTO/X86/cache-config.ll
index cef9338aa3ffe0..98cfeda51f0a49 100644
--- a/llvm/test/ThinLTO/X86/cache-config.ll
+++ b/llvm/test/ThinLTO/X86/cache-config.ll
@@ -1,12 +1,12 @@
 ; RUN: rm -rf %t.cache
 ; RUN: opt -module-hash -module-summary %s -o %t.bc
+; RUN: sed 's/TUNE_PLACEHOLDER/sce/' %s | opt -module-hash -module-summary -o %t.tune.bc
 
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -mcpu=core2
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -x86-relax-relocations=0
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -function-sections
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -data-sections
-; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -debugger-tune=sce
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -mattr=+sse2
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -relocation-model=static
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -code-model=large
@@ -16,6 +16,7 @@
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -aa-pipeline=basic-aa
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -override-triple=x86_64-unknown-linux-gnu
 ; RUN: llvm-lto2 run -o %t.o %t.bc -cache-dir %t.cache -r=%t.bc,globalfunc,plx -default-triple=x86_64-unknown-linux-gnu
+; RUN: llvm-lto2 run -o %t.o %t.tune.bc -cache-dir %t.cache -r=%t.tune.bc,globalfunc,plx
 ; RUN: ls %t.cache | count 15
 
 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
@@ -25,3 +26,7 @@ define void @globalfunc() {
 entry:
   ret void
 }
+
+!llvm.module.flags = !{!0}
+
+!0 = !{i32 1, !"debugger-tuning", !"TUNE_PLACEHOLDER"}
diff --git a/llvm/test/tools/dsymutil/AArch64/debug-names-accel-table-types.ll b/llvm/test/tools/dsymutil/AArch64/debug-names-accel-table-types.ll
index e3db6b40f96b49..21c37ef6e3a687 100644
--- a/llvm/test/tools/dsymutil/AArch64/debug-names-accel-table-types.ll
+++ b/llvm/test/tools/dsymutil/AArch64/debug-names-accel-table-types.ll
@@ -1,4 +1,4 @@
-; RUN: %llc_dwarf -debugger-tune=lldb -accel-tables=Dwarf -filetype=obj -o %t < %s
+; RUN: %llc_dwarf -accel-tables=Dwarf -filetype=obj -o %t < %s
 ; RUN: llvm-dwarfdump %t | FileCheck %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck --check-prefix=SAME-NAME %s
 ; RUN: llvm-dwarfdump -debug-names %t | FileCheck --check-prefix=DIFFERENT-NAME %s
@@ -43,7 +43,7 @@ target triple = "arm64-apple-macosx14.5.0"
 @q = global %struct.SameName zeroinitializer, align 4, !dbg !0
 @r = global %struct.DifferentName zeroinitializer, align 4, !dbg !5
 
-!llvm.module.flags = !{!14, !15, !16, !17, !18, !19, !20}
+!llvm.module.flags = !{!14, !15, !16, !17, !18, !19, !20, !22}
 !llvm.dbg.cu = !{!2}
 !llvm.ident = !{!21}
 
@@ -69,3 +69,4 @@ target triple = "arm64-apple-macosx14.5.0"
 !19 = !{i32 7, !"uwtable", i32 1}
 !20 = !{i32 7, !"frame-pointer", i32 1}
 !21 = !{!"clang version 1"}
+!22 = !{i32 2, !"debugger-tuning", !"lldb"}
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/statistics.ll b/llvm/test/tools/llvm-dwarfdump/X86/statistics.ll
index 77de0241daeabd..f6e70b7c205cfd 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/statistics.ll
+++ b/llvm/test/tools/llvm-dwarfdump/X86/statistics.ll
@@ -1,4 +1,4 @@
-; RUN: llc -O0 %s -o - -filetype=obj -debugger-tune=gdb -accel-tables=Apple \
+; RUN: llc -O0 -o - -filetype=obj -accel-tables=Apple %s \
 ; RUN:   | llvm-dwarfdump -statistics - | FileCheck %s
 ; CHECK: "version": 9,
 
@@ -144,7 +144,7 @@ attributes #1 = { nounwind readnone speculatable }
 attributes #2 = { noinline nounwind optnone ssp uwtable }
 
 !llvm.dbg.cu = !{!2}
-!llvm.module.flags = !{!15, !16, !17, !18}
+!llvm.module.flags = !{!15, !16, !17, !18, !100}
 !llvm.ident = !{!19}
 
 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
@@ -166,6 +166,7 @@ attributes #2 = { noinline nounwind optnone ssp uwtable }
 !16 = !{i32 2, !"Debug Info Version", i32 3}
 !17 = !{i32 1, !"wchar_size", i32 4}
 !18 = !{i32 7, !"PIC Level", i32 2}
+!100 = !{i32 2, !"debugger-tuning", !"gdb"}
 !19 = !{!"clang version 6.0.0 (trunk 310529) (llvm/trunk 310534)"}
 !20 = distinct !DISubprogram(name: "square", linkageName: "_Z6squarei", scope: !3, file: !3, line: 8, type: !21, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: false, unit: !2, retainedNodes: !4)
 !21 = !DISubroutineType(types: !22)



More information about the llvm-branch-commits mailing list