Skip to content

Commit 0e4b8b8

Browse files
authored
[DebugInfo][RemoveDIs] Rip out the UseNewDbgInfoFormat flag (#143207)
Start removing debug intrinsics support -- starting with the flag that controls production of their replacement, debug records. This patch removes the command-line-flag and with it the ability to switch back to intrinsics. The module / function / block level "IsNewDbgInfoFormat" flags get hardcoded to true, I'll to incrementally remove things that depend on those flags.
1 parent 7f08503 commit 0e4b8b8

File tree

27 files changed

+69
-263
lines changed

27 files changed

+69
-263
lines changed

clang/test/CodeGenCXX/tmp-md-nodes2.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// REQUIRES: asserts
22
// RUN: %clang_cc1 -O0 -triple %itanium_abi_triple -debug-info-kind=limited -emit-llvm %s -o - | \
33
// RUN: FileCheck %s
4-
// RUN: %clang_cc1 -O0 -triple %itanium_abi_triple -debug-info-kind=limited -emit-llvm -mllvm --experimental-debuginfo-iterators=true %s -o - | \
5-
// RUN: FileCheck %s
64

75
// This test simply checks that the varargs thunk is created. The failing test
86
// case asserts.

flang/test/Integration/debug-local-var-2.f90

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -mllvm --experimental-debuginfo-iterators=true -o - | FileCheck %s --check-prefixes=BOTH,RECORDS
2-
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=line-tables-only %s -mllvm --experimental-debuginfo-iterators=false -o - | FileCheck --check-prefix=LINEONLY %s
3-
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=line-tables-only %s -mllvm --experimental-debuginfo-iterators=true -o - | FileCheck --check-prefix=LINEONLY %s
1+
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=standalone %s -o - | FileCheck %s --check-prefixes=BOTH,RECORDS
2+
! RUN: %flang_fc1 -emit-llvm -debug-info-kind=line-tables-only %s -o - | FileCheck --check-prefix=LINEONLY %s
43

54
! This tests checks the debug information for local variables in llvm IR.
65

llvm/include/llvm/IR/BasicBlock.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
8787

8888
/// Convert variable location debugging information stored in dbg.value
8989
/// intrinsics into DbgMarkers / DbgRecords. Deletes all dbg.values in
90-
/// the process and sets IsNewDbgInfoFormat = true. Only takes effect if
91-
/// the UseNewDbgInfoFormat LLVM command line option is given.
90+
/// the process and sets IsNewDbgInfoFormat = true.
9291
LLVM_ABI void convertToNewDbgValues();
9392

9493
/// Convert variable location debugging information stored in DbgMarkers and

llvm/include/llvm/IR/PassManagerImpl.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,6 @@
2222
#include "llvm/Support/Compiler.h"
2323
#include "llvm/Support/PrettyStackTrace.h"
2424

25-
LLVM_ABI extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
26-
2725
namespace llvm {
2826

2927
template <typename IRUnitT, typename AnalysisManagerT, typename... ExtraArgTs>
@@ -67,7 +65,7 @@ PreservedAnalyses PassManager<IRUnitT, AnalysisManagerT, ExtraArgTs...>::run(
6765

6866
// RemoveDIs: if requested, convert debug-info to DbgRecord representation
6967
// for duration of these passes.
70-
ScopedDbgInfoFormatSetter FormatSetter(IR, UseNewDbgInfoFormat);
68+
ScopedDbgInfoFormatSetter FormatSetter(IR, true);
7169

7270
StackTraceEntry Entry(PI, IR);
7371
for (auto &Pass : Passes) {

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ static cl::opt<bool> AllowIncompleteIR(
6464
"Allow incomplete IR on a best effort basis (references to unknown "
6565
"metadata will be dropped)"));
6666

67-
LLVM_ABI extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
68-
6967
static std::string getTypeString(Type *T) {
7068
std::string Result;
7169
raw_string_ostream Tmp(Result);
@@ -443,7 +441,7 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) {
443441
UpgradeNVVMAnnotations(*M);
444442
UpgradeSectionAttributes(*M);
445443

446-
M->setIsNewDbgInfoFormat(UseNewDbgInfoFormat);
444+
M->setIsNewDbgInfoFormat(true);
447445

448446
if (!Slots)
449447
return false;

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,6 @@ static cl::opt<bool> ExpandConstantExprs(
101101
cl::desc(
102102
"Expand constant expressions to instructions for testing purposes"));
103103

104-
LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
105-
106104
namespace {
107105

108106
enum {
@@ -4481,9 +4479,9 @@ Error BitcodeReader::parseGlobalIndirectSymbolRecord(
44814479
Error BitcodeReader::parseModule(uint64_t ResumeBit,
44824480
bool ShouldLazyLoadMetadata,
44834481
ParserCallbacks Callbacks) {
4484-
// In preparation for the deletion of debug-intrinsics, don't allow module
4485-
// loading to escape intrinsics being autoupgraded to debug records.
4486-
TheModule->IsNewDbgInfoFormat = UseNewDbgInfoFormat;
4482+
// Don't allow modules to use debug-intrinsics: autoupgrading them is now
4483+
// mandatory.
4484+
TheModule->IsNewDbgInfoFormat = true;
44874485

44884486
this->ValueTypeCallback = std::move(Callbacks.ValueType);
44894487
if (ResumeBit) {

llvm/lib/Bitcode/Writer/BitcodeWriter.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,6 @@ namespace llvm {
122122
extern FunctionSummary::ForceSummaryHotnessType ForceSummaryEdgesCold;
123123
}
124124

125-
LLVM_ABI extern llvm::cl::opt<bool> UseNewDbgInfoFormat;
126-
127125
namespace {
128126

129127
/// These are manifest constants used by the bitcode writer. They do not need to

llvm/lib/CodeGen/MIRPrinter.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,6 @@ static cl::opt<bool> SimplifyMIR(
7070
static cl::opt<bool> PrintLocations("mir-debug-loc", cl::Hidden, cl::init(true),
7171
cl::desc("Print MIR debug-locations"));
7272

73-
extern cl::opt<bool> UseNewDbgInfoFormat;
74-
7573
namespace {
7674

7775
/// This structure describes how to print out stack object references.
@@ -967,8 +965,7 @@ void MIRFormatter::printIRValue(raw_ostream &OS, const Value &V,
967965
}
968966

969967
void llvm::printMIR(raw_ostream &OS, const Module &M) {
970-
ScopedDbgInfoFormatSetter FormatSetter(const_cast<Module &>(M),
971-
UseNewDbgInfoFormat);
968+
ScopedDbgInfoFormatSetter FormatSetter(const_cast<Module &>(M), true);
972969

973970
yaml::Output Out(OS);
974971
Out << const_cast<Module &>(M);
@@ -979,6 +976,6 @@ void llvm::printMIR(raw_ostream &OS, const MachineModuleInfo &MMI,
979976
// RemoveDIs: as there's no textual form for DbgRecords yet, print debug-info
980977
// in dbg.value format.
981978
ScopedDbgInfoFormatSetter FormatSetter(
982-
const_cast<Function &>(MF.getFunction()), UseNewDbgInfoFormat);
979+
const_cast<Function &>(MF.getFunction()), true);
983980
printMF(OS, MMI, MF);
984981
}

llvm/lib/IR/BasicBlock.cpp

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,30 +31,6 @@ using namespace llvm;
3131
#define DEBUG_TYPE "ir"
3232
STATISTIC(NumInstrRenumberings, "Number of renumberings across all blocks");
3333

34-
// This cl-opt exists to control whether variable-location information is
35-
// produced using intrinsics, or whether DbgRecords are produced. However,
36-
// it's imminently being phased out, so give it a flag-name that is very
37-
// unlikely to be used anywhere.
38-
//
39-
// If you find yourself needing to use this flag for any period longer than
40-
// five minutes, please revert the patch making this change, and make contact
41-
// in this discourse post, where we can discuss any further transition work
42-
// that might be needed to remove debug intrinsics.
43-
//
44-
// https://discourse.llvm.org/t/psa-ir-output-changing-from-debug-intrinsics-to-debug-records/79578
45-
LLVM_ABI cl::opt<bool>
46-
UseNewDbgInfoFormat("dont-pass-this-flag-please-experimental-debuginfo",
47-
cl::Hidden, cl::init(true));
48-
49-
// This cl-opt collects the --experimental-debuginfo-iterators flag and then
50-
// does nothing with it (because the it gets stored into an otherwise unused
51-
// cl-opt), so that we can disable debug-intrinsic production without
52-
// immediately modifying lots of tests. If your tests break because of this
53-
// change, please see the next comment up.
54-
static cl::opt<bool> DeliberatelyUnseenDbgInfoFlag(
55-
"experimental-debuginfo-iterators", cl::Hidden,
56-
cl::init(true));
57-
5834
DbgMarker *BasicBlock::createMarker(Instruction *I) {
5935
assert(IsNewDbgInfoFormat &&
6036
"Tried to create a marker in a non new debug-info block!");
@@ -187,7 +163,7 @@ template class llvm::SymbolTableListTraits<
187163
BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent,
188164
BasicBlock *InsertBefore)
189165
: Value(Type::getLabelTy(C), Value::BasicBlockVal),
190-
IsNewDbgInfoFormat(UseNewDbgInfoFormat), Parent(nullptr) {
166+
IsNewDbgInfoFormat(true), Parent(nullptr) {
191167

192168
if (NewParent)
193169
insertInto(NewParent, InsertBefore);

llvm/lib/IR/Function.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,6 @@ static cl::opt<int> NonGlobalValueMaxNameSize(
6565
"non-global-value-max-name-size", cl::Hidden, cl::init(1024),
6666
cl::desc("Maximum size for the name of non-global values."));
6767

68-
LLVM_ABI extern cl::opt<bool> UseNewDbgInfoFormat;
69-
7068
void Function::renumberBlocks() {
7169
validateBlockNumbers();
7270

@@ -492,7 +490,7 @@ Function::Function(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace,
492490
const Twine &name, Module *ParentModule)
493491
: GlobalObject(Ty, Value::FunctionVal, AllocMarker, Linkage, name,
494492
computeAddrSpace(AddrSpace, ParentModule)),
495-
NumArgs(Ty->getNumParams()), IsNewDbgInfoFormat(UseNewDbgInfoFormat) {
493+
NumArgs(Ty->getNumParams()), IsNewDbgInfoFormat(true) {
496494
assert(FunctionType::isValidReturnType(getReturnType()) &&
497495
"invalid return type");
498496
setGlobalObjectSubClassData(0);

0 commit comments

Comments
 (0)