[llvm] [RemoveDIs] Do not load into new debug info format from bitcode by default (PR #86268)
Orlando Cazalet-Hyams via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 22 03:58:49 PDT 2024
https://github.com/OCHyams created https://github.com/llvm/llvm-project/pull/86268
This is NFC right now, as the global default behaviour is also "do not load into the new debug info format by default", but we want to change that soon.
Additionally unconditionally convert from the new debug info format into if we've loaded into it (e.g., if the bitcode file loaded was already in the new format).
The latter change is needed because verify-uselistorder doesn't yet understand DbgRecords (it doesn't know how to map them).
The former change is needed because if we load from an old debug format bitcode file but load directly into the new format _and then convert back to the old mode after_, the use-lists of the debug intrinsic functions (the functions' global value uses) change.
>From 7929af8768b42721557ff30dec8c47434d9ef732 Mon Sep 17 00:00:00 2001
From: Orlando Cazalet-Hyams <orlando.hyams at sony.com>
Date: Fri, 22 Mar 2024 10:32:24 +0000
Subject: [PATCH] [RemoveDIs] Do not load into new debug info format from
bitcode by default
This is NFC right now, as the default behaviour is "do not load into the
new debug info format by default", but we want to change that soon.
Additionally unconditionally convert from the new debug info format into if
we've loaded into it (e.g., if the bitcode file loaded was already in the new
format).
The latter change is needed because verify-uselistorder doesn't yet understand
DbgRecords (it doesn't know how to map them).
The former change is needed because if we load from an old debug format bitcode
file but load directly into the new format _and then convert back to the old
mode after_, the use-lists of the debug intrinsic functions (the functions'
global value uses) change.
---
.../tools/verify-uselistorder/verify-uselistorder.cpp | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/llvm/tools/verify-uselistorder/verify-uselistorder.cpp b/llvm/tools/verify-uselistorder/verify-uselistorder.cpp
index d929ae09958a1f..e6ba715ace7838 100644
--- a/llvm/tools/verify-uselistorder/verify-uselistorder.cpp
+++ b/llvm/tools/verify-uselistorder/verify-uselistorder.cpp
@@ -68,6 +68,7 @@ static cl::opt<unsigned>
cl::desc("Number of times to shuffle and verify use-lists"),
cl::init(1), cl::cat(Cat));
+extern cl::opt<cl::boolOrDefault> LoadBitcodeIntoNewDbgInforFormat;
namespace {
struct TempFile {
@@ -169,8 +170,7 @@ std::unique_ptr<Module> TempFile::readBitcode(LLVMContext &Context) const {
// verify-uselistoder currently only supports old-style debug info mode.
// FIXME: Update mapping code for RemoveDIs.
- assert(!ModuleOr.get()->IsNewDbgInfoFormat &&
- "Unexpectedly in new debug info mode");
+ ModuleOr.get()->setIsNewDbgInfoFormat(false);
return std::move(ModuleOr.get());
}
@@ -182,7 +182,7 @@ std::unique_ptr<Module> TempFile::readAssembly(LLVMContext &Context) const {
Err.print("verify-uselistorder", errs());
// verify-uselistoder currently only supports old-style debug info mode.
// FIXME: Update mapping code for RemoveDIs.
- assert(!M->IsNewDbgInfoFormat && "Unexpectedly in new debug info mode");
+ M->setIsNewDbgInfoFormat(false);
return M;
}
@@ -543,6 +543,9 @@ int main(int argc, char **argv) {
cl::HideUnrelatedOptions(Cat);
cl::ParseCommandLineOptions(argc, argv,
"llvm tool to verify use-list order\n");
+ // Do not load bitcode into the new debug info format by default.
+ if (LoadBitcodeIntoNewDbgInforFormat == cl::boolOrDefault::BOU_UNSET)
+ LoadBitcodeIntoNewDbgInforFormat = cl::boolOrDefault::BOU_FALSE;
LLVMContext Context;
SMDiagnostic Err;
@@ -551,7 +554,7 @@ int main(int argc, char **argv) {
std::unique_ptr<Module> M = parseIRFile(InputFilename, Err, Context);
// verify-uselistoder currently only supports old-style debug info mode.
// FIXME: Update mapping code for RemoveDIs.
- assert(!M->IsNewDbgInfoFormat && "Unexpectedly in new debug info mode");
+ M->setIsNewDbgInfoFormat(false);
if (!M.get()) {
Err.print(argv[0], errs());
More information about the llvm-commits
mailing list