[llvm] [RemoveDIs] Load into new debug info format by default in llvm-dis (PR #86276)

Orlando Cazalet-Hyams via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 22 05:33:14 PDT 2024


https://github.com/OCHyams created https://github.com/llvm/llvm-project/pull/86276

Directly load all bitcode into the new debug info format in llvm-dis. This means that new-mode bitcode no longer round-trips back to old-mode after parsing, and that old-mode bitcode gets auto-upgraded to new-mode debug info (which is the current in-memory default in LLVM).

>From 3c9579cd873f8230f48c86d5005cee4248dff1aa Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
Date: Fri, 22 Mar 2024 11:55:30 +0000
Subject: [PATCH] llvm-dis

---
 llvm/tools/llvm-dis/llvm-dis.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/llvm/tools/llvm-dis/llvm-dis.cpp b/llvm/tools/llvm-dis/llvm-dis.cpp
index 8e443318dd7d2c..29d4fc92d8cd77 100644
--- a/llvm/tools/llvm-dis/llvm-dis.cpp
+++ b/llvm/tools/llvm-dis/llvm-dis.cpp
@@ -82,6 +82,9 @@ static cl::opt<bool> PrintThinLTOIndexOnly(
 
 extern cl::opt<bool> WriteNewDbgInfoFormat;
 
+extern cl::opt<bool> WriteNewDbgInfoFormat;
+extern cl::opt<cl::boolOrDefault> LoadBitcodeIntoNewDbgInfoFormat;
+
 namespace {
 
 static void printDebugLoc(const DebugLoc &DL, formatted_raw_ostream &OS) {
@@ -168,6 +171,9 @@ int main(int argc, char **argv) {
 
   cl::HideUnrelatedOptions({&DisCategory, &getColorCategory()});
   cl::ParseCommandLineOptions(argc, argv, "llvm .bc -> .ll disassembler\n");
+  // Load bitcode into the new debug info format by default.
+  if (LoadBitcodeIntoNewDbgInfoFormat == cl::boolOrDefault::BOU_UNSET)
+    LoadBitcodeIntoNewDbgInfoFormat = cl::boolOrDefault::BOU_TRUE;
 
   LLVMContext Context;
   Context.setDiagnosticHandler(



More information about the llvm-commits mailing list