Skip to content

Commit aeb5884

Browse files
authored
[RemoveDIs] Don't convert debug-info in bitcode-loading just now (#80865)
We've been building and testing this no-debug-intrinsic work inside of the pass manager for a while, so that optimisation passes get exercised and tested when we turn it on. However, by converting to the non-intrinsic form in the bitcode loader, we accidentally caused all parts of LLVM to potentially see non-intrinsic debug-info. Seeing how we're trying to turn things on incrementally, it was a mistake to go this far this fast: we can instead just focus on enabling during optimisations for the moment, then all the other parts of LLVM later.
1 parent 7a71ac2 commit aeb5884

File tree

3 files changed

+5
-19
lines changed

3 files changed

+5
-19
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6632,9 +6632,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
66326632
if (Error Err = materializeMetadata())
66336633
return Err;
66346634

6635-
bool NewDebugInfoRequested = F->IsNewDbgInfoFormat;
6636-
F->IsNewDbgInfoFormat = false;
6637-
66386635
// Move the bit stream to the saved position of the deferred function body.
66396636
if (Error JumpFailed = Stream.JumpToBit(DFII->second))
66406637
return JumpFailed;
@@ -6710,14 +6707,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
67106707
// Look for functions that rely on old function attribute behavior.
67116708
UpgradeFunctionAttributes(*F);
67126709

6713-
// If we've materialized a function set up in "new" debug-info mode, the
6714-
// contents just loaded will still be in dbg.value mode. Switch to the new
6715-
// mode now. NB: we can add more complicated logic here in the future to
6716-
// correctly identify when we do and don't need to autoupgrade.
6717-
if (NewDebugInfoRequested) {
6718-
F->convertToNewDbgValues();
6719-
}
6720-
67216710
// Bring in any functions that this function forward-referenced via
67226711
// blockaddresses.
67236712
return materializeForwardReferencedFunctions();
@@ -8042,14 +8031,6 @@ BitcodeModule::getModuleImpl(LLVMContext &Context, bool MaterializeAll,
80428031
return std::move(Err);
80438032
}
80448033

8045-
// If we are operating in a "new debug-info" context, upgrade the debug-info
8046-
// in the loaded module. This is a transitional approach as we enable "new"
8047-
// debug-info in LLVM, which will eventually be pushed down into the
8048-
// autoupgrade path once the bitcode-encoding is finalised. Non-materialised
8049-
// functions will be upgraded in the materialize method.
8050-
if (UseNewDbgInfoFormat && !M->IsNewDbgInfoFormat)
8051-
M->convertToNewDbgValues();
8052-
80538034
return std::move(M);
80548035
}
80558036

llvm/lib/Linker/IRMover.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1775,6 +1775,8 @@ IRMover::IRMover(Module &M) : Composite(M) {
17751775
Error IRMover::move(std::unique_ptr<Module> Src,
17761776
ArrayRef<GlobalValue *> ValuesToLink,
17771777
LazyCallback AddLazyFor, bool IsPerformingImport) {
1778+
if (getModule().IsNewDbgInfoFormat)
1779+
Src->convertToNewDbgValues();
17781780
IRLinker TheIRLinker(Composite, SharedMDs, IdentifiedStructTypes,
17791781
std::move(Src), ValuesToLink, std::move(AddLazyFor),
17801782
IsPerformingImport);

llvm/test/ThinLTO/X86/crash_debuginfo.ll

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
; RUN: opt -passes=function-import,inline -summary-file %t-index.thinlto.bc %t-dst.bc -o %t.out
55
; RUN: llvm-nm -U %t.out | FileCheck %s --implicit-check-not=_bar
66

7+
; Ensure we can do the same thing in RemoveDIs mode.
8+
; RUN: opt -passes=function-import,inline -summary-file %t-index.thinlto.bc %t-dst.bc -o %t.out --try-experimental-debuginfo-iterators
9+
710
; Verify that we import bar and inline it. It use to crash importing due to ODR type uniquing
811
; CHECK: _foo
912

0 commit comments

Comments
 (0)