diff options
50 files changed, 298 insertions, 301 deletions
diff --git a/llvm/docs/RemoveDIsDebugInfo.md b/llvm/docs/RemoveDIsDebugInfo.md index a057767..a985773 100644 --- a/llvm/docs/RemoveDIsDebugInfo.md +++ b/llvm/docs/RemoveDIsDebugInfo.md @@ -82,11 +82,11 @@ Utilities such as `findDbgUsers` and the like now have an optional argument that ## Examining debug info records at positions -Call `Instruction::getDbgValueRange()` to get the range of `DPValue` objects that are attached to an instruction. +Call `Instruction::getDbgRecordRange()` to get the range of `DPValue` objects that are attached to an instruction. ## Moving around, deleting -You can use `DPValue::removeFromParent` to unlink a `DPValue` from it's marker, and then `BasicBlock::insertDPValueBefore` or `BasicBlock::insertDPValueAfter` to re-insert the `DPValue` somewhere else. You cannot insert a `DPValue` at an arbitary point in a list of `DPValue`s (if you're doing this with `dbg.value`s then it's unlikely to be correct). +You can use `DPValue::removeFromParent` to unlink a `DPValue` from it's marker, and then `BasicBlock::insertDbgRecordBefore` or `BasicBlock::insertDbgRecordAfter` to re-insert the `DPValue` somewhere else. You cannot insert a `DPValue` at an arbitary point in a list of `DPValue`s (if you're doing this with `dbg.value`s then it's unlikely to be correct). Erase `DPValue`s by calling `eraseFromParent` or `deleteInstr` if it's already been removed. diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h index 179305e9..5bac113 100644 --- a/llvm/include/llvm/IR/BasicBlock.h +++ b/llvm/include/llvm/IR/BasicBlock.h @@ -97,16 +97,16 @@ public: /// instruction of this block. These are equivalent to dbg.value intrinsics /// that exist at the end of a basic block with no terminator (a transient /// state that occurs regularly). - void setTrailingDPValues(DPMarker *M); + void setTrailingDbgRecords(DPMarker *M); /// Fetch the collection of DPValues that "trail" after the last instruction - /// of this block, see \ref setTrailingDPValues. If there are none, returns + /// of this block, see \ref setTrailingDbgRecords. If there are none, returns /// nullptr. - DPMarker *getTrailingDPValues(); + DPMarker *getTrailingDbgRecords(); /// Delete any trailing DPValues at the end of this block, see - /// \ref setTrailingDPValues. - void deleteTrailingDPValues(); + /// \ref setTrailingDbgRecords. + void deleteTrailingDbgRecords(); void dumpDbgValues() const; @@ -121,10 +121,10 @@ public: DPMarker *getNextMarker(Instruction *I); /// Insert a DPValue into a block at the position given by \p I. - void insertDPValueAfter(DbgRecord *DPV, Instruction *I); + void insertDbgRecordAfter(DbgRecord *DPV, Instruction *I); /// Insert a DPValue into a block at the position given by \p Here. - void insertDPValueBefore(DbgRecord *DPV, InstListType::iterator Here); + void insertDbgRecordBefore(DbgRecord *DPV, InstListType::iterator Here); /// Eject any debug-info trailing at the end of a block. DPValues can /// transiently be located "off the end" of a block if the blocks terminator @@ -137,8 +137,8 @@ public: /// happens in RemoveDIs debug-info mode, some special patching-up needs to /// occur: inserting into the middle of a sequence of dbg.value intrinsics /// does not have an equivalent with DPValues. - void reinsertInstInDPValues(Instruction *I, - std::optional<DbgRecord::self_iterator> Pos); + void reinsertInstInDbgRecords(Instruction *I, + std::optional<DbgRecord::self_iterator> Pos); private: void setParent(Function *parent); diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h index a8faf41..507b652 100644 --- a/llvm/include/llvm/IR/DebugProgramInstruction.h +++ b/llvm/include/llvm/IR/DebugProgramInstruction.h @@ -577,9 +577,9 @@ public: void print(raw_ostream &ROS, ModuleSlotTracker &MST, bool IsForDebug) const; /// Produce a range over all the DPValues in this Marker. - iterator_range<simple_ilist<DbgRecord>::iterator> getDbgValueRange(); + iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange(); iterator_range<simple_ilist<DbgRecord>::const_iterator> - getDbgValueRange() const; + getDbgRecordRange() const; /// Transfer any DPValues from \p Src into this DPMarker. If \p InsertAtHead /// is true, place them before existing DPValues, otherwise afterwards. void absorbDebugValues(DPMarker &Src, bool InsertAtHead); @@ -590,11 +590,11 @@ public: DPMarker &Src, bool InsertAtHead); /// Insert a DPValue into this DPMarker, at the end of the list. If /// \p InsertAtHead is true, at the start. - void insertDPValue(DbgRecord *New, bool InsertAtHead); + void insertDbgRecord(DbgRecord *New, bool InsertAtHead); /// Insert a DPValue prior to a DPValue contained within this marker. - void insertDPValue(DbgRecord *New, DbgRecord *InsertBefore); + void insertDbgRecord(DbgRecord *New, DbgRecord *InsertBefore); /// Insert a DPValue after a DPValue contained within this marker. - void insertDPValueAfter(DbgRecord *New, DbgRecord *InsertAfter); + void insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter); /// Clone all DPMarkers from \p From into this marker. There are numerous /// options to customise the source/destination, due to gnarliness, see class /// comment. @@ -606,11 +606,11 @@ public: std::optional<simple_ilist<DbgRecord>::iterator> FromHere, bool InsertAtHead = false); /// Erase all DPValues in this DPMarker. - void dropDbgValues(); + void dropDbgRecords(); /// Erase a single DbgRecord from this marker. In an ideal future, we would /// never erase an assignment in this way, but it's the equivalent to /// erasing a debug intrinsic from a block. - void dropOneDbgValue(DbgRecord *DR); + void dropOneDbgRecord(DbgRecord *DR); /// We generally act like all llvm Instructions have a range of DPValues /// attached to them, but in reality sometimes we don't allocate the DPMarker @@ -621,7 +621,7 @@ public: /// that. static DPMarker EmptyDPMarker; static iterator_range<simple_ilist<DbgRecord>::iterator> - getEmptyDPValueRange() { + getEmptyDbgRecordRange() { return make_range(EmptyDPMarker.StoredDPValues.end(), EmptyDPMarker.StoredDPValues.end()); } @@ -637,10 +637,10 @@ inline raw_ostream &operator<<(raw_ostream &OS, const DPMarker &Marker) { /// of DPMarker. Thus: it's pre-declared by users like Instruction, then an /// inlineable body defined here. inline iterator_range<simple_ilist<DbgRecord>::iterator> -getDbgValueRange(DPMarker *DbgMarker) { +getDbgRecordRange(DPMarker *DbgMarker) { if (!DbgMarker) - return DPMarker::getEmptyDPValueRange(); - return DbgMarker->getDbgValueRange(); + return DPMarker::getEmptyDbgRecordRange(); + return DbgMarker->getDbgRecordRange(); } } // namespace llvm diff --git a/llvm/include/llvm/IR/Instruction.h b/llvm/include/llvm/IR/Instruction.h index 75f399e..817abd6 100644 --- a/llvm/include/llvm/IR/Instruction.h +++ b/llvm/include/llvm/IR/Instruction.h @@ -41,7 +41,7 @@ template <> struct ilist_alloc_traits<Instruction> { static inline void deleteNode(Instruction *V); }; -iterator_range<simple_ilist<DbgRecord>::iterator> getDbgValueRange(DPMarker *); +iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange(DPMarker *); class Instruction : public User, public ilist_node_with_parent<Instruction, BasicBlock, @@ -79,29 +79,29 @@ public: bool InsertAtHead = false); /// Return a range over the DPValues attached to this instruction. - iterator_range<simple_ilist<DbgRecord>::iterator> getDbgValueRange() const { - return llvm::getDbgValueRange(DbgMarker); + iterator_range<simple_ilist<DbgRecord>::iterator> getDbgRecordRange() const { + return llvm::getDbgRecordRange(DbgMarker); } /// Return an iterator to the position of the "Next" DPValue after this /// instruction, or std::nullopt. This is the position to pass to - /// BasicBlock::reinsertInstInDPValues when re-inserting an instruction. + /// BasicBlock::reinsertInstInDbgRecords when re-inserting an instruction. std::optional<simple_ilist<DbgRecord>::iterator> getDbgReinsertionPosition(); /// Returns true if any DPValues are attached to this instruction. - bool hasDbgValues() const; + bool hasDbgRecords() const; /// Transfer any DPValues on the position \p It onto this instruction, /// by simply adopting the sequence of DPValues (which is efficient) if /// possible, by merging two sequences otherwise. - void adoptDbgValues(BasicBlock *BB, InstListType::iterator It, - bool InsertAtHead); + void adoptDbgRecords(BasicBlock *BB, InstListType::iterator It, + bool InsertAtHead); /// Erase any DPValues attached to this instruction. - void dropDbgValues(); + void dropDbgRecords(); /// Erase a single DPValue \p I that is attached to this instruction. - void dropOneDbgValue(DbgRecord *I); + void dropOneDbgRecord(DbgRecord *I); /// Handle the debug-info implications of this instruction being removed. Any /// attached DPValues need to "fall" down onto the next instruction. diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp index 78bcd94..2e0f5ba 100644 --- a/llvm/lib/AsmParser/LLParser.cpp +++ b/llvm/lib/AsmParser/LLParser.cpp @@ -6527,7 +6527,7 @@ bool LLParser::parseBasicBlock(PerFunctionState &PFS) { // Attach any preceding debug values to this instruction. for (DbgRecordPtr &DR : TrailingDbgRecord) - BB->insertDPValueBefore(DR.release(), Inst->getIterator()); + BB->insertDbgRecordBefore(DR.release(), Inst->getIterator()); TrailingDbgRecord.clear(); } while (!Inst->isTerminator()); diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp index 3b84624..a4b819a 100644 --- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp +++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp @@ -225,7 +225,7 @@ void FunctionVarLocs::init(FunctionVarLocsBuilder &Builder) { // Any VarLocInfos attached to a DPValue should now be remapped to their // marker Instruction, in order of DPValue appearance and prior to any // VarLocInfos attached directly to that instruction. - for (const DPValue &DPV : DPValue::filter(I->getDbgValueRange())) { + for (const DPValue &DPV : DPValue::filter(I->getDbgRecordRange())) { // Even though DPV defines a variable location, VarLocsBeforeInst can // still be empty if that VarLoc was redundant. if (!Builder.VarLocsBeforeInst.count(&DPV)) @@ -829,7 +829,7 @@ class MemLocFragmentFill { void process(BasicBlock &BB, VarFragMap &LiveSet) { BBInsertBeforeMap[&BB].clear(); for (auto &I : BB) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { if (const auto *Locs = FnVarLocs->getWedge(&DPV)) { for (const VarLocInfo &Loc : *Locs) { addDef(Loc, &DPV, *I.getParent(), LiveSet); @@ -1494,15 +1494,15 @@ const char *locStr(AssignmentTrackingLowering::LocKind Loc) { VarLocInsertPt getNextNode(const DbgRecord *DPV) { auto NextIt = ++(DPV->getIterator()); - if (NextIt == DPV->getMarker()->getDbgValueRange().end()) + if (NextIt == DPV->getMarker()->getDbgRecordRange().end()) return DPV->getMarker()->MarkedInstr; return &*NextIt; } VarLocInsertPt getNextNode(const Instruction *Inst) { const Instruction *Next = Inst->getNextNode(); - if (!Next->hasDbgValues()) + if (!Next->hasDbgRecords()) return Next; - return &*Next->getDbgValueRange().begin(); + return &*Next->getDbgRecordRange().begin(); } VarLocInsertPt getNextNode(VarLocInsertPt InsertPt) { if (isa<const Instruction *>(InsertPt)) @@ -1888,7 +1888,7 @@ void AssignmentTrackingLowering::resetInsertionPoint(DPValue &After) { void AssignmentTrackingLowering::process(BasicBlock &BB, BlockInfo *LiveSet) { // If the block starts with DPValues, we need to process those DPValues as // their own frame without processing any instructions first. - bool ProcessedLeadingDPValues = !BB.begin()->hasDbgValues(); + bool ProcessedLeadingDPValues = !BB.begin()->hasDbgRecords(); for (auto II = BB.begin(), EI = BB.end(); II != EI;) { assert(VarsTouchedThisFrame.empty()); // Process the instructions in "frames". A "frame" includes a single @@ -1914,11 +1914,11 @@ void AssignmentTrackingLowering::process(BasicBlock &BB, BlockInfo *LiveSet) { // II is now either a debug intrinsic, a non-debug instruction with no // attached DPValues, or a non-debug instruction with attached unprocessed // DPValues. - if (II != EI && II->hasDbgValues()) { + if (II != EI && II->hasDbgRecords()) { // Skip over non-variable debug records (i.e., labels). They're going to // be read from IR (possibly re-ordering them within the debug record // range) rather than from the analysis results. - for (DPValue &DPV : DPValue::filter(II->getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(II->getDbgRecordRange())) { resetInsertionPoint(DPV); processDPValue(DPV, LiveSet); assert(LiveSet->isValid()); @@ -2175,7 +2175,7 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares( }; for (auto &BB : Fn) { for (auto &I : BB) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) ProcessDbgRecord(&DPV, DPDeclares); if (auto *DII = dyn_cast<DbgVariableIntrinsic>(&I)) { ProcessDbgRecord(DII, InstDeclares); @@ -2465,7 +2465,7 @@ bool AssignmentTrackingLowering::emitPromotedVarLocs( for (auto &BB : Fn) { for (auto &I : BB) { // Skip instructions other than dbg.values and dbg.assigns. - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) if (DPV.isDbgValue() || DPV.isDbgAssign()) TranslateDbgRecord(&DPV); auto *DVI = dyn_cast<DbgValueInst>(&I); @@ -2567,7 +2567,7 @@ removeRedundantDbgLocsUsingBackwardScan(const BasicBlock *BB, } }; HandleLocsForWedge(&I); - for (DPValue &DPV : reverse(DPValue::filter(I.getDbgValueRange()))) + for (DPValue &DPV : reverse(DPValue::filter(I.getDbgRecordRange()))) HandleLocsForWedge(&DPV); } @@ -2632,7 +2632,7 @@ removeRedundantDbgLocsUsingForwardScan(const BasicBlock *BB, } }; - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) HandleLocsForWedge(&DPV); HandleLocsForWedge(&I); } @@ -2718,7 +2718,7 @@ removeUndefDbgLocsFromEntryBlock(const BasicBlock *BB, Changed = true; } }; - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) HandleLocsForWedge(&DPV); HandleLocsForWedge(&I); } diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp index 36f6cc8..59a0c64 100644 --- a/llvm/lib/CodeGen/CodeGenPrepare.cpp +++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp @@ -2983,7 +2983,7 @@ class TypePromotionTransaction { Inst->insertBefore(*Point.BB, Position); } - Inst->getParent()->reinsertInstInDPValues(Inst, BeforeDPValue); + Inst->getParent()->reinsertInstInDbgRecords(Inst, BeforeDPValue); } }; @@ -8506,7 +8506,7 @@ bool CodeGenPrepare::fixupDbgValue(Instruction *I) { bool CodeGenPrepare::fixupDPValuesOnInst(Instruction &I) { bool AnyChange = false; - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) AnyChange |= fixupDPValue(DPV); return AnyChange; } @@ -8550,9 +8550,9 @@ static void DbgInserterHelper(DPValue *DPV, Instruction *VI) { DPV->removeFromParent(); BasicBlock *VIBB = VI->getParent(); if (isa<PHINode>(VI)) - VIBB->insertDPValueBefore(DPV, VIBB->getFirstInsertionPt()); + VIBB->insertDbgRecordBefore(DPV, VIBB->getFirstInsertionPt()); else - VIBB->insertDPValueAfter(DPV, VI); + VIBB->insertDbgRecordAfter(DPV, VI); } // A llvm.dbg.value may be using a value before its definition, due to @@ -8620,7 +8620,7 @@ bool CodeGenPrepare::placeDbgValues(Function &F) { // If this isn't a dbg.value, process any attached DPValue records // attached to this instruction. for (DPValue &DPV : llvm::make_early_inc_range( - DPValue::filter(Insn.getDbgValueRange()))) { + DPValue::filter(Insn.getDbgRecordRange()))) { if (DPV.Type != DPValue::LocationType::Value) continue; DbgProcessor(&DPV, &Insn); diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp index 365870f..94fdb37e 100644 --- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp +++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp @@ -3277,7 +3277,7 @@ void IRTranslator::translateDbgDeclareRecord(Value *Address, bool HasArgList, void IRTranslator::translateDbgInfo(const Instruction &Inst, MachineIRBuilder &MIRBuilder) { - for (DbgRecord &DR : Inst.getDbgValueRange()) { + for (DbgRecord &DR : Inst.getDbgRecordRange()) { if (DPLabel *DPL = dyn_cast<DPLabel>(&DR)) { MIRBuilder.setDebugLoc(DPL->getDebugLoc()); assert(DPL->getLabel() && "Missing label"); diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp index 5609f48..40898d2 100644 --- a/llvm/lib/CodeGen/SelectOptimize.cpp +++ b/llvm/lib/CodeGen/SelectOptimize.cpp @@ -648,10 +648,10 @@ void SelectOptimizeImpl::convertProfitableSIGroups(SelectGroups &ProfSIGroups) { // Duplicate implementation for DPValues, the non-instruction debug-info // record. Helper lambda for moving DPValues to the end block. auto TransferDPValues = [&](Instruction &I) { - for (auto &DPValue : llvm::make_early_inc_range(I.getDbgValueRange())) { + for (auto &DPValue : llvm::make_early_inc_range(I.getDbgRecordRange())) { DPValue.removeFromParent(); - EndBlock->insertDPValueBefore(&DPValue, - EndBlock->getFirstInsertionPt()); + EndBlock->insertDbgRecordBefore(&DPValue, + EndBlock->getFirstInsertionPt()); } }; diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp index 246762d..cce91db 100644 --- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp @@ -1181,14 +1181,14 @@ bool FastISel::selectCall(const User *I) { } void FastISel::handleDbgInfo(const Instruction *II) { - if (!II->hasDbgValues()) + if (!II->hasDbgRecords()) return; // Clear any metadata. MIMD = MIMetadata(); // Reverse order of debug records, because fast-isel walks through backwards. - for (DbgRecord &DR : llvm::reverse(II->getDbgValueRange())) { + for (DbgRecord &DR : llvm::reverse(II->getDbgRecordRange())) { flushLocalValueMap(); recomputeInsertPt(); diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp index 22e57d0..b6a35f7 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp @@ -1255,7 +1255,7 @@ void SelectionDAGBuilder::visitDbgInfo(const Instruction &I) { bool SkipDPValues = DAG.getFunctionVarLocs(); // Is there is any debug-info attached to this instruction, in the form of // DbgRecord non-instruction debug-info records. - for (DbgRecord &DR : I.getDbgValueRange()) { + for (DbgRecord &DR : I.getDbgRecordRange()) { if (DPLabel *DPL = dyn_cast<DPLabel>(&DR)) { assert(DPL->getLabel() && "Missing label"); SDDbgLabel *SDV = diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp index 1c14e4d..c78c3ed 100644 --- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp +++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp @@ -1461,7 +1461,7 @@ static void processDbgDeclares(FunctionLoweringInfo &FuncInfo) { if (DI && processDbgDeclare(FuncInfo, DI->getAddress(), DI->getExpression(), DI->getVariable(), DI->getDebugLoc())) FuncInfo.PreprocessedDbgDeclares.insert(DI); - for (const DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (const DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { if (DPV.Type == DPValue::LocationType::Declare && processDbgDeclare(FuncInfo, DPV.getVariableLocationOp(0), DPV.getExpression(), DPV.getVariable(), diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp index f2562c9..1beb4c0 100644 --- a/llvm/lib/IR/AsmWriter.cpp +++ b/llvm/lib/IR/AsmWriter.cpp @@ -1131,7 +1131,7 @@ void SlotTracker::processFunctionMetadata(const Function &F) { processGlobalObjectMetadata(F); for (auto &BB : F) { for (auto &I : BB) { - for (const DbgRecord &DR : I.getDbgValueRange()) + for (const DbgRecord &DR : I.getDbgRecordRange()) processDbgRecordMetadata(DR); processInstructionMetadata(I); } @@ -4097,7 +4097,7 @@ void AssemblyWriter::printBasicBlock(const BasicBlock *BB) { // Output all of the instructions in the basic block... for (const Instruction &I : *BB) { - for (const DbgRecord &DR : I.getDbgValueRange()) + for (const DbgRecord &DR : I.getDbgRecordRange()) printDbgRecordLine(DR); printInstructionLine(I); } diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp index 673e2f6..7ead7ce 100644 --- a/llvm/lib/IR/BasicBlock.cpp +++ b/llvm/lib/IR/BasicBlock.cpp @@ -52,11 +52,11 @@ DPMarker *BasicBlock::createMarker(InstListType::iterator It) { "Tried to create a marker in a non new debug-info block!"); if (It != end()) return createMarker(&*It); - DPMarker *DPM = getTrailingDPValues(); + DPMarker *DPM = getTrailingDbgRecords(); if (DPM) return DPM; DPM = new DPMarker(); - setTrailingDPValues(DPM); + setTrailingDbgRecords(DPM); return DPM; } @@ -91,7 +91,7 @@ void BasicBlock::convertToNewDbgValues() { DPMarker *Marker = I.DbgMarker; for (DbgRecord *DPV : DPVals) - Marker->insertDPValue(DPV, false); + Marker->insertDbgRecord(DPV, false); DPVals.clear(); } @@ -109,7 +109,7 @@ void BasicBlock::convertFromNewDbgValues() { continue; DPMarker &Marker = *Inst.DbgMarker; - for (DbgRecord &DR : Marker.getDbgValueRange()) + for (DbgRecord &DR : Marker.getDbgRecordRange()) InstList.insert(Inst.getIterator(), DR.createDebugIntrinsic(getModule(), nullptr)); @@ -119,7 +119,7 @@ void BasicBlock::convertFromNewDbgValues() { // Assume no trailing DPValues: we could technically create them at the end // of the block, after a terminator, but this would be non-cannonical and // indicates that something else is broken somewhere. - assert(!getTrailingDPValues()); + assert(!getTrailingDbgRecords()); } #ifndef NDEBUG @@ -711,7 +711,7 @@ void BasicBlock::flushTerminatorDbgValues() { return; // Are there any dangling DPValues? - DPMarker *TrailingDPValues = getTrailingDPValues(); + DPMarker *TrailingDPValues = getTrailingDbgRecords(); if (!TrailingDPValues) return; @@ -719,7 +719,7 @@ void BasicBlock::flushTerminatorDbgValues() { createMarker(Term); Term->DbgMarker->absorbDebugValues(*TrailingDPValues, false); TrailingDPValues->eraseFromParent(); - deleteTrailingDPValues(); + deleteTrailingDbgRecords(); } void BasicBlock::spliceDebugInfoEmptyBlock(BasicBlock::iterator Dest, @@ -754,13 +754,13 @@ void BasicBlock::spliceDebugInfoEmptyBlock(BasicBlock::iterator Dest, // occur when a block is optimised away and the terminator has been moved // somewhere else. if (Src->empty()) { - DPMarker *SrcTrailingDPValues = Src->getTrailingDPValues(); + DPMarker *SrcTrailingDPValues = Src->getTrailingDbgRecords(); if (!SrcTrailingDPValues) return; - Dest->adoptDbgValues(Src, Src->end(), InsertAtHead); - // adoptDbgValues should have released the trailing DPValues. - assert(!Src->getTrailingDPValues()); + Dest->adoptDbgRecords(Src, Src->end(), InsertAtHead); + // adoptDbgRecords should have released the trailing DPValues. + assert(!Src->getTrailingDbgRecords()); return; } @@ -771,7 +771,7 @@ void BasicBlock::spliceDebugInfoEmptyBlock(BasicBlock::iterator Dest, return; // Is there actually anything to transfer? - if (!First->hasDbgValues()) + if (!First->hasDbgRecords()) return; createMarker(Dest)->absorbDebugValues(*First->DbgMarker, InsertAtHead); @@ -817,16 +817,16 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src, // move the DPValues onto "First". They'll then be moved naturally in the // splice process. DPMarker *MoreDanglingDPValues = nullptr; - DPMarker *OurTrailingDPValues = getTrailingDPValues(); + DPMarker *OurTrailingDPValues = getTrailingDbgRecords(); if (Dest == end() && !Dest.getHeadBit() && OurTrailingDPValues) { // Are the "+" DPValues not supposed to move? If so, detach them // temporarily. - if (!First.getHeadBit() && First->hasDbgValues()) { + if (!First.getHeadBit() && First->hasDbgRecords()) { MoreDanglingDPValues = Src->getMarker(First); MoreDanglingDPValues->removeFromParent(); } - if (First->hasDbgValues()) { + if (First->hasDbgRecords()) { // Place them at the front, it would look like this: // Dest // | @@ -834,7 +834,7 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src, // Src-block: ~~~~~~~~++++B---B---B---B:::C // | | // First Last - First->adoptDbgValues(this, end(), true); + First->adoptDbgRecords(this, end(), true); } else { // No current marker, create one and absorb in. (FIXME: we can avoid an // allocation in the future). @@ -842,7 +842,7 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src, CurMarker->absorbDebugValues(*OurTrailingDPValues, false); OurTrailingDPValues->eraseFromParent(); } - deleteTrailingDPValues(); + deleteTrailingDbgRecords(); First.setHeadBit(true); } @@ -854,7 +854,7 @@ void BasicBlock::spliceDebugInfo(BasicBlock::iterator Dest, BasicBlock *Src, if (!MoreDanglingDPValues) return; - // FIXME: we could avoid an allocation here sometimes. (adoptDbgValues + // FIXME: we could avoid an allocation here sometimes. (adoptDbgRecords // requires an iterator). DPMarker *LastMarker = Src->createMarker(Last); LastMarker->absorbDebugValues(*MoreDanglingDPValues, true); @@ -946,11 +946,11 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, if (ReadFromTail && Src->getMarker(Last)) { DPMarker *FromLast = Src->getMarker(Last); if (LastIsEnd) { - Dest->adoptDbgValues(Src, Last, true); - // adoptDbgValues will release any trailers. - assert(!Src->getTrailingDPValues()); + Dest->adoptDbgRecords(Src, Last, true); + // adoptDbgRecords will release any trailers. + assert(!Src->getTrailingDbgRecords()); } else { - // FIXME: can we use adoptDbgValues here to reduce allocations? + // FIXME: can we use adoptDbgRecords here to reduce allocations? DPMarker *OntoDest = createMarker(Dest); OntoDest->absorbDebugValues(*FromLast, true); } @@ -959,9 +959,9 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, // If we're _not_ reading from the head of First, i.e. the "++++" DPValues, // move their markers onto Last. They remain in the Src block. No action // needed. - if (!ReadFromHead && First->hasDbgValues()) { + if (!ReadFromHead && First->hasDbgRecords()) { if (Last != Src->end()) { - Last->adoptDbgValues(Src, First, true); + Last->adoptDbgRecords(Src, First, true); } else { DPMarker *OntoLast = Src->createMarker(Last); DPMarker *FromFirst = Src->createMarker(First); @@ -990,11 +990,11 @@ void BasicBlock::spliceDebugInfoImpl(BasicBlock::iterator Dest, BasicBlock *Src, // any trailing debug-info at the end of the block would "normally" have // been pushed in front of "First". Move it there now. DPMarker *FirstMarker = getMarker(First); - DPMarker *TrailingDPValues = getTrailingDPValues(); + DPMarker *TrailingDPValues = getTrailingDbgRecords(); if (TrailingDPValues) { FirstMarker->absorbDebugValues(*TrailingDPValues, true); TrailingDPValues->eraseFromParent(); - deleteTrailingDPValues(); + deleteTrailingDbgRecords(); } } } @@ -1027,21 +1027,21 @@ void BasicBlock::splice(iterator Dest, BasicBlock *Src, iterator First, flushTerminatorDbgValues(); } -void BasicBlock::insertDPValueAfter(DbgRecord *DPV, Instruction *I) { +void BasicBlock::insertDbgRecordAfter(DbgRecord *DPV, Instruction *I) { assert(IsNewDbgInfoFormat); assert(I->getParent() == this); iterator NextIt = std::next(I->getIterator()); DPMarker *NextMarker = createMarker(NextIt); - NextMarker->insertDPValue(DPV, true); + NextMarker->insertDbgRecord(DPV, true); } -void BasicBlock::insertDPValueBefore(DbgRecord *DPV, - InstListType::iterator Where) { +void BasicBlock::insertDbgRecordBefore(DbgRecord *DPV, + InstListType::iterator Where) { assert(Where == end() || Where->getParent() == this); bool InsertAtHead = Where.getHeadBit(); DPMarker *M = createMarker(Where); - M->insertDPValue(DPV, InsertAtHead); + M->insertDbgRecord(DPV, InsertAtHead); } DPMarker *BasicBlock::getNextMarker(Instruction *I) { @@ -1050,13 +1050,13 @@ DPMarker *BasicBlock::getNextMarker(Instruction *I) { DPMarker *BasicBlock::getMarker(InstListType::iterator It) { if (It == end()) { - DPMarker *DPM = getTrailingDPValues(); + DPMarker *DPM = getTrailingDbgRecords(); return DPM; } return It->DbgMarker; } -void BasicBlock::reinsertInstInDPValues( +void BasicBlock::reinsertInstInDbgRecords( Instruction *I, std::optional<DPValue::self_iterator> Pos) { // "I" was originally removed from a position where it was // immediately in front of Pos. Any DPValues on that position then "fell down" @@ -1123,15 +1123,14 @@ void BasicBlock::validateInstrOrdering() const { } #endif -void BasicBlock::setTrailingDPValues(DPMarker *foo) { - getContext().pImpl->setTrailingDPValues(this, foo); +void BasicBlock::setTrailingDbgRecords(DPMarker *foo) { + getContext().pImpl->setTrailingDbgRecords(this, foo); } -DPMarker *BasicBlock::getTrailingDPValues() { - return getContext().pImpl->getTrailingDPValues(this); +DPMarker *BasicBlock::getTrailingDbgRecords() { + return getContext().pImpl->getTrailingDbgRecords(this); } -void BasicBlock::deleteTrailingDPValues() { - getContext().pImpl->deleteTrailingDPValues(this); +void BasicBlock::deleteTrailingDbgRecords() { + getContext().pImpl->deleteTrailingDbgRecords(this); } - diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp index c0643f6..c673abd8 100644 --- a/llvm/lib/IR/DIBuilder.cpp +++ b/llvm/lib/IR/DIBuilder.cpp @@ -1095,7 +1095,7 @@ void DIBuilder::insertDPValue(DPValue *DPV, BasicBlock *InsertBB, else if (InsertBB) InsertPt = InsertBB->end(); InsertPt.setHeadBit(InsertAtHead); - InsertBB->insertDPValueBefore(DPV, InsertPt); + InsertBB->insertDbgRecordBefore(DPV, InsertPt); } Instruction *DIBuilder::insertDbgIntrinsic(llvm::Function *IntrinsicFn, @@ -1137,9 +1137,9 @@ DbgInstPtr DIBuilder::insertLabel(DILabel *LabelInfo, const DILocation *DL, if (M.IsNewDbgInfoFormat) { DPLabel *DPL = new DPLabel(LabelInfo, DL); if (InsertBB && InsertBefore) - InsertBB->insertDPValueBefore(DPL, InsertBefore->getIterator()); + InsertBB->insertDbgRecordBefore(DPL, InsertBefore->getIterator()); else if (InsertBB) - InsertBB->insertDPValueBefore(DPL, InsertBB->end()); + InsertBB->insertDbgRecordBefore(DPL, InsertBB->end()); return DPL; } diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index 68fd244..e63b1e6 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -241,7 +241,7 @@ void DebugInfoFinder::processInstruction(const Module &M, if (auto DbgLoc = I.getDebugLoc()) processLocation(M, DbgLoc.get()); - for (const DbgRecord &DPR : I.getDbgValueRange()) + for (const DbgRecord &DPR : I.getDbgRecordRange()) processDbgRecord(M, DPR); } @@ -579,7 +579,7 @@ bool llvm::stripDebugInfo(Function &F) { // DIAssignID are debug info metadata primitives. I.setMetadata(LLVMContext::MD_DIAssignID, nullptr); } - I.dropDbgValues(); + I.dropDbgRecords(); } } return Changed; @@ -896,7 +896,7 @@ bool llvm::stripNonLineTableDebugInfo(Module &M) { I.setMetadata("heapallocsite", nullptr); // Strip any DPValues attached. - I.dropDbgValues(); + I.dropDbgRecords(); } } } @@ -1828,7 +1828,7 @@ void at::deleteAll(Function *F) { SmallVector<DPValue *, 12> DPToDelete; for (BasicBlock &BB : *F) { for (Instruction &I : BB) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) if (DPV.isDbgAssign()) DPToDelete.push_back(&DPV); if (auto *DAI = dyn_cast<DbgAssignIntrinsic>(&I)) @@ -2257,7 +2257,7 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) { }; for (auto &BB : F) { for (auto &I : BB) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { if (DPV.isDbgDeclare()) ProcessDeclare(&DPV, DPVDeclares); } diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp index 5ff1e8c..019b00c 100644 --- a/llvm/lib/IR/DebugProgramInstruction.cpp +++ b/llvm/lib/IR/DebugProgramInstruction.cpp @@ -218,7 +218,7 @@ DPValue *DPValue::createLinkedDPVAssign(Instruction *LinkedInstr, Value *Val, auto *NewDPVAssign = DPValue::createDPVAssign(Val, Variable, Expression, cast<DIAssignID>(Link), Address, AddressExpression, DI); - LinkedInstr->getParent()->insertDPValueAfter(NewDPVAssign, LinkedInstr); + LinkedInstr->getParent()->insertDbgRecordAfter(NewDPVAssign, LinkedInstr); return NewDPVAssign; } @@ -515,7 +515,7 @@ void DbgRecord::insertBefore(DbgRecord *InsertBefore) { assert(InsertBefore->getMarker() && "Cannot insert a DbgRecord before a DbgRecord that does not have a " "DPMarker!"); - InsertBefore->getMarker()->insertDPValue(this, InsertBefore); + InsertBefore->getMarker()->insertDbgRecord(this, InsertBefore); } void DbgRecord::insertAfter(DbgRecord *InsertAfter) { assert(!getMarker() && @@ -523,7 +523,7 @@ void DbgRecord::insertAfter(DbgRecord *InsertAfter) { assert(InsertAfter->getMarker() && "Cannot insert a DbgRecord after a DbgRecord that does not have a " "DPMarker!"); - InsertAfter->getMarker()->insertDPValueAfter(this, InsertAfter); + InsertAfter->getMarker()->insertDbgRecordAfter(this, InsertAfter); } void DbgRecord::moveBefore(DbgRecord *MoveBefore) { assert(getMarker() && @@ -544,7 +544,7 @@ void DbgRecord::moveAfter(DbgRecord *MoveAfter) { // DPValues. DPMarker DPMarker::EmptyDPMarker; -void DPMarker::dropDbgValues() { +void DPMarker::dropDbgRecords() { while (!StoredDPValues.empty()) { auto It = StoredDPValues.begin(); DbgRecord *DR = &*It; @@ -553,7 +553,7 @@ void DPMarker::dropDbgValues() { } } -void DPMarker::dropOneDbgValue(DbgRecord *DR) { +void DPMarker::dropOneDbgRecord(DbgRecord *DR) { assert(DR->getMarker() == this); StoredDPValues.erase(DR->getIterator()); DR->deleteRecord(); @@ -587,7 +587,7 @@ void DPMarker::removeMarker() { // marker becomes the trailing marker of a degenerate block. BasicBlock::iterator NextIt = std::next(Owner->getIterator()); if (NextIt == getParent()->end()) { - getParent()->setTrailingDPValues(this); + getParent()->setTrailingDbgRecords(this); MarkedInstr = nullptr; } else { NextIt->DbgMarker = this; @@ -605,15 +605,15 @@ void DPMarker::removeFromParent() { void DPMarker::eraseFromParent() { if (MarkedInstr) removeFromParent(); - dropDbgValues(); + dropDbgRecords(); delete this; } -iterator_range<DbgRecord::self_iterator> DPMarker::getDbgValueRange() { +iterator_range<DbgRecord::self_iterator> DPMarker::getDbgRecordRange() { return make_range(StoredDPValues.begin(), StoredDPValues.end()); } iterator_range<DbgRecord::const_self_iterator> -DPMarker::getDbgValueRange() const { +DPMarker::getDbgRecordRange() const { return make_range(StoredDPValues.begin(), StoredDPValues.end()); } @@ -627,18 +627,18 @@ void DbgRecord::eraseFromParent() { deleteRecord(); } -void DPMarker::insertDPValue(DbgRecord *New, bool InsertAtHead) { +void DPMarker::insertDbgRecord(DbgRecord *New, bool InsertAtHead) { auto It = InsertAtHead ? StoredDPValues.begin() : StoredDPValues.end(); StoredDPValues.insert(It, *New); New->setMarker(this); } -void DPMarker::insertDPValue(DbgRecord *New, DbgRecord *InsertBefore) { +void DPMarker::insertDbgRecord(DbgRecord *New, DbgRecord *InsertBefore) { assert(InsertBefore->getMarker() == this && "DPValue 'InsertBefore' must be contained in this DPMarker!"); StoredDPValues.insert(InsertBefore->getIterator(), *New); New->setMarker(this); } -void DPMarker::insertDPValueAfter(DbgRecord *New, DbgRecord *InsertAfter) { +void DPMarker::insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter) { assert(InsertAfter->getMarker() == this && "DPValue 'InsertAfter' must be contained in this DPMarker!"); StoredDPValues.insert(++(InsertAfter->getIterator()), *New); diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp index 6b8c6e0..e089239 100644 --- a/llvm/lib/IR/Instruction.cpp +++ b/llvm/lib/IR/Instruction.cpp @@ -161,7 +161,7 @@ void Instruction::insertBefore(BasicBlock &BB, // maintenence code that you intend the PHI to be ahead of everything, // including any debug-info. assert(!isa<PHINode>(this) && "Inserting PHI after debug-records!"); - adoptDbgValues(&BB, InsertPos, false); + adoptDbgRecords(&BB, InsertPos, false); } } @@ -232,7 +232,7 @@ void Instruction::moveBeforeImpl(BasicBlock &BB, InstListType::iterator I, // If we're inserting at point I, and not in front of the DPValues attached // there, then we should absorb the DPValues attached to I. if (!InsertAtHead && NextMarker && !NextMarker->empty()) { - adoptDbgValues(&BB, I, false); + adoptDbgRecords(&BB, I, false); } } @@ -244,7 +244,7 @@ iterator_range<DbgRecord::self_iterator> Instruction::cloneDebugInfoFrom( const Instruction *From, std::optional<DbgRecord::self_iterator> FromHere, bool InsertAtHead) { if (!From->DbgMarker) - return DPMarker::getEmptyDPValueRange(); + return DPMarker::getEmptyDbgRecordRange(); assert(getParent()->IsNewDbgInfoFormat); assert(getParent()->IsNewDbgInfoFormat == @@ -270,15 +270,15 @@ Instruction::getDbgReinsertionPosition() { return NextMarker->StoredDPValues.begin(); } -bool Instruction::hasDbgValues() const { return !getDbgValueRange().empty(); } +bool Instruction::hasDbgRecords() const { return !getDbgRecordRange().empty(); } -void Instruction::adoptDbgValues(BasicBlock *BB, BasicBlock::iterator It, - bool InsertAtHead) { +void Instruction::adoptDbgRecords(BasicBlock *BB, BasicBlock::iterator It, + bool InsertAtHead) { DPMarker *SrcMarker = BB->getMarker(It); auto ReleaseTrailingDPValues = [BB, It, SrcMarker]() { if (BB->end() == It) { SrcMarker->eraseFromParent(); - BB->deleteTrailingDPValues(); + BB->deleteTrailingDbgRecords(); } }; @@ -314,13 +314,13 @@ void Instruction::adoptDbgValues(BasicBlock *BB, BasicBlock::iterator It, } } -void Instruction::dropDbgValues() { +void Instruction::dropDbgRecords() { if (DbgMarker) - DbgMarker->dropDbgValues(); + DbgMarker->dropDbgRecords(); } -void Instruction::dropOneDbgValue(DbgRecord *DPV) { - DbgMarker->dropOneDbgValue(DPV); +void Instruction::dropOneDbgRecord(DbgRecord *DPV) { + DbgMarker->dropOneDbgRecord(DPV); } bool Instruction::comesBefore(const Instruction *Other) const { diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h index 547a02a..c841b28 100644 --- a/llvm/lib/IR/LLVMContextImpl.h +++ b/llvm/lib/IR/LLVMContextImpl.h @@ -1687,18 +1687,16 @@ public: SmallDenseMap<BasicBlock *, DPMarker *> TrailingDPValues; // Set, get and delete operations for TrailingDPValues. - void setTrailingDPValues(BasicBlock *B, DPMarker *M) { + void setTrailingDbgRecords(BasicBlock *B, DPMarker *M) { assert(!TrailingDPValues.count(B)); TrailingDPValues[B] = M; } - DPMarker *getTrailingDPValues(BasicBlock *B) { + DPMarker *getTrailingDbgRecords(BasicBlock *B) { return TrailingDPValues.lookup(B); } - void deleteTrailingDPValues(BasicBlock *B) { - TrailingDPValues.erase(B); - } + void deleteTrailingDbgRecords(BasicBlock *B) { TrailingDPValues.erase(B); } }; } // end namespace llvm diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 0e6c018..2b9dc74 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -682,9 +682,9 @@ void Verifier::visitDbgRecords(Instruction &I) { return; CheckDI(I.DbgMarker->MarkedInstr == &I, "Instruction has invalid DbgMarker", &I); - CheckDI(!isa<PHINode>(&I) || !I.hasDbgValues(), + CheckDI(!isa<PHINode>(&I) || !I.hasDbgRecords(), "PHI Node must not have any attached DbgRecords", &I); - for (DbgRecord &DR : I.getDbgValueRange()) { + for (DbgRecord &DR : I.getDbgRecordRange()) { CheckDI(DR.getMarker() == I.DbgMarker, "DbgRecord had invalid DbgMarker", &I, &DR); if (auto *Loc = @@ -3046,7 +3046,7 @@ void Verifier::visitBasicBlock(BasicBlock &BB) { // Confirm that no issues arise from the debug program. if (BB.IsNewDbgInfoFormat) - CheckDI(!BB.getTrailingDPValues(), "Basic Block has trailing DbgRecords!", + CheckDI(!BB.getTrailingDbgRecords(), "Basic Block has trailing DbgRecords!", &BB); } diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp index e091ecb..7c29d44 100644 --- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp @@ -1277,7 +1277,7 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape, FrameDIVar, DBuilder.createExpression(), DILoc, DPValue::LocationType::Declare); BasicBlock::iterator It = Shape.getInsertPtAfterFramePtr(); - It->getParent()->insertDPValueBefore(NewDPV, It); + It->getParent()->insertDbgRecordBefore(NewDPV, It); } else { DBuilder.insertDeclare(Shape.FramePtr, FrameDIVar, DBuilder.createExpression(), DILoc, @@ -1891,7 +1891,7 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) { new DPValue(ValueAsMetadata::get(CurrentReload), DDI->getVariable(), DDI->getExpression(), DDI->getDebugLoc(), DPValue::LocationType::Declare); - Builder.GetInsertPoint()->getParent()->insertDPValueBefore( + Builder.GetInsertPoint()->getParent()->insertDbgRecordBefore( NewDPV, Builder.GetInsertPoint()); } else { DIBuilder(*CurrentBlock->getParent()->getParent(), AllowUnresolved) @@ -1925,7 +1925,7 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) { U->replaceUsesOfWith(Def, CurrentReload); // Instructions are added to Def's user list if the attached // debug records use Def. Update those now. - for (DPValue &DPV : DPValue::filter(U->getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(U->getDbgRecordRange())) DPV.replaceVariableLocationOp(Def, CurrentReload, true); } } @@ -2996,7 +2996,7 @@ void coro::salvageDebugInfo( InsertPt = F->getEntryBlock().begin(); if (InsertPt) { DPV.removeFromParent(); - (*InsertPt)->getParent()->insertDPValueBefore(&DPV, *InsertPt); + (*InsertPt)->getParent()->insertDbgRecordBefore(&DPV, *InsertPt); } } } diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp index 58b95e4..086971a1f 100644 --- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp +++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp @@ -684,7 +684,7 @@ collectDbgVariableIntrinsics(Function &F) { SmallVector<DbgVariableIntrinsic *, 8> Intrinsics; SmallVector<DPValue *> DPValues; for (auto &I : instructions(F)) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) DPValues.push_back(&DPV); if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) Intrinsics.push_back(DVI); diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp index 03d4d50..37f4a87 100644 --- a/llvm/lib/Transforms/IPO/IROutliner.cpp +++ b/llvm/lib/Transforms/IPO/IROutliner.cpp @@ -725,7 +725,7 @@ static void moveFunctionData(Function &Old, Function &New, // program, it will cause incorrect reporting from a debugger if we keep // the same debug instructions. Drop non-intrinsic DPValues here, // collect intrinsics for removal later. - Val.dropDbgValues(); + Val.dropDbgRecords(); // We must handle the scoping of called functions differently than // other outlined instructions. diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp index 591be6b..ed5352e 100644 --- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp +++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp @@ -643,7 +643,7 @@ void MergeFunctions::filterInstsUnrelatedToPDI( BI != BIE; ++BI) { // Examine DPValues as they happen "before" the instruction. Are they // connected to parameters? - for (DPValue &DPV : DPValue::filter(BI->getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(BI->getDbgRecordRange())) { if (DPV.isDbgValue() || DPV.isDbgAssign()) { ExamineDbgValue(&DPV, PDPVRelated); } else { @@ -686,7 +686,7 @@ void MergeFunctions::filterInstsUnrelatedToPDI( // Collect the set of unrelated instructions and debug records. for (Instruction &I : *GEntryBlock) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) IsPDIRelated(&DPV, PDPVRelated, PDPVUnrelatedWL); IsPDIRelated(&I, PDIRelated, PDIUnrelatedWL); } diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp index 1a83180..1688005 100644 --- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp +++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp @@ -3426,7 +3426,7 @@ void InstCombinerImpl::handleUnreachableFrom( if (Inst.isEHPad() || Inst.getType()->isTokenTy()) continue; // RemoveDIs: erase debug-info on this instruction manually. - Inst.dropDbgValues(); + Inst.dropDbgRecords(); eraseInstFromFunction(Inst); MadeIRChange = true; } @@ -4697,7 +4697,7 @@ void InstCombinerImpl::tryToSinkInstructionDPValues( // latest assignment. for (const Instruction *Inst : DupSet) { for (DPValue &DPV : - llvm::reverse(DPValue::filter(Inst->getDbgValueRange()))) { + llvm::reverse(DPValue::filter(Inst->getDbgRecordRange()))) { DebugVariable DbgUserVariable = DebugVariable(DPV.getVariable(), DPV.getExpression(), DPV.getDebugLoc()->getInlinedAt()); @@ -4762,7 +4762,7 @@ void InstCombinerImpl::tryToSinkInstructionDPValues( // InsertPtInst assert(InsertPos.getHeadBit()); for (DPValue *DPVClone : DPVClones) { - InsertPos->getParent()->insertDPValueBefore(DPVClone, InsertPos); + InsertPos->getParent()->insertDbgRecordBefore(DPVClone, InsertPos); LLVM_DEBUG(dbgs() << "SINK: " << *DPVClone << '\n'); } } diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp index 95a9527..4d90131 100644 --- a/llvm/lib/Transforms/Scalar/ADCE.cpp +++ b/llvm/lib/Transforms/Scalar/ADCE.cpp @@ -548,7 +548,7 @@ ADCEChanged AggressiveDeadCodeElimination::removeDeadInstructions() { // attached to this instruction, and drop any for scopes that aren't alive, // like the rest of this loop does. Extending support to assignment tracking // is future work. - for (DbgRecord &DR : make_early_inc_range(I.getDbgValueRange())) { + for (DbgRecord &DR : make_early_inc_range(I.getDbgRecordRange())) { // Avoid removing a DPV that is linked to instructions because it holds // information about an existing store. if (DPValue *DPV = dyn_cast<DPValue>(&DR); DPV && DPV->isDbgAssign()) @@ -556,7 +556,7 @@ ADCEChanged AggressiveDeadCodeElimination::removeDeadInstructions() { continue; if (AliveScopes.count(DR.getDebugLoc()->getScope())) continue; - I.dropOneDbgValue(&DR); + I.dropOneDbgRecord(&DR); } // Check if the instruction is alive. diff --git a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp index 47f663f..b8571ba 100644 --- a/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp +++ b/llvm/lib/Transforms/Scalar/CallSiteSplitting.cpp @@ -403,7 +403,7 @@ static void splitCallSite(CallBase &CB, NewPN->insertBefore(*TailBB, TailBB->begin()); CurrentI->replaceAllUsesWith(NewPN); } - CurrentI->dropDbgValues(); + CurrentI->dropDbgRecords(); CurrentI->eraseFromParent(); // We are done once we handled the first original instruction in TailBB. if (CurrentI == OriginalBeginInst) diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp index 221b122c..1058a01 100644 --- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp +++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp @@ -401,7 +401,7 @@ static bool replaceFoldableUses(Instruction *Cond, Value *ToVal, Changed |= replaceNonLocalUsesWith(Cond, ToVal); for (Instruction &I : reverse(*KnownAtEndOfBB)) { // Replace any debug-info record users of Cond with ToVal. - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) DPV.replaceVariableLocationOp(Cond, ToVal, true); // Reached the Cond whose uses we are trying to replace, so there are no @@ -2111,7 +2111,7 @@ JumpThreadingPass::cloneInstructions(BasicBlock::iterator BI, // There may be DPValues on the terminator, clone directly from marker // to marker as there isn't an instruction there. - if (BE != RangeBB->end() && BE->hasDbgValues()) { + if (BE != RangeBB->end() && BE->hasDbgRecords()) { // Dump them at the end. DPMarker *Marker = RangeBB->getMarker(BE); DPMarker *EndMarker = NewBB->createMarker(NewBB->end()); @@ -3118,7 +3118,7 @@ bool JumpThreadingPass::threadGuard(BasicBlock *BB, IntrinsicInst *Guard, NewPN->insertBefore(InsertionPoint); Inst->replaceAllUsesWith(NewPN); } - Inst->dropDbgValues(); + Inst->dropDbgRecords(); Inst->eraseFromParent(); } return true; diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index 4238098..8b078dd 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -6711,7 +6711,7 @@ static void DbgGatherSalvagableDVI( SalvageableDVISCEVs.push_back(std::move(NewRec)); return true; }; - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { if (DPV.isDbgValue() || DPV.isDbgAssign()) ProcessDbgValue(&DPV); } diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp index 190fee1..e238f31 100644 --- a/llvm/lib/Transforms/Scalar/SROA.cpp +++ b/llvm/lib/Transforms/Scalar/SROA.cpp @@ -5041,8 +5041,8 @@ static void insertNewDbgInst(DIBuilder &DIB, DPValue *Orig, AllocaInst *NewAddr, if (Orig->isDbgDeclare()) { DPValue *DPV = DPValue::createDPVDeclare( NewAddr, Orig->getVariable(), NewFragmentExpr, Orig->getDebugLoc()); - BeforeInst->getParent()->insertDPValueBefore(DPV, - BeforeInst->getIterator()); + BeforeInst->getParent()->insertDbgRecordBefore(DPV, + BeforeInst->getIterator()); return; } if (!NewAddr->hasMetadata(LLVMContext::MD_DIAssignID)) { diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp index 3d14608..9fcaf2a 100644 --- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp +++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp @@ -1260,7 +1260,7 @@ static BasicBlock *buildClonedLoopBlocks( Module *M = ClonedPH->getParent()->getParent(); for (auto *ClonedBB : NewBlocks) for (Instruction &I : *ClonedBB) { - RemapDPValueRange(M, I.getDbgValueRange(), VMap, + RemapDPValueRange(M, I.getDbgRecordRange(), VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); RemapInstruction(&I, VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); diff --git a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp index 260f31b..8686570 100644 --- a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp +++ b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp @@ -293,7 +293,7 @@ bool SpeculativeExecutionPass::considerHoistingFromTo( for (const auto &I : FromBlock) { // Make note of any DPValues that need hoisting. DPLabels // get left behind just like llvm.dbg.labels. - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { if (HasNoUnhoistedInstr(DPV.location_ops())) DPValuesToHoist[DPV.getInstruction()].push_back(&DPV); } @@ -320,8 +320,8 @@ bool SpeculativeExecutionPass::considerHoistingFromTo( if (DPValuesToHoist.contains(&*I)) { for (auto *DPV : DPValuesToHoist[&*I]) { DPV->removeFromParent(); - ToBlock.insertDPValueBefore(DPV, - ToBlock.getTerminator()->getIterator()); + ToBlock.insertDbgRecordBefore(DPV, + ToBlock.getTerminator()->getIterator()); } } // We have to increment I before moving Current as moving Current diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp index 5aa59ac..2006b40 100644 --- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp +++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp @@ -386,7 +386,7 @@ static bool DPValuesRemoveRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) { SmallVector<DPValue *, 8> ToBeRemoved; SmallDenseSet<DebugVariable> VariableSet; for (auto &I : reverse(*BB)) { - for (DbgRecord &DR : reverse(I.getDbgValueRange())) { + for (DbgRecord &DR : reverse(I.getDbgRecordRange())) { if (isa<DPLabel>(DR)) { // Emulate existing behaviour (see comment below for dbg.declares). // FIXME: Don't do this. @@ -504,7 +504,7 @@ static bool DPValuesRemoveRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) { DenseMap<DebugVariable, std::pair<SmallVector<Value *, 4>, DIExpression *>> VariableMap; for (auto &I : *BB) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { if (DPV.getType() == DPValue::LocationType::Declare) continue; DebugVariable Key(DPV.getVariable(), std::nullopt, @@ -553,7 +553,7 @@ static bool DPValuesRemoveUndefDbgAssignsFromEntryBlock(BasicBlock *BB) { // Remove undef dbg.assign intrinsics that are encountered before // any non-undef intrinsics from the entry block. for (auto &I : *BB) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { if (!DPV.isDbgValue() && !DPV.isDbgAssign()) continue; bool IsDbgValueKind = diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp index c0f3333..6931d19 100644 --- a/llvm/lib/Transforms/Utils/CloneFunction.cpp +++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp @@ -276,7 +276,7 @@ void llvm::CloneFunctionInto(Function *NewFunc, const Function *OldFunc, // attached debug-info records. for (Instruction &II : *BB) { RemapInstruction(&II, VMap, RemapFlag, TypeMapper, Materializer); - RemapDPValueRange(II.getModule(), II.getDbgValueRange(), VMap, RemapFlag, + RemapDPValueRange(II.getModule(), II.getDbgRecordRange(), VMap, RemapFlag, TypeMapper, Materializer); } @@ -889,7 +889,7 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc, Function::iterator Begin = cast<BasicBlock>(VMap[StartingBB])->getIterator(); for (BasicBlock &BB : make_range(Begin, NewFunc->end())) { for (Instruction &I : BB) { - RemapDPValueRange(I.getModule(), I.getDbgValueRange(), VMap, + RemapDPValueRange(I.getModule(), I.getDbgRecordRange(), VMap, ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges, TypeMapper, Materializer); } @@ -990,7 +990,7 @@ void llvm::remapInstructionsInBlocks(ArrayRef<BasicBlock *> Blocks, // Rewrite the code to refer to itself. for (auto *BB : Blocks) { for (auto &Inst : *BB) { - RemapDPValueRange(Inst.getModule(), Inst.getDbgValueRange(), VMap, + RemapDPValueRange(Inst.getModule(), Inst.getDbgRecordRange(), VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); RemapInstruction(&Inst, VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); diff --git a/llvm/lib/Transforms/Utils/CodeExtractor.cpp b/llvm/lib/Transforms/Utils/CodeExtractor.cpp index ab2d25c..0fac5fc 100644 --- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp +++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp @@ -1602,7 +1602,7 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc, }; auto UpdateDbgRecordsOnInst = [&](Instruction &I) -> void { - for (DbgRecord &DR : I.getDbgValueRange()) { + for (DbgRecord &DR : I.getDbgRecordRange()) { if (DPLabel *DPL = dyn_cast<DPLabel>(&DR)) { UpdateDbgLabel(DPL); continue; @@ -1659,7 +1659,7 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc, for (auto *DII : DebugIntrinsicsToDelete) DII->eraseFromParent(); for (auto *DPV : DPVsToDelete) - DPV->getMarker()->MarkedInstr->dropOneDbgValue(DPV); + DPV->getMarker()->MarkedInstr->dropOneDbgRecord(DPV); DIB.finalizeSubprogram(NewSP); // Fix up the scope information attached to the line locations in the new @@ -1668,7 +1668,7 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc, if (const DebugLoc &DL = I.getDebugLoc()) I.setDebugLoc( DebugLoc::replaceInlinedAtSubprogram(DL, *NewSP, Ctx, Cache)); - for (DbgRecord &DR : I.getDbgValueRange()) + for (DbgRecord &DR : I.getDbgRecordRange()) DR.setDebugLoc(DebugLoc::replaceInlinedAtSubprogram(DR.getDebugLoc(), *NewSP, Ctx, Cache)); diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp index 0e8e726..1bbe76a 100644 --- a/llvm/lib/Transforms/Utils/InlineFunction.cpp +++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp @@ -1728,7 +1728,7 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI, for (BasicBlock::iterator BI = FI->begin(), BE = FI->end(); BI != BE; ++BI) { UpdateInst(*BI); - for (DbgRecord &DPV : BI->getDbgValueRange()) { + for (DbgRecord &DPV : BI->getDbgRecordRange()) { UpdateDPV(&DPV); } } @@ -1741,7 +1741,7 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI, BI = BI->eraseFromParent(); continue; } else { - BI->dropDbgValues(); + BI->dropDbgRecords(); } ++BI; } @@ -1829,7 +1829,7 @@ static void fixupAssignments(Function::iterator Start, Function::iterator End) { // attachment or use, replace it with a new version. for (auto BBI = Start; BBI != End; ++BBI) { for (Instruction &I : *BBI) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { if (DPV.isDbgAssign()) DPV.setAssignId(GetNewID(DPV.getAssignID())); } diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp index a44536e..7b74caa 100644 --- a/llvm/lib/Transforms/Utils/Local.cpp +++ b/llvm/lib/Transforms/Utils/Local.cpp @@ -1657,7 +1657,7 @@ static void insertDbgValueOrDPValue(DIBuilder &Builder, Value *DV, // DPValue directly instead of a dbg.value intrinsic. ValueAsMetadata *DVAM = ValueAsMetadata::get(DV); DPValue *DV = new DPValue(DVAM, DIVar, DIExpr, NewLoc.get()); - Instr->getParent()->insertDPValueBefore(DV, Instr); + Instr->getParent()->insertDbgRecordBefore(DV, Instr); } } @@ -1675,7 +1675,7 @@ static void insertDbgValueOrDPValueAfter(DIBuilder &Builder, Value *DV, // DPValue directly instead of a dbg.value intrinsic. ValueAsMetadata *DVAM = ValueAsMetadata::get(DV); DPValue *DV = new DPValue(DVAM, DIVar, DIExpr, NewLoc.get()); - Instr->getParent()->insertDPValueAfter(DV, &*Instr); + Instr->getParent()->insertDbgRecordAfter(DV, &*Instr); } } @@ -1794,7 +1794,7 @@ void llvm::ConvertDebugDeclareToDebugValue(DPValue *DPV, StoreInst *SI, DV = UndefValue::get(DV->getType()); ValueAsMetadata *DVAM = ValueAsMetadata::get(DV); DPValue *NewDPV = new DPValue(DVAM, DIVar, DIExpr, NewLoc.get()); - SI->getParent()->insertDPValueBefore(NewDPV, SI->getIterator()); + SI->getParent()->insertDbgRecordBefore(NewDPV, SI->getIterator()); } /// Inserts a llvm.dbg.value intrinsic after a phi that has an associated @@ -1856,7 +1856,7 @@ void llvm::ConvertDebugDeclareToDebugValue(DPValue *DPV, LoadInst *LI, // Create a DPValue directly and insert. ValueAsMetadata *LIVAM = ValueAsMetadata::get(LI); DPValue *DV = new DPValue(LIVAM, DIVar, DIExpr, NewLoc.get()); - LI->getParent()->insertDPValueAfter(DV, LI); + LI->getParent()->insertDbgRecordAfter(DV, LI); } /// Determine whether this alloca is either a VLA or an array. @@ -1911,7 +1911,7 @@ bool llvm::LowerDbgDeclare(Function &F) { for (Instruction &BI : FI) { if (auto *DDI = dyn_cast<DbgDeclareInst>(&BI)) Dbgs.push_back(DDI); - for (DPValue &DPV : DPValue::filter(BI.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(BI.getDbgRecordRange())) { if (DPV.getType() == DPValue::LocationType::Declare) DPVs.push_back(&DPV); } @@ -1996,7 +1996,7 @@ static void insertDPValuesForPHIs(BasicBlock *BB, // Map existing PHI nodes to their DPValues. DenseMap<Value *, DPValue *> DbgValueMap; for (auto &I : *BB) { - for (DPValue &DPV : DPValue::filter(I.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(I.getDbgRecordRange())) { for (Value *V : DPV.location_ops()) if (auto *Loc = dyn_cast_or_null<PHINode>(V)) DbgValueMap.insert({Loc, &DPV}); @@ -2044,7 +2044,7 @@ static void insertDPValuesForPHIs(BasicBlock *BB, auto InsertionPt = Parent->getFirstInsertionPt(); assert(InsertionPt != Parent->end() && "Ill-formed basic block"); - Parent->insertDPValueBefore(NewDbgII, InsertionPt); + Parent->insertDbgRecordBefore(NewDbgII, InsertionPt); } } @@ -2620,7 +2620,7 @@ static bool rewriteDebugUsers( LLVM_DEBUG(dbgs() << "MOVE: " << *DPV << '\n'); DPV->removeFromParent(); // Ensure there's a marker. - DomPoint.getParent()->insertDPValueAfter(DPV, &DomPoint); + DomPoint.getParent()->insertDbgRecordAfter(DPV, &DomPoint); Changed = true; } else if (!DT.dominates(&DomPoint, MarkedInstr)) { UndefOrSalvageDPV.insert(DPV); @@ -2766,7 +2766,7 @@ bool llvm::handleUnreachableTerminator( Instruction *I, SmallVectorImpl<Value *> &PoisonedValues) { bool Changed = false; // RemoveDIs: erase debug-info on this instruction manually. - I->dropDbgValues(); + I->dropDbgRecords(); for (Use &U : I->operands()) { Value *Op = U.get(); if (isa<Instruction>(Op) && !Op->getType()->isTokenTy()) { @@ -2797,7 +2797,7 @@ llvm::removeAllNonTerminatorAndEHPadInstructions(BasicBlock *BB) { if (Inst->isEHPad() || Inst->getType()->isTokenTy()) { // EHPads can't have DPValues attached to them, but it might be possible // for things with token type. - Inst->dropDbgValues(); + Inst->dropDbgRecords(); EndInst = Inst; continue; } @@ -2806,7 +2806,7 @@ llvm::removeAllNonTerminatorAndEHPadInstructions(BasicBlock *BB) { else ++NumDeadInst; // RemoveDIs: erasing debug-info must be done manually. - Inst->dropDbgValues(); + Inst->dropDbgRecords(); Inst->eraseFromParent(); } return {NumDeadInst, NumDeadDbgInst}; @@ -3582,7 +3582,7 @@ void llvm::hoistAllInstructionsInto(BasicBlock *DomBlock, Instruction *InsertPt, if (I->isUsedByMetadata()) dropDebugUsers(*I); // RemoveDIs: drop debug-info too as the following code does. - I->dropDbgValues(); + I->dropDbgRecords(); if (I->isDebugOrPseudoInst()) { // Remove DbgInfo and pseudo probe Intrinsics. II = I->eraseFromParent(); diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp index cec4781..8c6af7a 100644 --- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp @@ -554,7 +554,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { DbgIntrinsics.insert(makeHash(DII)); // Until RemoveDIs supports dbg.declares in DPValue format, we'll need // to collect DPValues attached to any other debug intrinsics. - for (const DPValue &DPV : DPValue::filter(DII->getDbgValueRange())) + for (const DPValue &DPV : DPValue::filter(DII->getDbgRecordRange())) DbgIntrinsics.insert(makeHash(&DPV)); } else { break; @@ -564,7 +564,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { // Build DPValue hashes for DPValues attached to the terminator, which isn't // considered in the loop above. for (const DPValue &DPV : - DPValue::filter(OrigPreheader->getTerminator()->getDbgValueRange())) + DPValue::filter(OrigPreheader->getTerminator()->getDbgRecordRange())) DbgIntrinsics.insert(makeHash(&DPV)); // Remember the local noalias scope declarations in the header. After the @@ -599,7 +599,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { // (Stored as a range because it gives us a natural way of testing whether // there were DPValues on the next instruction before we hoisted things). iterator_range<DPValue::self_iterator> NextDbgInsts = - (I != E) ? I->getDbgValueRange() : DPMarker::getEmptyDPValueRange(); + (I != E) ? I->getDbgRecordRange() : DPMarker::getEmptyDbgRecordRange(); while (I != E) { Instruction *Inst = &*I++; @@ -636,7 +636,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { DPV.eraseFromParent(); } - NextDbgInsts = I->getDbgValueRange(); + NextDbgInsts = I->getDbgRecordRange(); Inst->moveBefore(LoopEntryBranch); @@ -655,7 +655,7 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) { auto Range = C->cloneDebugInfoFrom(Inst, NextDbgInsts.begin()); RemapDPValueRange(M, Range, ValueMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); - NextDbgInsts = DPMarker::getEmptyDPValueRange(); + NextDbgInsts = DPMarker::getEmptyDbgRecordRange(); // Erase anything we've seen before. for (DPValue &DPV : make_early_inc_range(DPValue::filter(Range))) if (DbgIntrinsics.count(makeHash(&DPV))) diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp index 650f055..ecd76b7 100644 --- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp +++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp @@ -917,7 +917,7 @@ bool llvm::UnrollRuntimeLoopRemainder( for (Instruction &I : *BB) { RemapInstruction(&I, VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); - RemapDPValueRange(M, I.getDbgValueRange(), VMap, + RemapDPValueRange(M, I.getDbgRecordRange(), VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); } } diff --git a/llvm/lib/Transforms/Utils/LoopUtils.cpp b/llvm/lib/Transforms/Utils/LoopUtils.cpp index 7491a99..05b02a4 100644 --- a/llvm/lib/Transforms/Utils/LoopUtils.cpp +++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp @@ -634,7 +634,7 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE, // RemoveDIs: do the same as below for DPValues. if (Block->IsNewDbgInfoFormat) { for (DPValue &DPV : llvm::make_early_inc_range( - DPValue::filter(I.getDbgValueRange()))) { + DPValue::filter(I.getDbgRecordRange()))) { DebugVariable Key(DPV.getVariable(), DPV.getExpression(), DPV.getDebugLoc().get()); if (!DeadDebugSet.insert(Key).second) @@ -677,7 +677,7 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE, // repeatedly inserted before the first instruction. To replicate this // behaviour, do it backwards. for (DPValue *DPV : llvm::reverse(DeadDPValues)) - ExitBlock->insertDPValueBefore(DPV, InsertDbgValueBefore); + ExitBlock->insertDbgRecordBefore(DPV, InsertDbgValueBefore); } // Remove the block from the reference counting scheme, so that we can diff --git a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp index bfe474d..ed06d3e 100644 --- a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp +++ b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp @@ -110,7 +110,7 @@ Instruction *getUntagLocationIfFunctionExit(Instruction &Inst) { void StackInfoBuilder::visit(Instruction &Inst) { // Visit non-intrinsic debug-info records attached to Inst. - for (DPValue &DPV : DPValue::filter(Inst.getDbgValueRange())) { + for (DPValue &DPV : DPValue::filter(Inst.getDbgRecordRange())) { auto AddIfInteresting = [&](Value *V) { if (auto *AI = dyn_cast_or_null<AllocaInst>(V)) { if (!isInterestingAlloca(*AI)) diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp index 5b9a38c..0f3d140 100644 --- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp +++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp @@ -1535,7 +1535,7 @@ static bool shouldHoistCommonInstructions(Instruction *I1, Instruction *I2, static void hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1, SmallVectorImpl<Instruction *> &OtherInsts) { - if (!I1->hasDbgValues()) + if (!I1->hasDbgRecords()) return; using CurrentAndEndIt = std::pair<DbgRecord::self_iterator, DbgRecord::self_iterator>; @@ -1557,12 +1557,12 @@ hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1, // Collect the iterators. Itrs.push_back( - {I1->getDbgValueRange().begin(), I1->getDbgValueRange().end()}); + {I1->getDbgRecordRange().begin(), I1->getDbgRecordRange().end()}); for (Instruction *Other : OtherInsts) { - if (!Other->hasDbgValues()) + if (!Other->hasDbgRecords()) return; Itrs.push_back( - {Other->getDbgValueRange().begin(), Other->getDbgValueRange().end()}); + {Other->getDbgRecordRange().begin(), Other->getDbgRecordRange().end()}); } // Iterate in lock-step until any of the DbgRecord lists are exausted. If @@ -1576,7 +1576,7 @@ hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1, DbgRecord &DR = *Pair.first++; if (HoistDPVs) { DR.removeFromParent(); - TI->getParent()->insertDPValueBefore(&DR, TI->getIterator()); + TI->getParent()->insertDbgRecordBefore(&DR, TI->getIterator()); } } } @@ -3207,10 +3207,10 @@ bool SimplifyCFGOpt::SpeculativelyExecuteBB(BranchInst *BI, // instructions, in the same way that dbg.value intrinsics are dropped at the // end of this block. for (auto &It : make_range(ThenBB->begin(), ThenBB->end())) - for (DbgRecord &DR : make_early_inc_range(It.getDbgValueRange())) + for (DbgRecord &DR : make_early_inc_range(It.getDbgRecordRange())) // Drop all records except assign-kind DPValues (dbg.assign equivalent). if (DPValue *DPV = dyn_cast<DPValue>(&DR); !DPV || !DPV->isDbgAssign()) - It.dropOneDbgValue(&DR); + It.dropOneDbgRecord(&DR); BB->splice(BI->getIterator(), ThenBB, ThenBB->begin(), std::prev(ThenBB->end())); @@ -3849,7 +3849,7 @@ static bool performBranchToCommonDestFolding(BranchInst *BI, BranchInst *PBI, if (PredBlock->IsNewDbgInfoFormat) { PredBlock->getTerminator()->cloneDebugInfoFrom(BB->getTerminator()); for (DPValue &DPV : - DPValue::filter(PredBlock->getTerminator()->getDbgValueRange())) { + DPValue::filter(PredBlock->getTerminator()->getDbgRecordRange())) { RemapDPValue(M, &DPV, VMap, RF_NoModuleLevelChanges | RF_IgnoreMissingLocals); } @@ -5308,7 +5308,7 @@ bool SimplifyCFGOpt::simplifyUnreachable(UnreachableInst *UI) { // Debug-info records on the unreachable inst itself should be deleted, as // below we delete everything past the final executable instruction. - UI->dropDbgValues(); + UI->dropDbgRecords(); // If there are any instructions immediately before the unreachable that can // be removed, do so. @@ -5328,7 +5328,7 @@ bool SimplifyCFGOpt::simplifyUnreachable(UnreachableInst *UI) { // If we're deleting this, we're deleting any subsequent dbg.values, so // delete DPValue records of variable information. - BBI->dropDbgValues(); + BBI->dropDbgRecords(); // Delete this instruction (any uses are guaranteed to be dead) BBI->replaceAllUsesWith(PoisonValue::get(BBI->getType())); diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp index 91ab279..3da1610 100644 --- a/llvm/lib/Transforms/Utils/ValueMapper.cpp +++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp @@ -1066,7 +1066,7 @@ void Mapper::remapFunction(Function &F) { for (BasicBlock &BB : F) { for (Instruction &I : BB) { remapInstruction(&I); - for (DbgRecord &DR : I.getDbgValueRange()) + for (DbgRecord &DR : I.getDbgRecordRange()) remapDPValue(DR); } } diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp index 94b12eb..2f3d4ca 100644 --- a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp +++ b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp @@ -29,7 +29,7 @@ static void extractDbgRecordsFromModule(Oracle &O, ReducerWorkItem &WorkItem) { for (auto &F : M) for (auto &BB : F) for (auto &I : BB) - for (DbgRecord &DR : llvm::make_early_inc_range(I.getDbgValueRange())) + for (DbgRecord &DR : llvm::make_early_inc_range(I.getDbgRecordRange())) if (!O.shouldKeep()) DR.eraseFromParent(); } diff --git a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp index b773bff..e23c7ea 100644 --- a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp +++ b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp @@ -80,9 +80,9 @@ TEST(BasicBlockDbgInfoTest, InsertAfterSelf) { Instruction *Inst1 = &*BB.begin(); Instruction *Inst2 = &*std::next(BB.begin()); Instruction *RetInst = &*std::next(Inst2->getIterator()); - EXPECT_TRUE(Inst1->hasDbgValues()); - EXPECT_TRUE(Inst2->hasDbgValues()); - EXPECT_FALSE(RetInst->hasDbgValues()); + EXPECT_TRUE(Inst1->hasDbgRecords()); + EXPECT_TRUE(Inst2->hasDbgRecords()); + EXPECT_FALSE(RetInst->hasDbgRecords()); // If we move Inst2 to be after Inst1, then it comes _immediately_ after. Were // we in dbg.value form we would then have: @@ -94,14 +94,14 @@ TEST(BasicBlockDbgInfoTest, InsertAfterSelf) { Inst2->moveAfter(Inst1); // Inst1 should only have one DPValue on it. - EXPECT_TRUE(Inst1->hasDbgValues()); - auto Range1 = Inst1->getDbgValueRange(); + EXPECT_TRUE(Inst1->hasDbgRecords()); + auto Range1 = Inst1->getDbgRecordRange(); EXPECT_EQ(std::distance(Range1.begin(), Range1.end()), 1u); // Inst2 should have none. - EXPECT_FALSE(Inst2->hasDbgValues()); + EXPECT_FALSE(Inst2->hasDbgRecords()); // While the return inst should now have one on it. - EXPECT_TRUE(RetInst->hasDbgValues()); - auto Range2 = RetInst->getDbgValueRange(); + EXPECT_TRUE(RetInst->hasDbgRecords()); + auto Range2 = RetInst->getDbgRecordRange(); EXPECT_EQ(std::distance(Range2.begin(), Range2.end()), 1u); M->convertFromNewDbgValues(); @@ -171,12 +171,12 @@ TEST(BasicBlockDbgInfoTest, MarkerOperations) { EXPECT_TRUE(Marker2->StoredDPValues.empty()); // This should appear in Marker1. - BB.insertDPValueBefore(DPV1, BB.begin()); + BB.insertDbgRecordBefore(DPV1, BB.begin()); EXPECT_EQ(Marker1->StoredDPValues.size(), 1u); EXPECT_EQ(DPV1, &*Marker1->StoredDPValues.begin()); // This should attach to Marker2. - BB.insertDPValueAfter(DPV2, &*BB.begin()); + BB.insertDbgRecordAfter(DPV2, &*BB.begin()); EXPECT_EQ(Marker2->StoredDPValues.size(), 1u); EXPECT_EQ(DPV2, &*Marker2->StoredDPValues.begin()); @@ -189,23 +189,23 @@ TEST(BasicBlockDbgInfoTest, MarkerOperations) { EXPECT_EQ(Marker2->StoredDPValues.size(), 2u); // They should also be in the correct order. SmallVector<DbgRecord *, 2> DPVs; - for (DbgRecord &DPV : Marker2->getDbgValueRange()) + for (DbgRecord &DPV : Marker2->getDbgRecordRange()) DPVs.push_back(&DPV); EXPECT_EQ(DPVs[0], DPV1); EXPECT_EQ(DPVs[1], DPV2); // If we remove the end instruction, the DPValues should fall down into // the trailing marker. - EXPECT_EQ(BB.getTrailingDPValues(), nullptr); + EXPECT_EQ(BB.getTrailingDbgRecords(), nullptr); Instr2->removeFromParent(); EXPECT_TRUE(BB.empty()); - EndMarker = BB.getTrailingDPValues(); + EndMarker = BB.getTrailingDbgRecords(); ASSERT_NE(EndMarker, nullptr); EXPECT_EQ(EndMarker->StoredDPValues.size(), 2u); // Again, these should arrive in the correct order. DPVs.clear(); - for (DbgRecord &DPV : EndMarker->getDbgValueRange()) + for (DbgRecord &DPV : EndMarker->getDbgRecordRange()) DPVs.push_back(&DPV); EXPECT_EQ(DPVs[0], DPV1); EXPECT_EQ(DPVs[1], DPV2); @@ -222,11 +222,11 @@ TEST(BasicBlockDbgInfoTest, MarkerOperations) { EXPECT_EQ(Instr1->DbgMarker->StoredDPValues.size(), 2u); // We should de-allocate the trailing marker when something is inserted // at end(). - EXPECT_EQ(BB.getTrailingDPValues(), nullptr); + EXPECT_EQ(BB.getTrailingDbgRecords(), nullptr); // Remove Instr1: now the DPValues will fall down again, Instr1->removeFromParent(); - EndMarker = BB.getTrailingDPValues(); + EndMarker = BB.getTrailingDbgRecords(); EXPECT_EQ(EndMarker->StoredDPValues.size(), 2u); // Inserting a terminator, however it's intended, should dislodge the @@ -235,7 +235,7 @@ TEST(BasicBlockDbgInfoTest, MarkerOperations) { // end forever. Instr2->insertBefore(BB, BB.begin()); EXPECT_EQ(Instr2->DbgMarker->StoredDPValues.size(), 2u); - EXPECT_EQ(BB.getTrailingDPValues(), nullptr); + EXPECT_EQ(BB.getTrailingDbgRecords(), nullptr); // Teardown, Instr1->insertBefore(BB, BB.begin()); @@ -393,7 +393,7 @@ TEST(BasicBlockDbgInfoTest, InstrDbgAccess) { ASSERT_EQ(CInst->DbgMarker->StoredDPValues.size(), 1u); DbgRecord *DPV1 = &*CInst->DbgMarker->StoredDPValues.begin(); ASSERT_TRUE(DPV1); - EXPECT_FALSE(BInst->hasDbgValues()); + EXPECT_FALSE(BInst->hasDbgRecords()); // Clone DPValues from one inst to another. Other arguments to clone are // tested in DPMarker test. @@ -405,23 +405,23 @@ TEST(BasicBlockDbgInfoTest, InstrDbgAccess) { EXPECT_NE(DPV1, DPV2); // We should be able to get a range over exactly the same information. - auto Range2 = BInst->getDbgValueRange(); + auto Range2 = BInst->getDbgRecordRange(); EXPECT_EQ(Range1.begin(), Range2.begin()); EXPECT_EQ(Range1.end(), Range2.end()); // We should be able to query if there are DPValues, - EXPECT_TRUE(BInst->hasDbgValues()); - EXPECT_TRUE(CInst->hasDbgValues()); - EXPECT_FALSE(DInst->hasDbgValues()); + EXPECT_TRUE(BInst->hasDbgRecords()); + EXPECT_TRUE(CInst->hasDbgRecords()); + EXPECT_FALSE(DInst->hasDbgRecords()); // Dropping should be easy, - BInst->dropDbgValues(); - EXPECT_FALSE(BInst->hasDbgValues()); + BInst->dropDbgRecords(); + EXPECT_FALSE(BInst->hasDbgRecords()); EXPECT_EQ(BInst->DbgMarker->StoredDPValues.size(), 0u); // And we should be able to drop individual DPValues. - CInst->dropOneDbgValue(DPV1); - EXPECT_FALSE(CInst->hasDbgValues()); + CInst->dropOneDbgRecord(DPV1); + EXPECT_FALSE(CInst->hasDbgRecords()); EXPECT_EQ(CInst->DbgMarker->StoredDPValues.size(), 0u); UseNewDbgInfoFormat = false; @@ -539,7 +539,7 @@ protected: void TearDown() override { UseNewDbgInfoFormat = false; } bool InstContainsDPValue(Instruction *I, DPValue *DPV) { - for (DbgRecord &D : I->getDbgValueRange()) { + for (DbgRecord &D : I->getDbgRecordRange()) { if (&D == DPV) { // Confirm too that the links between the records are correct. EXPECT_EQ(DPV->Marker, I->DbgMarker); @@ -552,7 +552,7 @@ protected: bool CheckDPVOrder(Instruction *I, SmallVector<DPValue *> CheckVals) { SmallVector<DbgRecord *> Vals; - for (DbgRecord &D : I->getDbgValueRange()) + for (DbgRecord &D : I->getDbgRecordRange()) Vals.push_back(&D); EXPECT_EQ(Vals.size(), CheckVals.size()); @@ -1161,7 +1161,7 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceTrailing) { // Begin by forcing entry block to have dangling DPValue. Entry.getTerminator()->eraseFromParent(); - ASSERT_NE(Entry.getTrailingDPValues(), nullptr); + ASSERT_NE(Entry.getTrailingDbgRecords(), nullptr); EXPECT_TRUE(Entry.empty()); // Now transfer the entire contents of the exit block into the entry. @@ -1222,12 +1222,12 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsert) { ASSERT_TRUE(isa<ReturnInst>(RetInst)); // add and sub should both have one DPValue on add and ret. - EXPECT_FALSE(SubInst->hasDbgValues()); - EXPECT_TRUE(AddInst->hasDbgValues()); - EXPECT_TRUE(RetInst->hasDbgValues()); - auto R1 = AddInst->getDbgValueRange(); + EXPECT_FALSE(SubInst->hasDbgRecords()); + EXPECT_TRUE(AddInst->hasDbgRecords()); + EXPECT_TRUE(RetInst->hasDbgRecords()); + auto R1 = AddInst->getDbgRecordRange(); EXPECT_EQ(std::distance(R1.begin(), R1.end()), 1u); - auto R2 = RetInst->getDbgValueRange(); + auto R2 = RetInst->getDbgRecordRange(); EXPECT_EQ(std::distance(R2.begin(), R2.end()), 1u); // The Supported (TM) code sequence for removing then reinserting insts @@ -1239,19 +1239,19 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsert) { // We should have a re-insertion position. ASSERT_TRUE(Pos); // Both DPValues should now be attached to the ret inst. - auto R3 = RetInst->getDbgValueRange(); + auto R3 = RetInst->getDbgRecordRange(); EXPECT_EQ(std::distance(R3.begin(), R3.end()), 2u); // Re-insert and re-insert. AddInst->insertAfter(SubInst); - Entry.reinsertInstInDPValues(AddInst, Pos); + Entry.reinsertInstInDbgRecords(AddInst, Pos); // We should be back into a position of having one DPValue on add and ret. - EXPECT_FALSE(SubInst->hasDbgValues()); - EXPECT_TRUE(AddInst->hasDbgValues()); - EXPECT_TRUE(RetInst->hasDbgValues()); - auto R4 = AddInst->getDbgValueRange(); + EXPECT_FALSE(SubInst->hasDbgRecords()); + EXPECT_TRUE(AddInst->hasDbgRecords()); + EXPECT_TRUE(RetInst->hasDbgRecords()); + auto R4 = AddInst->getDbgRecordRange(); EXPECT_EQ(std::distance(R4.begin(), R4.end()), 1u); - auto R5 = RetInst->getDbgValueRange(); + auto R5 = RetInst->getDbgRecordRange(); EXPECT_EQ(std::distance(R5.begin(), R5.end()), 1u); UseNewDbgInfoFormat = false; @@ -1300,10 +1300,10 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsertForOneDPValue) { ASSERT_TRUE(isa<ReturnInst>(RetInst)); // There should be one DPValue. - EXPECT_FALSE(SubInst->hasDbgValues()); - EXPECT_TRUE(AddInst->hasDbgValues()); - EXPECT_FALSE(RetInst->hasDbgValues()); - auto R1 = AddInst->getDbgValueRange(); + EXPECT_FALSE(SubInst->hasDbgRecords()); + EXPECT_TRUE(AddInst->hasDbgRecords()); + EXPECT_FALSE(RetInst->hasDbgRecords()); + auto R1 = AddInst->getDbgRecordRange(); EXPECT_EQ(std::distance(R1.begin(), R1.end()), 1u); // The Supported (TM) code sequence for removing then reinserting insts: @@ -1314,18 +1314,18 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsertForOneDPValue) { // No re-insertion position as there were no DPValues on the ret. ASSERT_FALSE(Pos); // The single DPValue should now be attached to the ret inst. - EXPECT_TRUE(RetInst->hasDbgValues()); - auto R2 = RetInst->getDbgValueRange(); + EXPECT_TRUE(RetInst->hasDbgRecords()); + auto R2 = RetInst->getDbgRecordRange(); EXPECT_EQ(std::distance(R2.begin(), R2.end()), 1u); // Re-insert and re-insert. AddInst->insertAfter(SubInst); - Entry.reinsertInstInDPValues(AddInst, Pos); + Entry.reinsertInstInDbgRecords(AddInst, Pos); // We should be back into a position of having one DPValue on the AddInst. - EXPECT_FALSE(SubInst->hasDbgValues()); - EXPECT_TRUE(AddInst->hasDbgValues()); - EXPECT_FALSE(RetInst->hasDbgValues()); - auto R3 = AddInst->getDbgValueRange(); + EXPECT_FALSE(SubInst->hasDbgRecords()); + EXPECT_TRUE(AddInst->hasDbgRecords()); + EXPECT_FALSE(RetInst->hasDbgRecords()); + auto R3 = AddInst->getDbgRecordRange(); EXPECT_EQ(std::distance(R3.begin(), R3.end()), 1u); UseNewDbgInfoFormat = false; @@ -1376,7 +1376,7 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty1) { // Begin by forcing entry block to have dangling DPValue. Entry.getTerminator()->eraseFromParent(); - ASSERT_NE(Entry.getTrailingDPValues(), nullptr); + ASSERT_NE(Entry.getTrailingDbgRecords(), nullptr); EXPECT_TRUE(Entry.empty()); // Now transfer the entire contents of the exit block into the entry. This @@ -1386,10 +1386,10 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty1) { // We should now have two dbg.values on the first instruction, and they // should be in the correct order of %a, then 0. Instruction *BInst = &*Entry.begin(); - ASSERT_TRUE(BInst->hasDbgValues()); + ASSERT_TRUE(BInst->hasDbgRecords()); EXPECT_EQ(BInst->DbgMarker->StoredDPValues.size(), 2u); SmallVector<DPValue *, 2> DPValues; - for (DbgRecord &DPV : BInst->getDbgValueRange()) + for (DbgRecord &DPV : BInst->getDbgRecordRange()) DPValues.push_back(cast<DPValue>(&DPV)); EXPECT_EQ(DPValues[0]->getVariableLocationOp(0), F.getArg(0)); @@ -1398,7 +1398,7 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty1) { EXPECT_EQ(cast<ConstantInt>(SecondDPVValue)->getZExtValue(), 0ull); // No trailing DPValues in the entry block now. - EXPECT_EQ(Entry.getTrailingDPValues(), nullptr); + EXPECT_EQ(Entry.getTrailingDbgRecords(), nullptr); UseNewDbgInfoFormat = false; } @@ -1446,7 +1446,7 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty2) { // Begin by forcing entry block to have dangling DPValue. Entry.getTerminator()->eraseFromParent(); - ASSERT_NE(Entry.getTrailingDPValues(), nullptr); + ASSERT_NE(Entry.getTrailingDbgRecords(), nullptr); EXPECT_TRUE(Entry.empty()); // Now transfer into the entry block -- fetching the first instruction with @@ -1456,23 +1456,23 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty2) { // We should now have one dbg.values on the first instruction, %a. Instruction *BInst = &*Entry.begin(); - ASSERT_TRUE(BInst->hasDbgValues()); + ASSERT_TRUE(BInst->hasDbgRecords()); EXPECT_EQ(BInst->DbgMarker->StoredDPValues.size(), 1u); SmallVector<DPValue *, 2> DPValues; - for (DbgRecord &DPV : BInst->getDbgValueRange()) + for (DbgRecord &DPV : BInst->getDbgRecordRange()) DPValues.push_back(cast<DPValue>(&DPV)); EXPECT_EQ(DPValues[0]->getVariableLocationOp(0), F.getArg(0)); // No trailing DPValues in the entry block now. - EXPECT_EQ(Entry.getTrailingDPValues(), nullptr); + EXPECT_EQ(Entry.getTrailingDbgRecords(), nullptr); // We should have nothing left in the exit block... EXPECT_TRUE(Exit.empty()); // ... except for some dangling DPValues. - EXPECT_NE(Exit.getTrailingDPValues(), nullptr); - EXPECT_FALSE(Exit.getTrailingDPValues()->empty()); - Exit.getTrailingDPValues()->eraseFromParent(); - Exit.deleteTrailingDPValues(); + EXPECT_NE(Exit.getTrailingDbgRecords(), nullptr); + EXPECT_FALSE(Exit.getTrailingDbgRecords()->empty()); + Exit.getTrailingDbgRecords()->eraseFromParent(); + Exit.deleteTrailingDbgRecords(); UseNewDbgInfoFormat = false; } @@ -1517,14 +1517,14 @@ TEST(BasicBlockDbgInfoTest, DbgMoveToEnd) { // Move the return to the end of the entry block. Instruction *Br = Entry.getTerminator(); Instruction *Ret = Exit.getTerminator(); - EXPECT_EQ(Entry.getTrailingDPValues(), nullptr); + EXPECT_EQ(Entry.getTrailingDbgRecords(), nullptr); Ret->moveBefore(Entry, Entry.end()); Br->eraseFromParent(); // There should continue to not be any debug-info anywhere. - EXPECT_EQ(Entry.getTrailingDPValues(), nullptr); - EXPECT_EQ(Exit.getTrailingDPValues(), nullptr); - EXPECT_FALSE(Ret->hasDbgValues()); + EXPECT_EQ(Entry.getTrailingDbgRecords(), nullptr); + EXPECT_EQ(Exit.getTrailingDbgRecords(), nullptr); + EXPECT_FALSE(Ret->hasDbgRecords()); UseNewDbgInfoFormat = false; } diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp index c99f928..0b019c2 100644 --- a/llvm/unittests/IR/DebugInfoTest.cpp +++ b/llvm/unittests/IR/DebugInfoTest.cpp @@ -952,10 +952,10 @@ TEST(MetadataTest, ConvertDbgToDPValue) { ExitBlock->createMarker(RetInst); // Insert DPValues into markers, order should come out DPV2, DPV1. - FirstInst->DbgMarker->insertDPValue(DPV1, false); - FirstInst->DbgMarker->insertDPValue(DPV2, true); + FirstInst->DbgMarker->insertDbgRecord(DPV1, false); + FirstInst->DbgMarker->insertDbgRecord(DPV2, true); unsigned int ItCount = 0; - for (DbgRecord &Item : FirstInst->DbgMarker->getDbgValueRange()) { + for (DbgRecord &Item : FirstInst->DbgMarker->getDbgRecordRange()) { EXPECT_TRUE((&Item == DPV2 && ItCount == 0) || (&Item == DPV1 && ItCount == 1)); EXPECT_EQ(Item.getMarker(), FirstInst->DbgMarker); @@ -969,7 +969,7 @@ TEST(MetadataTest, ConvertDbgToDPValue) { // Check these things store the same information; but that they're not the same // objects. for (DPValue &Item : - DPValue::filter(RetInst->DbgMarker->getDbgValueRange())) { + DPValue::filter(RetInst->DbgMarker->getDbgRecordRange())) { EXPECT_TRUE((Item.getRawLocation() == DPV2->getRawLocation() && ItCount == 0) || (Item.getRawLocation() == DPV1->getRawLocation() && ItCount == 1)); @@ -979,11 +979,11 @@ TEST(MetadataTest, ConvertDbgToDPValue) { ++ItCount; } - RetInst->DbgMarker->dropDbgValues(); + RetInst->DbgMarker->dropDbgRecords(); EXPECT_EQ(RetInst->DbgMarker->StoredDPValues.size(), 0u); // Try cloning one single DPValue. - auto DIIt = std::next(FirstInst->DbgMarker->getDbgValueRange().begin()); + auto DIIt = std::next(FirstInst->DbgMarker->getDbgRecordRange().begin()); RetInst->DbgMarker->cloneDebugInfoFrom(FirstInst->DbgMarker, DIIt, false); EXPECT_EQ(RetInst->DbgMarker->StoredDPValues.size(), 1u); // The second DPValue should have been cloned; it should have the same values @@ -992,7 +992,7 @@ TEST(MetadataTest, ConvertDbgToDPValue) { ->getRawLocation(), DPV1->getRawLocation()); // We should be able to drop individual DPValues. - RetInst->DbgMarker->dropOneDbgValue( + RetInst->DbgMarker->dropOneDbgRecord( &*RetInst->DbgMarker->StoredDPValues.begin()); // "Aborb" a DPMarker: this means pretend that the instruction it's attached @@ -1001,7 +1001,7 @@ TEST(MetadataTest, ConvertDbgToDPValue) { EXPECT_EQ(RetInst->DbgMarker->StoredDPValues.size(), 2u); // Should be the DPV1 and DPV2 objects. ItCount = 0; - for (DbgRecord &Item : RetInst->DbgMarker->getDbgValueRange()) { + for (DbgRecord &Item : RetInst->DbgMarker->getDbgRecordRange()) { EXPECT_TRUE((&Item == DPV2 && ItCount == 0) || (&Item == DPV1 && ItCount == 1)); EXPECT_EQ(Item.getMarker(), RetInst->DbgMarker); @@ -1017,12 +1017,12 @@ TEST(MetadataTest, ConvertDbgToDPValue) { RetInst->DbgMarker->removeMarker(); RetInst->eraseFromParent(); - DPMarker *EndMarker = ExitBlock->getTrailingDPValues(); + DPMarker *EndMarker = ExitBlock->getTrailingDbgRecords(); ASSERT_NE(EndMarker, nullptr); EXPECT_EQ(EndMarker->StoredDPValues.size(), 2u); // Test again that it's those two DPValues, DPV1 and DPV2. ItCount = 0; - for (DbgRecord &Item : EndMarker->getDbgValueRange()) { + for (DbgRecord &Item : EndMarker->getDbgRecordRange()) { EXPECT_TRUE((&Item == DPV2 && ItCount == 0) || (&Item == DPV1 && ItCount == 1)); EXPECT_EQ(Item.getMarker(), EndMarker); @@ -1034,7 +1034,7 @@ TEST(MetadataTest, ConvertDbgToDPValue) { // The record of those trailing DPValues would dangle and cause an assertion // failure if it lived until the end of the LLVMContext. - ExitBlock->deleteTrailingDPValues(); + ExitBlock->deleteTrailingDbgRecords(); } TEST(MetadataTest, DPValueConversionRoutines) { @@ -1117,14 +1117,14 @@ TEST(MetadataTest, DPValueConversionRoutines) { EXPECT_EQ(FirstInst->DbgMarker->StoredDPValues.size(), 1u); DPValue *DPV1 = - cast<DPValue>(&*FirstInst->DbgMarker->getDbgValueRange().begin()); + cast<DPValue>(&*FirstInst->DbgMarker->getDbgRecordRange().begin()); EXPECT_EQ(DPV1->getMarker(), FirstInst->DbgMarker); // Should point at %a, an argument. EXPECT_TRUE(isa<Argument>(DPV1->getVariableLocationOp(0))); EXPECT_EQ(SecondInst->DbgMarker->StoredDPValues.size(), 1u); DPValue *DPV2 = - cast<DPValue>(&*SecondInst->DbgMarker->getDbgValueRange().begin()); + cast<DPValue>(&*SecondInst->DbgMarker->getDbgRecordRange().begin()); EXPECT_EQ(DPV2->getMarker(), SecondInst->DbgMarker); // Should point at FirstInst. EXPECT_EQ(DPV2->getVariableLocationOp(0), FirstInst); diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp index cece659..139e883 100644 --- a/llvm/unittests/IR/IRBuilderTest.cpp +++ b/llvm/unittests/IR/IRBuilderTest.cpp @@ -872,15 +872,15 @@ TEST_F(IRBuilderTest, createFunction) { TEST_F(IRBuilderTest, DIBuilder) { auto GetLastDbgRecord = [](const Instruction *I) -> DbgRecord * { - if (I->getDbgValueRange().empty()) + if (I->getDbgRecordRange().empty()) return nullptr; - return &*std::prev(I->getDbgValueRange().end()); + return &*std::prev(I->getDbgRecordRange().end()); }; auto ExpectOrder = [&](DbgInstPtr First, BasicBlock::iterator Second) { if (M->IsNewDbgInfoFormat) { EXPECT_TRUE(First.is<DbgRecord *>()); - EXPECT_FALSE(Second->getDbgValueRange().empty()); + EXPECT_FALSE(Second->getDbgRecordRange().empty()); EXPECT_EQ(GetLastDbgRecord(&*Second), First.get<DbgRecord *>()); } else { EXPECT_TRUE(First.is<Instruction *>()); @@ -951,7 +951,7 @@ TEST_F(IRBuilderTest, DIBuilder) { I, VarX, DIB.createExpression(), VarLoc, BB); I = Builder.CreateAlloca(Builder.getInt32Ty()); ExpectOrder(VarXValue, I->getIterator()); - EXPECT_EQ(BB->getTrailingDPValues(), nullptr); + EXPECT_EQ(BB->getTrailingDbgRecords(), nullptr); } { /* dbg.declare | DPValue::Declare */ ExpectOrder(DIB.insertDeclare(I, VarY, DIB.createExpression(), VarLoc, I), @@ -961,7 +961,7 @@ TEST_F(IRBuilderTest, DIBuilder) { DIB.insertDeclare(I, VarY, DIB.createExpression(), VarLoc, BB); I = Builder.CreateAlloca(Builder.getInt32Ty()); ExpectOrder(VarYDeclare, I->getIterator()); - EXPECT_EQ(BB->getTrailingDPValues(), nullptr); + EXPECT_EQ(BB->getTrailingDbgRecords(), nullptr); } { /* dbg.assign | DPValue::Assign */ I = Builder.CreateAlloca(Builder.getInt32Ty()); @@ -974,7 +974,7 @@ TEST_F(IRBuilderTest, DIBuilder) { DIB.createExpression(), VarLoc); I = Builder.CreateAlloca(Builder.getInt32Ty()); ExpectOrder(VarXAssign, I->getIterator()); - EXPECT_EQ(BB->getTrailingDPValues(), nullptr); + EXPECT_EQ(BB->getTrailingDbgRecords(), nullptr); } Builder.CreateRet(nullptr); diff --git a/llvm/unittests/IR/ValueTest.cpp b/llvm/unittests/IR/ValueTest.cpp index 6146719..97c8fea 100644 --- a/llvm/unittests/IR/ValueTest.cpp +++ b/llvm/unittests/IR/ValueTest.cpp @@ -376,11 +376,11 @@ TEST(ValueTest, replaceUsesOutsideBlockDPValue) { BasicBlock *Exit = GetNext(Entry); Instruction *Ret = &Exit->front(); - EXPECT_TRUE(Branch->hasDbgValues()); - EXPECT_TRUE(Ret->hasDbgValues()); + EXPECT_TRUE(Branch->hasDbgRecords()); + EXPECT_TRUE(Ret->hasDbgRecords()); - DPValue *DPV1 = cast<DPValue>(&*Branch->getDbgValueRange().begin()); - DPValue *DPV2 = cast<DPValue>(&*Ret->getDbgValueRange().begin()); + DPValue *DPV1 = cast<DPValue>(&*Branch->getDbgRecordRange().begin()); + DPValue *DPV2 = cast<DPValue>(&*Ret->getDbgRecordRange().begin()); A->replaceUsesOutsideBlock(B, Entry); // These users are in Entry so shouldn't be changed. diff --git a/llvm/unittests/Transforms/Utils/DebugifyTest.cpp b/llvm/unittests/Transforms/Utils/DebugifyTest.cpp index 1ec9402..89fa133 100644 --- a/llvm/unittests/Transforms/Utils/DebugifyTest.cpp +++ b/llvm/unittests/Transforms/Utils/DebugifyTest.cpp @@ -61,7 +61,7 @@ struct DebugValueDrop : public FunctionPass { if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) Dbgs.push_back(DVI); // If there are any non-intrinsic records (DPValues), drop those too. - I.dropDbgValues(); + I.dropDbgRecords(); } } diff --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp index 8225774..87a2a2a 100644 --- a/llvm/unittests/Transforms/Utils/LocalTest.cpp +++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp @@ -1327,7 +1327,7 @@ TEST(Local, ReplaceDPValue) { RetInst->DbgMarker = new DPMarker(); RetInst->DbgMarker->MarkedInstr = RetInst; DPValue *DPV = new DPValue(DVI); - RetInst->DbgMarker->insertDPValue(DPV, false); + RetInst->DbgMarker->insertDbgRecord(DPV, false); // ... and erase the dbg.value. DVI->eraseFromParent(); |