Skip to content

Commit 2ef6120

Browse files
authored
[RemoveDIs] Do not load into new debug info format from bitcode by default (#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.
1 parent e550022 commit 2ef6120

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

llvm/tools/verify-uselistorder/verify-uselistorder.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ static cl::opt<unsigned>
6868
cl::desc("Number of times to shuffle and verify use-lists"),
6969
cl::init(1), cl::cat(Cat));
7070

71+
extern cl::opt<cl::boolOrDefault> LoadBitcodeIntoNewDbgInforFormat;
72+
7173
namespace {
7274

7375
struct TempFile {
@@ -169,8 +171,7 @@ std::unique_ptr<Module> TempFile::readBitcode(LLVMContext &Context) const {
169171

170172
// verify-uselistoder currently only supports old-style debug info mode.
171173
// FIXME: Update mapping code for RemoveDIs.
172-
assert(!ModuleOr.get()->IsNewDbgInfoFormat &&
173-
"Unexpectedly in new debug info mode");
174+
ModuleOr.get()->setIsNewDbgInfoFormat(false);
174175
return std::move(ModuleOr.get());
175176
}
176177

@@ -182,7 +183,7 @@ std::unique_ptr<Module> TempFile::readAssembly(LLVMContext &Context) const {
182183
Err.print("verify-uselistorder", errs());
183184
// verify-uselistoder currently only supports old-style debug info mode.
184185
// FIXME: Update mapping code for RemoveDIs.
185-
assert(!M->IsNewDbgInfoFormat && "Unexpectedly in new debug info mode");
186+
M->setIsNewDbgInfoFormat(false);
186187
return M;
187188
}
188189

@@ -544,14 +545,18 @@ int main(int argc, char **argv) {
544545
cl::ParseCommandLineOptions(argc, argv,
545546
"llvm tool to verify use-list order\n");
546547

548+
// Do not load bitcode into the new debug info format by default.
549+
if (LoadBitcodeIntoNewDbgInforFormat == cl::boolOrDefault::BOU_UNSET)
550+
LoadBitcodeIntoNewDbgInforFormat = cl::boolOrDefault::BOU_FALSE;
551+
547552
LLVMContext Context;
548553
SMDiagnostic Err;
549554

550555
// Load the input module...
551556
std::unique_ptr<Module> M = parseIRFile(InputFilename, Err, Context);
552557
// verify-uselistoder currently only supports old-style debug info mode.
553558
// FIXME: Update mapping code for RemoveDIs.
554-
assert(!M->IsNewDbgInfoFormat && "Unexpectedly in new debug info mode");
559+
M->setIsNewDbgInfoFormat(false);
555560

556561
if (!M.get()) {
557562
Err.print(argv[0], errs());

0 commit comments

Comments
 (0)