Skip to content

Commit c3f7fb1

Browse files
committed
Revert "[DebugInfo][RemoveDIs] Convert debug-info modes when loading bitcode (#78967)"
This reverts commit 215b8f1. Numerous builders exploded from this X_X, for example https://lab.llvm.org/buildbot/#/builders/46/builds/62657
1 parent a04d4a0 commit c3f7fb1

File tree

12 files changed

+4
-111
lines changed

12 files changed

+4
-111
lines changed

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,6 @@ static cl::opt<bool> ExpandConstantExprs(
100100
cl::desc(
101101
"Expand constant expressions to instructions for testing purposes"));
102102

103-
// Declare external flag for whether we're using the new debug-info format.
104-
extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
105-
106103
namespace {
107104

108105
enum {
@@ -6632,9 +6629,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
66326629
if (Error Err = materializeMetadata())
66336630
return Err;
66346631

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

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-
67216707
// Bring in any functions that this function forward-referenced via
67226708
// blockaddresses.
67236709
return materializeForwardReferencedFunctions();
@@ -8041,15 +8027,6 @@ BitcodeModule::getModuleImpl(LLVMContext &Context, bool MaterializeAll,
80418027
if (Error Err = R->materializeForwardReferencedFunctions())
80428028
return std::move(Err);
80438029
}
8044-
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-
80538030
return std::move(M);
80548031
}
80558032

llvm/lib/IR/LegacyPassManager.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,7 @@ bool PassManagerImpl::run(Module &M) {
530530

531531
// RemoveDIs: if a command line flag is given, convert to the DPValue
532532
// representation of debug-info for the duration of these passes.
533-
bool shouldConvertDbgInfo = UseNewDbgInfoFormat && !M.IsNewDbgInfoFormat;
534-
if (shouldConvertDbgInfo)
533+
if (UseNewDbgInfoFormat)
535534
M.convertToNewDbgValues();
536535

537536
for (ImmutablePass *ImPass : getImmutablePasses())
@@ -546,8 +545,7 @@ bool PassManagerImpl::run(Module &M) {
546545
for (ImmutablePass *ImPass : getImmutablePasses())
547546
Changed |= ImPass->doFinalization(M);
548547

549-
if (shouldConvertDbgInfo)
550-
M.convertFromNewDbgValues();
548+
M.convertFromNewDbgValues();
551549

552550
return Changed;
553551
}

llvm/lib/Linker/IRMover.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,6 @@ Function *IRLinker::copyFunctionProto(const Function *SF) {
694694
SF->getAddressSpace(), SF->getName(), &DstM);
695695
F->copyAttributesFrom(SF);
696696
F->setAttributes(mapAttributeTypes(F->getContext(), F->getAttributes()));
697-
F->IsNewDbgInfoFormat = SF->IsNewDbgInfoFormat;
698697
return F;
699698
}
700699

llvm/lib/Transforms/Utils/ValueMapper.cpp

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,13 +1056,9 @@ void Mapper::remapFunction(Function &F) {
10561056
A.mutateType(TypeMapper->remapType(A.getType()));
10571057

10581058
// Remap the instructions.
1059-
for (BasicBlock &BB : F) {
1060-
for (Instruction &I : BB) {
1059+
for (BasicBlock &BB : F)
1060+
for (Instruction &I : BB)
10611061
remapInstruction(&I);
1062-
for (DPValue &DPV : I.DbgMarker->getDbgValueRange())
1063-
remapDPValue(DPV);
1064-
}
1065-
}
10661062
}
10671063

10681064
void Mapper::mapAppendingVariable(GlobalVariable &GV, Constant *InitPrefix,

llvm/test/LTO/X86/pr38046.ll

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,6 @@
55
; RUN: llvm-dis %t.lto.o.0.2.internalize.bc >/dev/null 2>%t.dis.stderr || true
66
; RUN: FileCheck -allow-empty %s < %t.dis.stderr
77

8-
;; Re-run with "new" debug-info mode to ensure the variable location information
9-
;; is handled gracefully.
10-
; RUN: llvm-lto2 run -save-temps -o %t.lto.o %t.o \
11-
; RUN: -r=%t.o,foo,plx \
12-
; RUN: -r=%t.o,get,pl --try-experimental-debuginfo-iterators
13-
; RUN: llvm-dis %t.lto.o.0.2.internalize.bc >/dev/null 2>%t.dis.stderr || true
14-
; RUN: FileCheck -allow-empty %s < %t.dis.stderr
15-
168
; CHECK-NOT: Global is external, but doesn't have external or weak linkage
179

1810
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

llvm/test/Linker/debug-info-use-before-def.ll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
; RUN: llvm-link -S %s | FileCheck %s
2-
; RUN: llvm-link -S %s --try-experimental-debuginfo-iterators | FileCheck %s
32

43
; Test that when a debug metadata use-before-def is run through llvm-link, the
54
; value reference is preserved. Tests both singular uses and DIArgList uses of

llvm/test/Linker/thinlto_funcimport_debug.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,6 @@
66
; If we import func1 and not func2 we should only link DISubprogram for func1
77
; RUN: llvm-link %t2.bc -summary-index=%t3.thinlto.bc -import=func1:%t.bc -S | FileCheck %s
88

9-
;; Repeat runlines using "new" debuginfo iterators mode.
10-
; RUN: llvm-lto -thinlto -o %t3 %t.bc %t2.bc --try-experimental-debuginfo-iterators
11-
; RUN: llvm-link %t2.bc -summary-index=%t3.thinlto.bc -import=func1:%t.bc -S --try-experimental-debuginfo-iterators | FileCheck %s
12-
139
; CHECK: declare i32 @func2
1410
; CHECK: define available_externally i32 @func1
1511

llvm/test/ThinLTO/X86/debuginfo-cu-import.ll

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@
1313
; CHECK-NOT: DICompileUnit{{.*}} globals:
1414
; CHECK-NOT: DICompileUnit{{.*}} imports:
1515

16-
;; Repeat test in RemoveDIs debug-info mode to check that bitcode is loaded and
17-
;; converted correctly.
18-
; RUN: llvm-lto -thinlto-action=import %t2.bc -thinlto-index=%t.index.bc -o - --try-experimental-debuginfo-iterators | llvm-dis -o - | FileCheck %s
19-
2016
; ModuleID = 'debuginfo-cu-import.c'
2117
source_filename = "debuginfo-cu-import.c"
2218
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"

llvm/test/ThinLTO/X86/pr35472.ll

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,6 @@
99
; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s -check-prefix=ThinLTOa
1010
; RUN: llvm-nm %t2.bc.thinlto.o | FileCheck %s -check-prefix=ThinLTOb
1111

12-
;; Re-run with "new" debug-info mode, checking that we load / convert / emit
13-
;; the dbg.declares below correctly.
14-
; RUN: llvm-lto -thinlto-action=run %t1.bc %t2.bc -exported-symbol=_Z5Alphav --try-experimental-debuginfo-iterators
15-
; RUN: llvm-nm %t1.bc.thinlto.o | FileCheck %s -check-prefix=ThinLTOa
16-
; RUN: llvm-nm %t2.bc.thinlto.o | FileCheck %s -check-prefix=ThinLTOb
17-
1812
; ThinLTOa-DAG: T _Z5Bravov
1913
; ThinLTOa-DAG: W _ZN4EchoD2Ev
2014
; ThinLTOb-DAG: T _Z5Alphav

llvm/tools/llvm-link/llvm-link.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,13 +129,6 @@ static cl::opt<bool> IgnoreNonBitcode(
129129
cl::desc("Do not report an error for non-bitcode files in archives"),
130130
cl::Hidden);
131131

132-
static cl::opt<bool> TryUseNewDbgInfoFormat(
133-
"try-experimental-debuginfo-iterators",
134-
cl::desc("Enable debuginfo iterator positions, if they're built in"),
135-
cl::init(false));
136-
137-
extern cl::opt<bool> UseNewDbgInfoFormat;
138-
139132
static ExitOnError ExitOnErr;
140133

141134
// Read the specified bitcode file in and return it. This routine searches the
@@ -472,17 +465,6 @@ int main(int argc, char **argv) {
472465
cl::HideUnrelatedOptions({&LinkCategory, &getColorCategory()});
473466
cl::ParseCommandLineOptions(argc, argv, "llvm linker\n");
474467

475-
// RemoveDIs debug-info transition: tests may request that we /try/ to use the
476-
// new debug-info format, if it's built in.
477-
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
478-
if (TryUseNewDbgInfoFormat) {
479-
// If LLVM was built with support for this, turn the new debug-info format
480-
// on.
481-
UseNewDbgInfoFormat = true;
482-
}
483-
#endif
484-
(void)TryUseNewDbgInfoFormat;
485-
486468
LLVMContext Context;
487469
Context.setDiagnosticHandler(std::make_unique<LLVMLinkDiagnosticHandler>(),
488470
true);

llvm/tools/llvm-lto/llvm-lto.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,6 @@ static cl::opt<bool>
264264
LTOSaveBeforeOpt("lto-save-before-opt", cl::init(false),
265265
cl::desc("Save the IR before running optimizations"));
266266

267-
static cl::opt<bool> TryUseNewDbgInfoFormat(
268-
"try-experimental-debuginfo-iterators",
269-
cl::desc("Enable debuginfo iterator positions, if they're built in"),
270-
cl::init(false), cl::Hidden);
271-
272-
extern cl::opt<bool> UseNewDbgInfoFormat;
273-
274267
namespace {
275268

276269
struct ModuleInfo {
@@ -944,17 +937,6 @@ int main(int argc, char **argv) {
944937
cl::HideUnrelatedOptions({&LTOCategory, &getColorCategory()});
945938
cl::ParseCommandLineOptions(argc, argv, "llvm LTO linker\n");
946939

947-
// RemoveDIs debug-info transition: tests may request that we /try/ to use the
948-
// new debug-info format, if it's built in.
949-
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
950-
if (TryUseNewDbgInfoFormat) {
951-
// If LLVM was built with support for this, turn the new debug-info format
952-
// on.
953-
UseNewDbgInfoFormat = true;
954-
}
955-
#endif
956-
(void)TryUseNewDbgInfoFormat;
957-
958940
if (OptLevel < '0' || OptLevel > '3')
959941
error("optimization level must be between 0 and 3");
960942

llvm/tools/llvm-lto2/llvm-lto2.cpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,6 @@ static cl::opt<bool> EnableFreestanding(
187187
cl::desc("Enable Freestanding (disable builtins / TLI) during LTO"),
188188
cl::Hidden);
189189

190-
static cl::opt<bool> TryUseNewDbgInfoFormat(
191-
"try-experimental-debuginfo-iterators",
192-
cl::desc("Enable debuginfo iterator positions, if they're built in"),
193-
cl::init(false), cl::Hidden);
194-
195-
extern cl::opt<bool> UseNewDbgInfoFormat;
196-
197190
static void check(Error E, std::string Msg) {
198191
if (!E)
199192
return;
@@ -229,17 +222,6 @@ static int usage() {
229222
static int run(int argc, char **argv) {
230223
cl::ParseCommandLineOptions(argc, argv, "Resolution-based LTO test harness");
231224

232-
// RemoveDIs debug-info transition: tests may request that we /try/ to use the
233-
// new debug-info format, if it's built in.
234-
#ifdef EXPERIMENTAL_DEBUGINFO_ITERATORS
235-
if (TryUseNewDbgInfoFormat) {
236-
// If LLVM was built with support for this, turn the new debug-info format
237-
// on.
238-
UseNewDbgInfoFormat = true;
239-
}
240-
#endif
241-
(void)TryUseNewDbgInfoFormat;
242-
243225
// FIXME: Workaround PR30396 which means that a symbol can appear
244226
// more than once if it is defined in module-level assembly and
245227
// has a GV declaration. We allow (file, symbol) pairs to have multiple

0 commit comments

Comments
 (0)