Skip to content

Commit 97ac648

Browse files
authored
[DebugInfo][RemoveDIs] Delete debug-info-format flag (#143746)
This flag was used to let us incrementally introduce debug records into LLVM, however everything is now using records. It serves no purpose now, so delete it.
1 parent fe28ea3 commit 97ac648

35 files changed

+31
-319
lines changed

llvm/include/llvm/IR/BasicBlock.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,6 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
6363
public:
6464
using InstListType = SymbolTableList<Instruction, ilist_iterator_bits<true>,
6565
ilist_parent<BasicBlock>>;
66-
/// Flag recording whether or not this block stores debug-info in the form
67-
/// of intrinsic instructions (false) or non-instruction records (true).
68-
bool IsNewDbgInfoFormat;
6966

7067
private:
7168
// Allow Function to renumber blocks.
@@ -95,12 +92,6 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
9592
/// IsNewDbgInfoFormat = false.
9693
LLVM_ABI void convertFromNewDbgValues();
9794

98-
/// Ensure the block is in "old" dbg.value format (\p NewFlag == false) or
99-
/// in the new format (\p NewFlag == true), converting to the desired format
100-
/// if necessary.
101-
LLVM_ABI void setIsNewDbgInfoFormat(bool NewFlag);
102-
LLVM_ABI void setNewDbgInfoFormatFlag(bool NewFlag);
103-
10495
unsigned getNumber() const {
10596
assert(getParent() && "only basic blocks in functions have valid numbers");
10697
return Number;

llvm/include/llvm/IR/Function.h

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,11 +111,6 @@ class LLVM_ABI Function : public GlobalObject, public ilist_node<Function> {
111111
friend class SymbolTableListTraits<Function>;
112112

113113
public:
114-
/// Is this function using intrinsics to record the position of debugging
115-
/// information, or non-intrinsic records? See IsNewDbgInfoFormat in
116-
/// \ref BasicBlock.
117-
bool IsNewDbgInfoFormat;
118-
119114
/// hasLazyArguments/CheckLazyArguments - The argument list of a function is
120115
/// built on demand, so that the list isn't allocated until the first client
121116
/// needs it. The hasLazyArguments predicate returns true if the arg list
@@ -130,9 +125,6 @@ class LLVM_ABI Function : public GlobalObject, public ilist_node<Function> {
130125
/// \see BasicBlock::convertFromNewDbgValues.
131126
void convertFromNewDbgValues();
132127

133-
void setIsNewDbgInfoFormat(bool NewVal);
134-
void setNewDbgInfoFormatFlag(bool NewVal);
135-
136128
private:
137129
friend class TargetLibraryInfoImpl;
138130

@@ -760,7 +752,6 @@ class LLVM_ABI Function : public GlobalObject, public ilist_node<Function> {
760752
/// to the newly inserted BB.
761753
Function::iterator insert(Function::iterator Position, BasicBlock *BB) {
762754
Function::iterator FIt = BasicBlocks.insert(Position, BB);
763-
BB->setIsNewDbgInfoFormat(IsNewDbgInfoFormat);
764755
return FIt;
765756
}
766757

llvm/include/llvm/IR/Module.h

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -215,11 +215,6 @@ class LLVM_ABI Module {
215215
/// @name Constructors
216216
/// @{
217217
public:
218-
/// Is this Module using intrinsics to record the position of debugging
219-
/// information, or non-intrinsic records? See IsNewDbgInfoFormat in
220-
/// \ref BasicBlock.
221-
bool IsNewDbgInfoFormat;
222-
223218
/// Used when printing this module in the new debug info format; removes all
224219
/// declarations of debug intrinsics that are replaced by non-intrinsic
225220
/// records in the new format.
@@ -230,28 +225,13 @@ class LLVM_ABI Module {
230225
for (auto &F : *this) {
231226
F.convertToNewDbgValues();
232227
}
233-
IsNewDbgInfoFormat = true;
234228
}
235229

236230
/// \see BasicBlock::convertFromNewDbgValues.
237231
void convertFromNewDbgValues() {
238232
for (auto &F : *this) {
239233
F.convertFromNewDbgValues();
240234
}
241-
IsNewDbgInfoFormat = false;
242-
}
243-
244-
void setIsNewDbgInfoFormat(bool UseNewFormat) {
245-
if (UseNewFormat && !IsNewDbgInfoFormat)
246-
convertToNewDbgValues();
247-
else if (!UseNewFormat && IsNewDbgInfoFormat)
248-
convertFromNewDbgValues();
249-
}
250-
void setNewDbgInfoFormatFlag(bool NewFlag) {
251-
for (auto &F : *this) {
252-
F.setNewDbgInfoFormatFlag(NewFlag);
253-
}
254-
IsNewDbgInfoFormat = NewFlag;
255235
}
256236

257237
/// The Module constructor. Note that there is no default constructor. You

llvm/lib/AsmParser/LLParser.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,6 @@ bool LLParser::validateEndOfModule(bool UpgradeDebugInfo) {
441441
UpgradeNVVMAnnotations(*M);
442442
UpgradeSectionAttributes(*M);
443443

444-
M->setIsNewDbgInfoFormat(true);
445-
446444
if (!Slots)
447445
return false;
448446
// Initialize the slot mapping.
@@ -6906,8 +6904,6 @@ bool LLParser::parseBasicBlock(PerFunctionState &PFS) {
69066904
if (SeenOldDbgInfoFormat)
69076905
return error(Lex.getLoc(), "debug record should not appear in a module "
69086906
"containing debug info intrinsics");
6909-
if (!SeenNewDbgInfoFormat)
6910-
M->setNewDbgInfoFormatFlag(true);
69116907
SeenNewDbgInfoFormat = true;
69126908
Lex.Lex();
69136909

llvm/lib/Bitcode/Reader/BitcodeReader.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4479,10 +4479,6 @@ Error BitcodeReader::parseGlobalIndirectSymbolRecord(
44794479
Error BitcodeReader::parseModule(uint64_t ResumeBit,
44804480
bool ShouldLazyLoadMetadata,
44814481
ParserCallbacks Callbacks) {
4482-
// Don't allow modules to use debug-intrinsics: autoupgrading them is now
4483-
// mandatory.
4484-
TheModule->IsNewDbgInfoFormat = true;
4485-
44864482
this->ValueTypeCallback = std::move(Callbacks.ValueType);
44874483
if (ResumeBit) {
44884484
if (Error JumpFailed = Stream.JumpToBit(ResumeBit))
@@ -6994,10 +6990,6 @@ Error BitcodeReader::materialize(GlobalValue *GV) {
69946990
if (Error JumpFailed = Stream.JumpToBit(DFII->second))
69956991
return JumpFailed;
69966992

6997-
// Regardless of the debug info format we want to end up in, we need
6998-
// IsNewDbgInfoFormat=true to construct any debug records seen in the bitcode.
6999-
F->IsNewDbgInfoFormat = true;
7000-
70016993
if (Error Err = parseFunctionBody(F))
70026994
return Err;
70036995
F->setIsMaterializable(false);

llvm/lib/CodeGen/CodeGenPrepare.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3335,8 +3335,7 @@ class TypePromotionTransaction {
33353335

33363336
// Record where we would have to re-insert the instruction in the sequence
33373337
// of DbgRecords, if we ended up reinserting.
3338-
if (BB->IsNewDbgInfoFormat)
3339-
BeforeDbgRecord = Inst->getDbgReinsertionPosition();
3338+
BeforeDbgRecord = Inst->getDbgReinsertionPosition();
33403339

33413340
if (HasPrevInstruction) {
33423341
Point.PrevInst = std::prev(Inst->getIterator());

llvm/lib/IR/BasicBlock.cpp

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,6 @@ DbgMarker *BasicBlock::createMarker(InstListType::iterator It) {
5252
}
5353

5454
void BasicBlock::convertToNewDbgValues() {
55-
IsNewDbgInfoFormat = true;
56-
5755
// Iterate over all instructions in the instruction list, collecting debug
5856
// info intrinsics and converting them to DbgRecords. Once we find a "real"
5957
// instruction, attach all those DbgRecords to a DbgMarker in that
@@ -91,7 +89,6 @@ void BasicBlock::convertToNewDbgValues() {
9189

9290
void BasicBlock::convertFromNewDbgValues() {
9391
invalidateOrders();
94-
IsNewDbgInfoFormat = false;
9592

9693
// Iterate over the block, finding instructions annotated with DbgMarkers.
9794
// Convert any attached DbgRecords to debug intrinsics and insert ahead of the
@@ -126,16 +123,6 @@ void BasicBlock::dumpDbgValues() const {
126123
}
127124
#endif
128125

129-
void BasicBlock::setIsNewDbgInfoFormat(bool NewFlag) {
130-
if (NewFlag && !IsNewDbgInfoFormat)
131-
convertToNewDbgValues();
132-
else if (!NewFlag && IsNewDbgInfoFormat)
133-
convertFromNewDbgValues();
134-
}
135-
void BasicBlock::setNewDbgInfoFormatFlag(bool NewFlag) {
136-
IsNewDbgInfoFormat = NewFlag;
137-
}
138-
139126
ValueSymbolTable *BasicBlock::getValueSymbolTable() {
140127
if (Function *F = getParent())
141128
return F->getValueSymbolTable();
@@ -157,8 +144,7 @@ template class llvm::SymbolTableListTraits<
157144

158145
BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent,
159146
BasicBlock *InsertBefore)
160-
: Value(Type::getLabelTy(C), Value::BasicBlockVal),
161-
IsNewDbgInfoFormat(true), Parent(nullptr) {
147+
: Value(Type::getLabelTy(C), Value::BasicBlockVal), Parent(nullptr) {
162148

163149
if (NewParent)
164150
insertInto(NewParent, InsertBefore);
@@ -168,8 +154,6 @@ BasicBlock::BasicBlock(LLVMContext &C, const Twine &Name, Function *NewParent,
168154

169155
end().getNodePtr()->setParent(this);
170156
setName(Name);
171-
if (NewParent)
172-
setIsNewDbgInfoFormat(NewParent->IsNewDbgInfoFormat);
173157
}
174158

175159
void BasicBlock::insertInto(Function *NewParent, BasicBlock *InsertBefore) {
@@ -180,8 +164,6 @@ void BasicBlock::insertInto(Function *NewParent, BasicBlock *InsertBefore) {
180164
NewParent->insert(InsertBefore->getIterator(), this);
181165
else
182166
NewParent->insert(NewParent->end(), this);
183-
184-
setIsNewDbgInfoFormat(NewParent->IsNewDbgInfoFormat);
185167
}
186168

187169
BasicBlock::~BasicBlock() {
@@ -725,10 +707,6 @@ void BasicBlock::flushTerminatorDbgRecords() {
725707
// check whether there's anything trailing at the end and move those
726708
// DbgRecords in front of the terminator.
727709

728-
// Do nothing if we're not in new debug-info format.
729-
if (!IsNewDbgInfoFormat)
730-
return;
731-
732710
// If there's no terminator, there's nothing to do.
733711
Instruction *Term = getTerminator();
734712
if (!Term)
@@ -765,10 +743,6 @@ void BasicBlock::spliceDebugInfoEmptyBlock(BasicBlock::iterator Dest,
765743
// in the iterators whether there was the intention to transfer any debug
766744
// info.
767745

768-
// If we're not in "new" debug-info format, do nothing.
769-
if (!IsNewDbgInfoFormat)
770-
return;
771-
772746
assert(First == Last);
773747
bool InsertAtHead = Dest.getHeadBit();
774748
bool ReadFromHead = First.getHeadBit();
@@ -1029,8 +1003,6 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src,
10291003

10301004
void BasicBlock::splice(iterator Dest, BasicBlock *Src, iterator First,
10311005
iterator Last) {
1032-
assert(Src->IsNewDbgInfoFormat == IsNewDbgInfoFormat);
1033-
10341006
#ifdef EXPENSIVE_CHECKS
10351007
// Check that First is before Last.
10361008
auto FromBBEnd = Src->end();
@@ -1045,9 +1017,7 @@ void BasicBlock::splice(iterator Dest, BasicBlock *Src, iterator First,
10451017
return;
10461018
}
10471019

1048-
// Handle non-instr debug-info specific juggling.
1049-
if (IsNewDbgInfoFormat)
1050-
spliceDebugInfo(Dest, Src, First, Last);
1020+
spliceDebugInfo(Dest, Src, First, Last);
10511021

10521022
// And move the instructions.
10531023
getInstList().splice(Dest, Src->getInstList(), First, Last);
@@ -1056,7 +1026,6 @@ void BasicBlock::splice(iterator Dest, BasicBlock *Src, iterator First,
10561026
}
10571027

10581028
void BasicBlock::insertDbgRecordAfter(DbgRecord *DR, Instruction *I) {
1059-
assert(IsNewDbgInfoFormat);
10601029
assert(I->getParent() == this);
10611030

10621031
iterator NextIt = std::next(I->getIterator());

llvm/lib/IR/Core.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -431,12 +431,12 @@ void LLVMAddModuleFlag(LLVMModuleRef M, LLVMModuleFlagBehavior Behavior,
431431
{Key, KeyLen}, unwrap(Val));
432432
}
433433

434-
LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M) {
435-
return unwrap(M)->IsNewDbgInfoFormat;
436-
}
434+
LLVMBool LLVMIsNewDbgInfoFormat(LLVMModuleRef M) { return true; }
437435

438436
void LLVMSetIsNewDbgInfoFormat(LLVMModuleRef M, LLVMBool UseNewFormat) {
439-
unwrap(M)->setIsNewDbgInfoFormat(UseNewFormat);
437+
if (!UseNewFormat)
438+
llvm_unreachable("LLVM no longer supports intrinsic based debug-info");
439+
(void)M;
440440
}
441441

442442
/*--.. Printing modules ....................................................--*/

llvm/lib/IR/Function.cpp

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -87,32 +87,17 @@ void Function::validateBlockNumbers() const {
8787
}
8888

8989
void Function::convertToNewDbgValues() {
90-
IsNewDbgInfoFormat = true;
9190
for (auto &BB : *this) {
9291
BB.convertToNewDbgValues();
9392
}
9493
}
9594

9695
void Function::convertFromNewDbgValues() {
97-
IsNewDbgInfoFormat = false;
9896
for (auto &BB : *this) {
9997
BB.convertFromNewDbgValues();
10098
}
10199
}
102100

103-
void Function::setIsNewDbgInfoFormat(bool NewFlag) {
104-
if (NewFlag && !IsNewDbgInfoFormat)
105-
convertToNewDbgValues();
106-
else if (!NewFlag && IsNewDbgInfoFormat)
107-
convertFromNewDbgValues();
108-
}
109-
void Function::setNewDbgInfoFormatFlag(bool NewFlag) {
110-
for (auto &BB : *this) {
111-
BB.setNewDbgInfoFormatFlag(NewFlag);
112-
}
113-
IsNewDbgInfoFormat = NewFlag;
114-
}
115-
116101
//===----------------------------------------------------------------------===//
117102
// Argument Implementation
118103
//===----------------------------------------------------------------------===//
@@ -490,7 +475,7 @@ Function::Function(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace,
490475
const Twine &name, Module *ParentModule)
491476
: GlobalObject(Ty, Value::FunctionVal, AllocMarker, Linkage, name,
492477
computeAddrSpace(AddrSpace, ParentModule)),
493-
NumArgs(Ty->getNumParams()), IsNewDbgInfoFormat(true) {
478+
NumArgs(Ty->getNumParams()) {
494479
assert(FunctionType::isValidReturnType(getReturnType()) &&
495480
"invalid return type");
496481
setGlobalObjectSubClassData(0);
@@ -505,7 +490,6 @@ Function::Function(FunctionType *Ty, LinkageTypes Linkage, unsigned AddrSpace,
505490

506491
if (ParentModule) {
507492
ParentModule->getFunctionList().push_back(this);
508-
IsNewDbgInfoFormat = ParentModule->IsNewDbgInfoFormat;
509493
}
510494

511495
HasLLVMReservedName = getName().starts_with("llvm.");

llvm/lib/IR/Instruction.cpp

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ void Instruction::removeFromParent() {
8686
}
8787

8888
void Instruction::handleMarkerRemoval() {
89-
if (!getParent()->IsNewDbgInfoFormat || !DebugMarker)
89+
if (!DebugMarker)
9090
return;
9191

9292
DebugMarker->removeMarker();
@@ -136,9 +136,6 @@ void Instruction::insertBefore(BasicBlock &BB,
136136

137137
BB.getInstList().insert(InsertPos, this);
138138

139-
if (!BB.IsNewDbgInfoFormat)
140-
return;
141-
142139
// We've inserted "this": if InsertAtHead is set then it comes before any
143140
// DbgVariableRecords attached to InsertPos. But if it's not set, then any
144141
// DbgRecords should now come before "this".
@@ -226,7 +223,7 @@ void Instruction::moveBeforeImpl(BasicBlock &BB, InstListType::iterator I,
226223

227224
// If we've been given the "Preserve" flag, then just move the DbgRecords with
228225
// the instruction, no more special handling needed.
229-
if (BB.IsNewDbgInfoFormat && DebugMarker && !Preserve) {
226+
if (DebugMarker && !Preserve) {
230227
if (I != this->getIterator() || InsertAtHead) {
231228
// "this" is definitely moving in the list, or it's moving ahead of its
232229
// attached DbgVariableRecords. Detach any existing DbgRecords.
@@ -238,7 +235,7 @@ void Instruction::moveBeforeImpl(BasicBlock &BB, InstListType::iterator I,
238235
// the block splicer, which will do more debug-info things.
239236
BB.getInstList().splice(I, getParent()->getInstList(), getIterator());
240237

241-
if (BB.IsNewDbgInfoFormat && !Preserve) {
238+
if (!Preserve) {
242239
DbgMarker *NextMarker = getParent()->getNextMarker(this);
243240

244241
// If we're inserting at point I, and not in front of the DbgRecords
@@ -258,10 +255,6 @@ iterator_range<DbgRecord::self_iterator> Instruction::cloneDebugInfoFrom(
258255
if (!From->DebugMarker)
259256
return DbgMarker::getEmptyDbgRecordRange();
260257

261-
assert(getParent()->IsNewDbgInfoFormat);
262-
assert(getParent()->IsNewDbgInfoFormat ==
263-
From->getParent()->IsNewDbgInfoFormat);
264-
265258
if (!DebugMarker)
266259
getParent()->createMarker(this);
267260

llvm/lib/IR/Module.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ template class LLVM_EXPORT_TEMPLATE llvm::SymbolTableListTraits<GlobalIFunc>;
7171

7272
Module::Module(StringRef MID, LLVMContext &C)
7373
: Context(C), ValSymTab(std::make_unique<ValueSymbolTable>(-1)),
74-
ModuleID(std::string(MID)), SourceFileName(std::string(MID)),
75-
IsNewDbgInfoFormat(true) {
74+
ModuleID(std::string(MID)), SourceFileName(std::string(MID)) {
7675
Context.addModule(this);
7776
}
7877

@@ -83,7 +82,6 @@ Module &Module::operator=(Module &&Other) {
8382

8483
ModuleID = std::move(Other.ModuleID);
8584
SourceFileName = std::move(Other.SourceFileName);
86-
IsNewDbgInfoFormat = std::move(Other.IsNewDbgInfoFormat);
8785

8886
GlobalList.clear();
8987
GlobalList.splice(GlobalList.begin(), Other.GlobalList);

0 commit comments

Comments
 (0)