[llvm] [RemoveDIs][NFC] Rename DPValue -> DbgVariableRecord (PR #85216)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 14 05:53:18 PDT 2024
https://github.com/SLTozer updated https://github.com/llvm/llvm-project/pull/85216
>From 48e22dac37d0c36dedde22e9b1aa8068d8ea3f52 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Thu, 14 Mar 2024 12:19:52 +0000
Subject: [PATCH 1/2] [RemoveDIs][NFC] Rename DPValue -> DbgVariableRecord
This is the major rename patch that prior patches have built towards. The
DPValue class is being renamed to DbgVariableRecord, which reflects the
updated terminology for the "final" implementation of the RemoveDI feature.
This is a pure string substitution + clang-format patch. The only
manual component of this patch was determining where to perform these
string substitutions: `DPValue` and `DPV` are almost exclusively used for
DbgRecords, *except* for:
- llvm/lib/target, where 'DP' is used to mean double-precision, and so
appears as part of .td files and in variable names.
NB: There is a single existing use of `DPValue` here that I've manually
updated.
- llvm/tools/gold, where 'LDPV' is used as a prefix for symbol visibility
enums.
Outside of these places, I've applied several basic string substitutions,
with the intent that they only affect DbgRecord-related identifiers; I've
checked them as I went through to verify this, with reasonable confidence
that there are no unintended changes that slipped through the cracks. The
substitutions applied are all case-sensitive, and described sed-style as:
s/DPValue/DbgVariableRecord/
s/DPVal/DbgVarRec/
s/DPV/DVR/
Following the previous rename patches, it should be the case that there are
no instances of any of these strings that are meant to refer to DbgRecords.
---
llvm/docs/RemoveDIsDebugInfo.md | 10 +-
.../llvm/CodeGen/FunctionLoweringInfo.h | 2 +-
llvm/include/llvm/IR/BasicBlock.h | 6 +-
llvm/include/llvm/IR/DIBuilder.h | 7 +-
llvm/include/llvm/IR/DebugInfo.h | 40 +-
llvm/include/llvm/IR/DebugInfoMetadata.h | 12 +-
.../include/llvm/IR/DebugProgramInstruction.h | 157 +++--
llvm/include/llvm/IR/Metadata.h | 26 +-
llvm/include/llvm/Transforms/Utils/Local.h | 8 +-
.../Transforms/Utils/MemoryTaggingSupport.h | 2 +-
.../llvm/Transforms/Utils/SSAUpdater.h | 7 +-
.../llvm/Transforms/Utils/ValueMapper.h | 36 +-
llvm/lib/AsmParser/LLParser.cpp | 14 +-
.../CodeGen/AssignmentTrackingAnalysis.cpp | 154 +++--
llvm/lib/CodeGen/CodeGenPrepare.cpp | 61 +-
llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp | 18 +-
llvm/lib/CodeGen/SelectOptimize.cpp | 4 +-
llvm/lib/CodeGen/SelectionDAG/FastISel.cpp | 24 +-
.../SelectionDAG/FunctionLoweringInfo.cpp | 2 +-
.../SelectionDAG/SelectionDAGBuilder.cpp | 49 +-
.../CodeGen/SelectionDAG/SelectionDAGISel.cpp | 12 +-
llvm/lib/IR/AsmWriter.cpp | 53 +-
llvm/lib/IR/BasicBlock.cpp | 26 +-
llvm/lib/IR/DIBuilder.cpp | 38 +-
llvm/lib/IR/DebugInfo.cpp | 122 ++--
llvm/lib/IR/DebugInfoMetadata.cpp | 8 +-
llvm/lib/IR/DebugProgramInstruction.cpp | 217 +++---
llvm/lib/IR/Instruction.cpp | 10 +-
llvm/lib/IR/LLVMContextImpl.cpp | 4 +-
llvm/lib/IR/LLVMContextImpl.h | 16 +-
llvm/lib/IR/LegacyPassManager.cpp | 5 +-
llvm/lib/IR/Metadata.cpp | 31 +-
llvm/lib/IR/Value.cpp | 8 +-
llvm/lib/IR/Verifier.cpp | 144 ++--
.../Target/AArch64/AArch64StackTagging.cpp | 2 +-
llvm/lib/Transforms/Coroutines/CoroFrame.cpp | 85 +--
llvm/lib/Transforms/Coroutines/CoroInternal.h | 4 +-
llvm/lib/Transforms/Coroutines/CoroSplit.cpp | 25 +-
llvm/lib/Transforms/IPO/IROutliner.cpp | 4 +-
llvm/lib/Transforms/IPO/MergeFunctions.cpp | 62 +-
.../Transforms/IPO/ThinLTOBitcodeWriter.cpp | 4 +-
.../InstCombine/InstCombineCalls.cpp | 2 +-
.../InstCombine/InstCombineInternal.h | 7 +-
.../InstCombine/InstructionCombining.cpp | 136 ++--
.../Instrumentation/HWAddressSanitizer.cpp | 7 +-
llvm/lib/Transforms/Scalar/ADCE.cpp | 15 +-
.../Scalar/DeadStoreElimination.cpp | 5 +-
llvm/lib/Transforms/Scalar/JumpThreading.cpp | 46 +-
.../Transforms/Scalar/LoopStrengthReduce.cpp | 20 +-
llvm/lib/Transforms/Scalar/SROA.cpp | 48 +-
.../Transforms/Scalar/SimpleLoopUnswitch.cpp | 5 +-
.../Scalar/SpeculativeExecution.cpp | 23 +-
llvm/lib/Transforms/Utils/BasicBlockUtils.cpp | 85 +--
llvm/lib/Transforms/Utils/CloneFunction.cpp | 24 +-
llvm/lib/Transforms/Utils/CodeExtractor.cpp | 30 +-
llvm/lib/Transforms/Utils/InlineFunction.cpp | 24 +-
llvm/lib/Transforms/Utils/LCSSA.cpp | 10 +-
llvm/lib/Transforms/Utils/Local.cpp | 369 +++++-----
.../Transforms/Utils/LoopRotationUtils.cpp | 53 +-
.../Transforms/Utils/LoopUnrollRuntime.cpp | 5 +-
llvm/lib/Transforms/Utils/LoopUtils.cpp | 26 +-
llvm/lib/Transforms/Utils/MemoryOpRemark.cpp | 2 +-
.../Transforms/Utils/MemoryTaggingSupport.cpp | 14 +-
.../Utils/PromoteMemoryToRegister.cpp | 70 +-
llvm/lib/Transforms/Utils/SSAUpdater.cpp | 26 +-
llvm/lib/Transforms/Utils/SimplifyCFG.cpp | 69 +-
llvm/lib/Transforms/Utils/ValueMapper.cpp | 12 +-
llvm/test/DebugInfo/dpvalue-print-nocrash.ll | 2 +-
llvm/test/Transforms/LoopRotate/dbgvalue.ll | 2 +-
.../tools/llvm-reduce/remove-dp-values.ll | 2 +-
.../llvm-reduce/deltas/ReduceDbgRecords.cpp | 12 +-
.../llvm-reduce/deltas/ReduceDbgRecords.h | 2 +-
llvm/unittests/IR/BasicBlockDbgInfoTest.cpp | 643 +++++++++---------
llvm/unittests/IR/DebugInfoTest.cpp | 182 ++---
llvm/unittests/IR/IRBuilderTest.cpp | 6 +-
llvm/unittests/IR/ValueTest.cpp | 14 +-
llvm/unittests/Transforms/Utils/LocalTest.cpp | 23 +-
77 files changed, 1824 insertions(+), 1716 deletions(-)
diff --git a/llvm/docs/RemoveDIsDebugInfo.md b/llvm/docs/RemoveDIsDebugInfo.md
index df66c26308a3c6..5ce3a1e4bfbf32 100644
--- a/llvm/docs/RemoveDIsDebugInfo.md
+++ b/llvm/docs/RemoveDIsDebugInfo.md
@@ -43,10 +43,10 @@ This will all happen transparently without needing to think about it!
We're using a dedicated C++ class called `DbgRecord` to store debug info, with a one-to-one relationship between each instance of a debug intrinsic and each `DbgRecord` object in any LLVM IR program; these `DbgRecord`s are represented in the IR as non-instruction debug records, as described in the [Source Level Debugging](project:SourceLevelDebugging.rst#Debug Records) document. This class has a set of subclasses that store exactly the same information as is stored in debugging intrinsics. Each one also has almost entirely the same set of methods, that behave in the same way:
https://llvm.org/docs/doxygen/classllvm_1_1DbgRecord.html
- https://llvm.org/docs/doxygen/classllvm_1_1DPValue.html
+ https://llvm.org/docs/doxygen/classllvm_1_1DbgVariableRecord.html
https://llvm.org/docs/doxygen/classllvm_1_1DPLabel.html
-This allows you to treat a `DPValue` as if it's a `dbg.value`/`dbg.declare`/`dbg.assign` intrinsic most of the time, for example in generic (auto-param) lambdas, and the same for `DPLabel` and `dbg.label`s.
+This allows you to treat a `DbgVariableRecord` as if it's a `dbg.value`/`dbg.declare`/`dbg.assign` intrinsic most of the time, for example in generic (auto-param) lambdas, and the same for `DPLabel` and `dbg.label`s.
## How do these `DbgRecords` fit into the instruction stream?
@@ -74,13 +74,13 @@ Like so:
Each instruction has a pointer to a `DPMarker` (which will become optional), that contains a list of `DbgRecord` objects. No debugging records appear in the instruction list at all. `DbgRecord`s have a parent pointer to their owning `DPMarker`, and each `DPMarker` has a pointer back to it's owning instruction.
-Not shown are the links from DbgRecord to other parts of the `Value`/`Metadata` hierachy: `DbgRecord` subclasses have tracking pointers to the DIMetadata that they use, and `DPValue` has references to `Value`s that are stored in a `DebugValueUser` base class. This refers to a `ValueAsMetadata` object referring to `Value`s, via the `TrackingMetadata` facility.
+Not shown are the links from DbgRecord to other parts of the `Value`/`Metadata` hierachy: `DbgRecord` subclasses have tracking pointers to the DIMetadata that they use, and `DbgVariableRecord` has references to `Value`s that are stored in a `DebugValueUser` base class. This refers to a `ValueAsMetadata` object referring to `Value`s, via the `TrackingMetadata` facility.
-The various kinds of debug intrinsic (value, declare, assign, label) are all stored in `DbgRecord` subclasses, with a "RecordKind" field distinguishing `DPLabel`s from `DPValue`s, and a `LocationType` field in the `DPValue` class further disambiguating the various debug variable intrinsics it can represent.
+The various kinds of debug intrinsic (value, declare, assign, label) are all stored in `DbgRecord` subclasses, with a "RecordKind" field distinguishing `DPLabel`s from `DbgVariableRecord`s, and a `LocationType` field in the `DbgVariableRecord` class further disambiguating the various debug variable intrinsics it can represent.
## Finding debug info records
-Utilities such as `findDbgUsers` and the like now have an optional argument that will return the set of `DPValue` records that refer to a `Value`. You should be able to treat them the same as intrinsics.
+Utilities such as `findDbgUsers` and the like now have an optional argument that will return the set of `DbgVariableRecord` records that refer to a `Value`. You should be able to treat them the same as intrinsics.
## Examining debug info records at positions
diff --git a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
index 31af3014afe4e7..45a47d7333e35a 100644
--- a/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
+++ b/llvm/include/llvm/CodeGen/FunctionLoweringInfo.h
@@ -191,7 +191,7 @@ class FunctionLoweringInfo {
/// Collection of dbg.declare instructions handled after argument
/// lowering and before ISel proper.
SmallPtrSet<const DbgDeclareInst *, 8> PreprocessedDbgDeclares;
- SmallPtrSet<const DPValue *, 8> PreprocessedDPVDeclares;
+ SmallPtrSet<const DbgVariableRecord *, 8> PreprocessedDVRDeclares;
/// set - Initialize this FunctionLoweringInfo with the given Function
/// and its associated MachineFunction.
diff --git a/llvm/include/llvm/IR/BasicBlock.h b/llvm/include/llvm/IR/BasicBlock.h
index 71c1a8394896b7..1b5843262cdbdd 100644
--- a/llvm/include/llvm/IR/BasicBlock.h
+++ b/llvm/include/llvm/IR/BasicBlock.h
@@ -38,7 +38,7 @@ class LLVMContext;
class Module;
class PHINode;
class ValueSymbolTable;
-class DPValue;
+class DbgVariableRecord;
class DPMarker;
/// LLVM Basic Block Representation
@@ -121,10 +121,10 @@ class BasicBlock final : public Value, // Basic blocks are data objects also
DPMarker *getNextMarker(Instruction *I);
/// Insert a DbgRecord into a block at the position given by \p I.
- void insertDbgRecordAfter(DbgRecord *DPV, Instruction *I);
+ void insertDbgRecordAfter(DbgRecord *DVR, Instruction *I);
/// Insert a DbgRecord into a block at the position given by \p Here.
- void insertDbgRecordBefore(DbgRecord *DPV, InstListType::iterator Here);
+ void insertDbgRecordBefore(DbgRecord *DVR, InstListType::iterator Here);
/// Eject any debug-info trailing at the end of a block. DbgRecords can
/// transiently be located "off the end" of a block if the blocks terminator
diff --git a/llvm/include/llvm/IR/DIBuilder.h b/llvm/include/llvm/IR/DIBuilder.h
index 94af17af8160e9..4f0874fea483c9 100644
--- a/llvm/include/llvm/IR/DIBuilder.h
+++ b/llvm/include/llvm/IR/DIBuilder.h
@@ -101,9 +101,10 @@ namespace llvm {
DbgInstPtr insertLabel(DILabel *LabelInfo, const DILocation *DL,
BasicBlock *InsertBB, Instruction *InsertBefore);
- /// Internal helper. Track metadata if untracked and insert \p DPV.
- void insertDPValue(DPValue *DPV, BasicBlock *InsertBB,
- Instruction *InsertBefore, bool InsertAtHead = false);
+ /// Internal helper. Track metadata if untracked and insert \p DVR.
+ void insertDbgVariableRecord(DbgVariableRecord *DVR, BasicBlock *InsertBB,
+ Instruction *InsertBefore,
+ bool InsertAtHead = false);
/// Internal helper with common code used by insertDbg{Value,Addr}Intrinsic.
Instruction *insertDbgIntrinsic(llvm::Function *Intrinsic, llvm::Value *Val,
diff --git a/llvm/include/llvm/IR/DebugInfo.h b/llvm/include/llvm/IR/DebugInfo.h
index 6673908d3ed355..53cede5409e260 100644
--- a/llvm/include/llvm/IR/DebugInfo.h
+++ b/llvm/include/llvm/IR/DebugInfo.h
@@ -34,23 +34,25 @@ namespace llvm {
class DbgDeclareInst;
class DbgValueInst;
class DbgVariableIntrinsic;
-class DPValue;
+class DbgVariableRecord;
class Instruction;
class Module;
/// Finds dbg.declare intrinsics declaring local variables as living in the
/// memory that 'V' points to.
TinyPtrVector<DbgDeclareInst *> findDbgDeclares(Value *V);
-/// As above, for DPVDeclares.
-TinyPtrVector<DPValue *> findDPVDeclares(Value *V);
+/// As above, for DVRDeclares.
+TinyPtrVector<DbgVariableRecord *> findDVRDeclares(Value *V);
/// Finds the llvm.dbg.value intrinsics describing a value.
-void findDbgValues(SmallVectorImpl<DbgValueInst *> &DbgValues,
- Value *V, SmallVectorImpl<DPValue *> *DPValues = nullptr);
+void findDbgValues(
+ SmallVectorImpl<DbgValueInst *> &DbgValues, Value *V,
+ SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords = nullptr);
/// Finds the debug info intrinsics describing a value.
-void findDbgUsers(SmallVectorImpl<DbgVariableIntrinsic *> &DbgInsts,
- Value *V, SmallVectorImpl<DPValue *> *DPValues = nullptr);
+void findDbgUsers(
+ SmallVectorImpl<DbgVariableIntrinsic *> &DbgInsts, Value *V,
+ SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords = nullptr);
/// Find subprogram that is enclosing this scope.
DISubprogram *getDISubprogram(const MDNode *Scope);
@@ -58,7 +60,7 @@ DISubprogram *getDISubprogram(const MDNode *Scope);
/// Produce a DebugLoc to use for each dbg.declare that is promoted to a
/// dbg.value.
DebugLoc getDebugValueLoc(DbgVariableIntrinsic *DII);
-DebugLoc getDebugValueLoc(DPValue *DPV);
+DebugLoc getDebugValueLoc(DbgVariableRecord *DVR);
/// Strip debug info in the module if it exists.
///
@@ -109,7 +111,8 @@ class DebugInfoFinder {
void processVariable(const Module &M, const DILocalVariable *DVI);
/// Process debug info location.
void processLocation(const Module &M, const DILocation *Loc);
- /// Process a DbgRecord (e.g, treat a DPValue like a DbgVariableIntrinsic).
+ /// Process a DbgRecord (e.g, treat a DbgVariableRecord like a
+ /// DbgVariableIntrinsic).
void processDbgRecord(const Module &M, const DbgRecord &DR);
/// Process subprogram.
@@ -193,10 +196,10 @@ inline AssignmentInstRange getAssignmentInsts(const DbgAssignIntrinsic *DAI) {
return getAssignmentInsts(DAI->getAssignID());
}
-inline AssignmentInstRange getAssignmentInsts(const DPValue *DPV) {
- assert(DPV->isDbgAssign() &&
- "Can't get assignment instructions for non-assign DPV!");
- return getAssignmentInsts(DPV->getAssignID());
+inline AssignmentInstRange getAssignmentInsts(const DbgVariableRecord *DVR) {
+ assert(DVR->isDbgAssign() &&
+ "Can't get assignment instructions for non-assign DVR!");
+ return getAssignmentInsts(DVR->getAssignID());
}
//
@@ -231,9 +234,10 @@ inline AssignmentMarkerRange getAssignmentMarkers(const Instruction *Inst) {
return make_range(Value::user_iterator(), Value::user_iterator());
}
-inline SmallVector<DPValue *> getDPVAssignmentMarkers(const Instruction *Inst) {
+inline SmallVector<DbgVariableRecord *>
+getDVRAssignmentMarkers(const Instruction *Inst) {
if (auto *ID = Inst->getMetadata(LLVMContext::MD_DIAssignID))
- return cast<DIAssignID>(ID)->getAllDPValueUsers();
+ return cast<DIAssignID>(ID)->getAllDbgVariableRecordUsers();
return {};
}
@@ -261,7 +265,7 @@ bool calculateFragmentIntersect(
std::optional<DIExpression::FragmentInfo> &Result);
bool calculateFragmentIntersect(
const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits,
- uint64_t SliceSizeInBits, const DPValue *DPVAssign,
+ uint64_t SliceSizeInBits, const DbgVariableRecord *DVRAssign,
std::optional<DIExpression::FragmentInfo> &Result);
/// Helper struct for trackAssignments, below. We don't use the similar
@@ -276,8 +280,8 @@ struct VarRecord {
VarRecord(DbgVariableIntrinsic *DVI)
: Var(DVI->getVariable()), DL(getDebugValueLoc(DVI)) {}
- VarRecord(DPValue *DPV)
- : Var(DPV->getVariable()), DL(getDebugValueLoc(DPV)) {}
+ VarRecord(DbgVariableRecord *DVR)
+ : Var(DVR->getVariable()), DL(getDebugValueLoc(DVR)) {}
VarRecord(DILocalVariable *Var, DILocation *DL) : Var(Var), DL(DL) {}
friend bool operator<(const VarRecord &LHS, const VarRecord &RHS) {
return std::tie(LHS.Var, LHS.DL) < std::tie(RHS.Var, RHS.DL);
diff --git a/llvm/include/llvm/IR/DebugInfoMetadata.h b/llvm/include/llvm/IR/DebugInfoMetadata.h
index 156f6eb49253de..11fa8c5b20235f 100644
--- a/llvm/include/llvm/IR/DebugInfoMetadata.h
+++ b/llvm/include/llvm/IR/DebugInfoMetadata.h
@@ -65,7 +65,7 @@ enum Tag : uint16_t;
}
class DbgVariableIntrinsic;
-class DPValue;
+class DbgVariableRecord;
extern cl::opt<bool> EnableFSDiscriminator;
@@ -323,8 +323,8 @@ class DIAssignID : public MDNode {
// This node has no operands to replace.
void replaceOperandWith(unsigned I, Metadata *New) = delete;
- SmallVector<DPValue *> getAllDPValueUsers() {
- return Context.getReplaceableUses()->getAllDPValueUsers();
+ SmallVector<DbgVariableRecord *> getAllDbgVariableRecordUsers() {
+ return Context.getReplaceableUses()->getAllDbgVariableRecordUsers();
}
static DIAssignID *getDistinct(LLVMContext &Context) {
@@ -3788,8 +3788,8 @@ class DIArgList : public Metadata, ReplaceableMetadataImpl {
return MD->getMetadataID() == DIArgListKind;
}
- SmallVector<DPValue *> getAllDPValueUsers() {
- return ReplaceableMetadataImpl::getAllDPValueUsers();
+ SmallVector<DbgVariableRecord *> getAllDbgVariableRecordUsers() {
+ return ReplaceableMetadataImpl::getAllDbgVariableRecordUsers();
}
void handleChangedOperand(void *Ref, Metadata *New);
@@ -3819,7 +3819,7 @@ class DebugVariable {
public:
DebugVariable(const DbgVariableIntrinsic *DII);
- DebugVariable(const DPValue *DPV);
+ DebugVariable(const DbgVariableRecord *DVR);
DebugVariable(const DILocalVariable *Var,
std::optional<FragmentInfo> FragmentInfo,
diff --git a/llvm/include/llvm/IR/DebugProgramInstruction.h b/llvm/include/llvm/IR/DebugProgramInstruction.h
index 971c22fa9aa22a..1067729ed1226c 100644
--- a/llvm/include/llvm/IR/DebugProgramInstruction.h
+++ b/llvm/include/llvm/IR/DebugProgramInstruction.h
@@ -27,12 +27,13 @@
// %bar = void call @ext(%foo)
// ; bar->DbgMarker = {
// ; StoredDbgRecords = {
-// ; DPValue(metadata i32 %foo, ...)
+// ; DbgVariableRecord(metadata i32 %foo, ...)
// ; }
// ; }
// ;; There is a debug-info record in front of the %bar instruction,
// ;; thus it points at a DPMarker object. That DPMarker contains a
-// ;; DPValue in it's ilist, storing the equivalent information to the
+// ;; DbgVariableRecord in it's ilist, storing the equivalent information
+// to the
// ;; dbg.value above: the Value, DILocalVariable, etc.
//
// This structure separates the two concerns of the position of the debug-info
@@ -66,7 +67,7 @@ class DbgInfoIntrinsic;
class DbgLabelInst;
class DIAssignID;
class DPMarker;
-class DPValue;
+class DbgVariableRecord;
class raw_ostream;
/// A typed tracking MDNode reference that does not require a definition for its
@@ -219,7 +220,8 @@ inline raw_ostream &operator<<(raw_ostream &OS, const DbgRecord &R) {
/// Records a position in IR for a source label (DILabel). Corresponds to the
/// llvm.dbg.label intrinsic.
-/// FIXME: Rename DbgLabelRecord when DPValue is renamed to DbgVariableRecord.
+/// FIXME: Rename DbgLabelRecord when DbgVariableRecord is renamed to
+/// DbgVariableRecord.
class DPLabel : public DbgRecord {
DbgRecordParamRef<DILabel> Label;
@@ -257,7 +259,7 @@ class DPLabel : public DbgRecord {
///
/// This class inherits from DebugValueUser to allow LLVM's metadata facilities
/// to update our references to metadata beneath our feet.
-class DPValue : public DbgRecord, protected DebugValueUser {
+class DbgVariableRecord : public DbgRecord, protected DebugValueUser {
friend class DebugValueUser;
public:
@@ -269,9 +271,10 @@ class DPValue : public DbgRecord, protected DebugValueUser {
End, ///< Marks the end of the concrete types.
Any, ///< To indicate all LocationTypes in searches.
};
- /// Classification of the debug-info record that this DPValue represents.
- /// Essentially, "is this a dbg.value or dbg.declare?". dbg.declares are not
- /// currently supported, but it would be trivial to do so.
+ /// Classification of the debug-info record that this DbgVariableRecord
+ /// represents. Essentially, "is this a dbg.value or dbg.declare?".
+ /// dbg.declares are not currently supported, but it would be trivial to do
+ /// so.
/// FIXME: We could use spare padding bits from DbgRecord for this.
LocationType Type;
@@ -284,63 +287,69 @@ class DPValue : public DbgRecord, protected DebugValueUser {
DbgRecordParamRef<DIExpression> AddressExpression;
public:
- /// Create a new DPValue representing the intrinsic \p DVI, for example the
- /// assignment represented by a dbg.value.
- DPValue(const DbgVariableIntrinsic *DVI);
- DPValue(const DPValue &DPV);
- /// Directly construct a new DPValue representing a dbg.value intrinsic
- /// assigning \p Location to the DV / Expr / DI variable.
- DPValue(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
- const DILocation *DI, LocationType Type = LocationType::Value);
- DPValue(Metadata *Value, DILocalVariable *Variable, DIExpression *Expression,
- DIAssignID *AssignID, Metadata *Address,
- DIExpression *AddressExpression, const DILocation *DI);
+ /// Create a new DbgVariableRecord representing the intrinsic \p DVI, for
+ /// example the assignment represented by a dbg.value.
+ DbgVariableRecord(const DbgVariableIntrinsic *DVI);
+ DbgVariableRecord(const DbgVariableRecord &DVR);
+ /// Directly construct a new DbgVariableRecord representing a dbg.value
+ /// intrinsic assigning \p Location to the DV / Expr / DI variable.
+ DbgVariableRecord(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
+ const DILocation *DI,
+ LocationType Type = LocationType::Value);
+ DbgVariableRecord(Metadata *Value, DILocalVariable *Variable,
+ DIExpression *Expression, DIAssignID *AssignID,
+ Metadata *Address, DIExpression *AddressExpression,
+ const DILocation *DI);
private:
/// Private constructor for creating new instances during parsing only. Only
- /// called through `createUnresolvedDPValue` below, which makes clear that
- /// this is used for parsing only, and will later return a subclass depending
- /// on which Type is passed.
- DPValue(LocationType Type, Metadata *Val, MDNode *Variable,
- MDNode *Expression, MDNode *AssignID, Metadata *Address,
- MDNode *AddressExpression, MDNode *DI);
+ /// called through `createUnresolvedDbgVariableRecord` below, which makes
+ /// clear that this is used for parsing only, and will later return a subclass
+ /// depending on which Type is passed.
+ DbgVariableRecord(LocationType Type, Metadata *Val, MDNode *Variable,
+ MDNode *Expression, MDNode *AssignID, Metadata *Address,
+ MDNode *AddressExpression, MDNode *DI);
public:
- /// Used to create DPValues during parsing, where some metadata references may
- /// still be unresolved. Although for some fields a generic `Metadata*`
- /// argument is accepted for forward type-references, the verifier and
- /// accessors will reject incorrect types later on. The function is used for
- /// all types of DPValues for simplicity while parsing, but asserts if any
- /// necessary fields are empty or unused fields are not empty, i.e. if the
- /// #dbg_assign fields are used for a non-dbg-assign type.
- static DPValue *createUnresolvedDPValue(LocationType Type, Metadata *Val,
- MDNode *Variable, MDNode *Expression,
- MDNode *AssignID, Metadata *Address,
- MDNode *AddressExpression,
- MDNode *DI);
-
- static DPValue *createDPVAssign(Value *Val, DILocalVariable *Variable,
- DIExpression *Expression,
- DIAssignID *AssignID, Value *Address,
- DIExpression *AddressExpression,
- const DILocation *DI);
- static DPValue *createLinkedDPVAssign(Instruction *LinkedInstr, Value *Val,
- DILocalVariable *Variable,
- DIExpression *Expression,
- Value *Address,
- DIExpression *AddressExpression,
- const DILocation *DI);
-
- static DPValue *createDPValue(Value *Location, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI);
- static DPValue *createDPValue(Value *Location, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI,
- DPValue &InsertBefore);
- static DPValue *createDPVDeclare(Value *Address, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI);
- static DPValue *createDPVDeclare(Value *Address, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI,
- DPValue &InsertBefore);
+ /// Used to create DbgVariableRecords during parsing, where some metadata
+ /// references may still be unresolved. Although for some fields a generic
+ /// `Metadata*` argument is accepted for forward type-references, the verifier
+ /// and accessors will reject incorrect types later on. The function is used
+ /// for all types of DbgVariableRecords for simplicity while parsing, but
+ /// asserts if any necessary fields are empty or unused fields are not empty,
+ /// i.e. if the #dbg_assign fields are used for a non-dbg-assign type.
+ static DbgVariableRecord *
+ createUnresolvedDbgVariableRecord(LocationType Type, Metadata *Val,
+ MDNode *Variable, MDNode *Expression,
+ MDNode *AssignID, Metadata *Address,
+ MDNode *AddressExpression, MDNode *DI);
+
+ static DbgVariableRecord *
+ createDVRAssign(Value *Val, DILocalVariable *Variable,
+ DIExpression *Expression, DIAssignID *AssignID,
+ Value *Address, DIExpression *AddressExpression,
+ const DILocation *DI);
+ static DbgVariableRecord *
+ createLinkedDVRAssign(Instruction *LinkedInstr, Value *Val,
+ DILocalVariable *Variable, DIExpression *Expression,
+ Value *Address, DIExpression *AddressExpression,
+ const DILocation *DI);
+
+ static DbgVariableRecord *createDbgVariableRecord(Value *Location,
+ DILocalVariable *DV,
+ DIExpression *Expr,
+ const DILocation *DI);
+ static DbgVariableRecord *
+ createDbgVariableRecord(Value *Location, DILocalVariable *DV,
+ DIExpression *Expr, const DILocation *DI,
+ DbgVariableRecord &InsertBefore);
+ static DbgVariableRecord *createDVRDeclare(Value *Address,
+ DILocalVariable *DV,
+ DIExpression *Expr,
+ const DILocation *DI);
+ static DbgVariableRecord *
+ createDVRDeclare(Value *Address, DILocalVariable *DV, DIExpression *Expr,
+ const DILocation *DI, DbgVariableRecord &InsertBefore);
/// Iterator for ValueAsMetadata that internally uses direct pointer iteration
/// over either a ValueAsMetadata* or a ValueAsMetadata**, dereferencing to the
@@ -412,7 +421,8 @@ class DPValue : public DbgRecord, protected DebugValueUser {
unsigned getNumVariableLocationOps() const;
bool hasArgList() const { return isa<DIArgList>(getRawLocation()); }
- /// Returns true if this DPValue has no empty MDNodes in its location list.
+ /// Returns true if this DbgVariableRecord has no empty MDNodes in its
+ /// location list.
bool hasValidLocation() const { return getVariableLocationOp(0) != nullptr; }
/// Does this describe the address of a local variable. True for dbg.addr
@@ -445,10 +455,10 @@ class DPValue : public DbgRecord, protected DebugValueUser {
/// replaceVariableLocationOp and addVariableLocationOps should be used where
/// possible to avoid creating invalid state.
void setRawLocation(Metadata *NewLocation) {
- assert(
- (isa<ValueAsMetadata>(NewLocation) || isa<DIArgList>(NewLocation) ||
- isa<MDNode>(NewLocation)) &&
- "Location for a DPValue must be either ValueAsMetadata or DIArgList");
+ assert((isa<ValueAsMetadata>(NewLocation) || isa<DIArgList>(NewLocation) ||
+ isa<MDNode>(NewLocation)) &&
+ "Location for a DbgVariableRecord must be either ValueAsMetadata or "
+ "DIArgList");
resetDebugValue(0, NewLocation);
}
@@ -456,12 +466,12 @@ class DPValue : public DbgRecord, protected DebugValueUser {
/// is described.
std::optional<uint64_t> getFragmentSizeInBits() const;
- bool isEquivalentTo(const DPValue &Other) const {
+ bool isEquivalentTo(const DbgVariableRecord &Other) const {
return DbgLoc == Other.DbgLoc && isIdenticalToWhenDefined(Other);
}
// Matches the definition of the Instruction version, equivalent to above but
// without checking DbgLoc.
- bool isIdenticalToWhenDefined(const DPValue &Other) const {
+ bool isIdenticalToWhenDefined(const DbgVariableRecord &Other) const {
return std::tie(Type, DebugValues, Variable, Expression,
AddressExpression) ==
std::tie(Other.Type, Other.DebugValues, Other.Variable,
@@ -497,10 +507,10 @@ class DPValue : public DbgRecord, protected DebugValueUser {
/// @}
- DPValue *clone() const;
- /// Convert this DPValue back into a dbg.value intrinsic.
+ DbgVariableRecord *clone() const;
+ /// Convert this DbgVariableRecord back into a dbg.value intrinsic.
/// \p InsertBefore Optional position to insert this intrinsic.
- /// \returns A new dbg.value intrinsic representiung this DPValue.
+ /// \returns A new dbg.value intrinsic representiung this DbgVariableRecord.
DbgVariableIntrinsic *createDebugIntrinsic(Module *M,
Instruction *InsertBefore) const;
@@ -517,12 +527,13 @@ class DPValue : public DbgRecord, protected DebugValueUser {
}
};
-/// Filter the DbgRecord range to DPValue types only and downcast.
+/// Filter the DbgRecord range to DbgVariableRecord types only and downcast.
static inline auto
filterDbgVars(iterator_range<simple_ilist<DbgRecord>::iterator> R) {
return map_range(
- make_filter_range(R, [](DbgRecord &E) { return isa<DPValue>(E); }),
- [](DbgRecord &E) { return std::ref(cast<DPValue>(E)); });
+ make_filter_range(R,
+ [](DbgRecord &E) { return isa<DbgVariableRecord>(E); }),
+ [](DbgRecord &E) { return std::ref(cast<DbgVariableRecord>(E)); });
}
/// Per-instruction record of debug-info. If an Instruction is the position of
diff --git a/llvm/include/llvm/IR/Metadata.h b/llvm/include/llvm/IR/Metadata.h
index da6744fdd09166..22da54a1f03c59 100644
--- a/llvm/include/llvm/IR/Metadata.h
+++ b/llvm/include/llvm/IR/Metadata.h
@@ -43,7 +43,7 @@ namespace llvm {
class Module;
class ModuleSlotTracker;
class raw_ostream;
-class DPValue;
+class DbgVariableRecord;
template <typename T> class StringMapEntry;
template <typename ValueTy> class StringMapEntryStorage;
class Type;
@@ -205,23 +205,23 @@ class MetadataAsValue : public Value {
/// Base class for tracking ValueAsMetadata/DIArgLists with user lookups and
/// Owner callbacks outside of ValueAsMetadata.
///
-/// Currently only inherited by DPValue; if other classes need to use it, then
-/// a SubclassID will need to be added (either as a new field or by making
-/// DebugValue into a PointerIntUnion) to discriminate between the subclasses in
-/// lookup and callback handling.
+/// Currently only inherited by DbgVariableRecord; if other classes need to use
+/// it, then a SubclassID will need to be added (either as a new field or by
+/// making DebugValue into a PointerIntUnion) to discriminate between the
+/// subclasses in lookup and callback handling.
class DebugValueUser {
protected:
// Capacity to store 3 debug values.
// TODO: Not all DebugValueUser instances need all 3 elements, if we
- // restructure the DPValue class then we can template parameterize this array
- // size.
+ // restructure the DbgVariableRecord class then we can template parameterize
+ // this array size.
std::array<Metadata *, 3> DebugValues;
ArrayRef<Metadata *> getDebugValues() const { return DebugValues; }
public:
- DPValue *getUser();
- const DPValue *getUser() const;
+ DbgVariableRecord *getUser();
+ const DbgVariableRecord *getUser() const;
/// To be called by ReplaceableMetadataImpl::replaceAllUsesWith, where `Old`
/// is a pointer to one of the pointers in `DebugValues` (so should be type
/// Metadata**), and `NewDebugValue` is the new Metadata* that is replacing
@@ -407,8 +407,8 @@ class ReplaceableMetadataImpl {
static void SalvageDebugInfo(const Constant &C);
/// Returns the list of all DIArgList users of this.
SmallVector<Metadata *> getAllArgListUsers();
- /// Returns the list of all DPValue users of this.
- SmallVector<DPValue *> getAllDPValueUsers();
+ /// Returns the list of all DbgVariableRecord users of this.
+ SmallVector<DbgVariableRecord *> getAllDbgVariableRecordUsers();
/// Resolve all uses of this.
///
@@ -494,8 +494,8 @@ class ValueAsMetadata : public Metadata, ReplaceableMetadataImpl {
SmallVector<Metadata *> getAllArgListUsers() {
return ReplaceableMetadataImpl::getAllArgListUsers();
}
- SmallVector<DPValue *> getAllDPValueUsers() {
- return ReplaceableMetadataImpl::getAllDPValueUsers();
+ SmallVector<DbgVariableRecord *> getAllDbgVariableRecordUsers() {
+ return ReplaceableMetadataImpl::getAllDbgVariableRecordUsers();
}
static void handleDeletion(Value *V);
diff --git a/llvm/include/llvm/Transforms/Utils/Local.h b/llvm/include/llvm/Transforms/Utils/Local.h
index cc133628743629..9ae026fa95d21a 100644
--- a/llvm/include/llvm/Transforms/Utils/Local.h
+++ b/llvm/include/llvm/Transforms/Utils/Local.h
@@ -262,21 +262,21 @@ CallInst *changeToCall(InvokeInst *II, DomTreeUpdater *DTU = nullptr);
/// that has an associated llvm.dbg.declare intrinsic.
void ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII,
StoreInst *SI, DIBuilder &Builder);
-void ConvertDebugDeclareToDebugValue(DPValue *DPV, StoreInst *SI,
+void ConvertDebugDeclareToDebugValue(DbgVariableRecord *DVR, StoreInst *SI,
DIBuilder &Builder);
/// Inserts a llvm.dbg.value intrinsic before a load of an alloca'd value
/// that has an associated llvm.dbg.declare intrinsic.
void ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII,
LoadInst *LI, DIBuilder &Builder);
-void ConvertDebugDeclareToDebugValue(DPValue *DPV, LoadInst *LI,
+void ConvertDebugDeclareToDebugValue(DbgVariableRecord *DVR, LoadInst *LI,
DIBuilder &Builder);
/// Inserts a llvm.dbg.value intrinsic after a phi that has an associated
/// llvm.dbg.declare intrinsic.
void ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII,
PHINode *LI, DIBuilder &Builder);
-void ConvertDebugDeclareToDebugValue(DPValue *DPV, PHINode *LI,
+void ConvertDebugDeclareToDebugValue(DbgVariableRecord *DVR, PHINode *LI,
DIBuilder &Builder);
/// Lowers llvm.dbg.declare intrinsics into appropriate set of
@@ -313,7 +313,7 @@ void salvageDebugInfo(Instruction &I);
/// Mark undef if salvaging cannot be completed.
void salvageDebugInfoForDbgValues(Instruction &I,
ArrayRef<DbgVariableIntrinsic *> Insns,
- ArrayRef<DPValue *> DPInsns);
+ ArrayRef<DbgVariableRecord *> DPInsns);
/// Given an instruction \p I and DIExpression \p DIExpr operating on
/// it, append the effects of \p I to the DIExpression operand list
diff --git a/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h b/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
index eb00e6c4e856df..65dfbe27590b6d 100644
--- a/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
+++ b/llvm/include/llvm/Transforms/Utils/MemoryTaggingSupport.h
@@ -53,7 +53,7 @@ struct AllocaInfo {
SmallVector<IntrinsicInst *, 2> LifetimeEnd;
SmallVector<DbgVariableIntrinsic *, 2> DbgVariableIntrinsics;
// Non-intrinsic records of variable locations.
- SmallVector<DPValue *, 2> DbgVariableRecords;
+ SmallVector<DbgVariableRecord *, 2> DbgVariableRecords;
};
struct StackInfo {
diff --git a/llvm/include/llvm/Transforms/Utils/SSAUpdater.h b/llvm/include/llvm/Transforms/Utils/SSAUpdater.h
index c79d436fc676bb..29d96a0ab6bf5b 100644
--- a/llvm/include/llvm/Transforms/Utils/SSAUpdater.h
+++ b/llvm/include/llvm/Transforms/Utils/SSAUpdater.h
@@ -23,7 +23,7 @@ class BasicBlock;
class Instruction;
class LoadInst;
class PHINode;
-class DPValue;
+class DbgVariableRecord;
template <typename T> class SmallVectorImpl;
template <typename T> class SSAUpdaterTraits;
class Type;
@@ -124,7 +124,8 @@ class SSAUpdater {
void UpdateDebugValues(Instruction *I);
void UpdateDebugValues(Instruction *I,
SmallVectorImpl<DbgValueInst *> &DbgValues);
- void UpdateDebugValues(Instruction *I, SmallVectorImpl<DPValue *> &DbgValues);
+ void UpdateDebugValues(Instruction *I,
+ SmallVectorImpl<DbgVariableRecord *> &DbgValues);
/// Rewrite a use like \c RewriteUse but handling in-block definitions.
///
@@ -136,7 +137,7 @@ class SSAUpdater {
private:
Value *GetValueAtEndOfBlockInternal(BasicBlock *BB);
void UpdateDebugValue(Instruction *I, DbgValueInst *DbgValue);
- void UpdateDebugValue(Instruction *I, DPValue *DbgValue);
+ void UpdateDebugValue(Instruction *I, DbgVariableRecord *DbgValue);
};
/// Helper class for promoting a collection of loads and stores into SSA
diff --git a/llvm/include/llvm/Transforms/Utils/ValueMapper.h b/llvm/include/llvm/Transforms/Utils/ValueMapper.h
index dd183bc04f0c24..54e3e62dc3af50 100644
--- a/llvm/include/llvm/Transforms/Utils/ValueMapper.h
+++ b/llvm/include/llvm/Transforms/Utils/ValueMapper.h
@@ -180,8 +180,9 @@ class ValueMapper {
Constant *mapConstant(const Constant &C);
void remapInstruction(Instruction &I);
- void remapDPValue(Module *M, DPValue &V);
- void remapDPValueRange(Module *M, iterator_range<DbgRecordIterator> Range);
+ void remapDbgVariableRecord(Module *M, DbgVariableRecord &V);
+ void remapDbgVariableRecordRange(Module *M,
+ iterator_range<DbgRecordIterator> Range);
void remapFunction(Function &F);
void remapGlobalObjectMetadata(GlobalObject &GO);
@@ -267,21 +268,26 @@ inline void RemapInstruction(Instruction *I, ValueToValueMapTy &VM,
ValueMapper(VM, Flags, TypeMapper, Materializer).remapInstruction(*I);
}
-/// Remap the Values used in the DPValue \a V using the value map \a VM.
-inline void RemapDPValue(Module *M, DPValue *V, ValueToValueMapTy &VM,
- RemapFlags Flags = RF_None,
- ValueMapTypeRemapper *TypeMapper = nullptr,
- ValueMaterializer *Materializer = nullptr) {
- ValueMapper(VM, Flags, TypeMapper, Materializer).remapDPValue(M, *V);
+/// Remap the Values used in the DbgVariableRecord \a V using the value map \a
+/// VM.
+inline void RemapDbgVariableRecord(Module *M, DbgVariableRecord *V,
+ ValueToValueMapTy &VM,
+ RemapFlags Flags = RF_None,
+ ValueMapTypeRemapper *TypeMapper = nullptr,
+ ValueMaterializer *Materializer = nullptr) {
+ ValueMapper(VM, Flags, TypeMapper, Materializer)
+ .remapDbgVariableRecord(M, *V);
}
-/// Remap the Values used in the DPValue \a V using the value map \a VM.
-inline void RemapDPValueRange(Module *M,
- iterator_range<DbgRecordIterator> Range,
- ValueToValueMapTy &VM, RemapFlags Flags = RF_None,
- ValueMapTypeRemapper *TypeMapper = nullptr,
- ValueMaterializer *Materializer = nullptr) {
- ValueMapper(VM, Flags, TypeMapper, Materializer).remapDPValueRange(M, Range);
+/// Remap the Values used in the DbgVariableRecord \a V using the value map \a
+/// VM.
+inline void
+RemapDbgVariableRecordRange(Module *M, iterator_range<DbgRecordIterator> Range,
+ ValueToValueMapTy &VM, RemapFlags Flags = RF_None,
+ ValueMapTypeRemapper *TypeMapper = nullptr,
+ ValueMaterializer *Materializer = nullptr) {
+ ValueMapper(VM, Flags, TypeMapper, Materializer)
+ .remapDbgVariableRecordRange(M, Range);
}
/// Remap the operands, metadata, arguments, and instructions of a function.
diff --git a/llvm/lib/AsmParser/LLParser.cpp b/llvm/lib/AsmParser/LLParser.cpp
index 2e0f5ba82220c9..680230f9ea5b62 100644
--- a/llvm/lib/AsmParser/LLParser.cpp
+++ b/llvm/lib/AsmParser/LLParser.cpp
@@ -6543,10 +6543,10 @@ bool LLParser::parseBasicBlock(PerFunctionState &PFS) {
/// (MDNode ',' Metadata ',' Metadata ',')? MDNode ')'
bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
using RecordKind = DbgRecord::Kind;
- using LocType = DPValue::LocationType;
- LocTy DPVLoc = Lex.getLoc();
+ using LocType = DbgVariableRecord::LocationType;
+ LocTy DVRLoc = Lex.getLoc();
if (Lex.getKind() != lltok::DbgRecordType)
- return error(DPVLoc, "expected debug record type here");
+ return error(DVRLoc, "expected debug record type here");
RecordKind RecordType = StringSwitch<RecordKind>(Lex.getStrVal())
.Case("declare", RecordKind::ValueKind)
.Case("value", RecordKind::ValueKind)
@@ -6554,7 +6554,7 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
.Case("label", RecordKind::LabelKind);
// Parsing labels is trivial; parse here and early exit, otherwise go into the
- // full DPValue processing stage.
+ // full DbgVariableRecord processing stage.
if (RecordType == RecordKind::LabelKind) {
Lex.Lex();
if (parseToken(lltok::lparen, "Expected '(' here"))
@@ -6634,9 +6634,9 @@ bool LLParser::parseDebugRecord(DbgRecord *&DR, PerFunctionState &PFS) {
if (parseToken(lltok::rparen, "Expected ')' here"))
return true;
- DR = DPValue::createUnresolvedDPValue(ValueType, ValLocMD, Variable,
- Expression, AssignID, AddressLocation,
- AddressExpression, DebugLoc);
+ DR = DbgVariableRecord::createUnresolvedDbgVariableRecord(
+ ValueType, ValLocMD, Variable, Expression, AssignID, AddressLocation,
+ AddressExpression, DebugLoc);
return false;
}
//===----------------------------------------------------------------------===//
diff --git a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
index 52774c7d73225f..09177950fc8246 100644
--- a/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
+++ b/llvm/lib/CodeGen/AssignmentTrackingAnalysis.cpp
@@ -215,7 +215,8 @@ void FunctionVarLocs::init(FunctionVarLocsBuilder &Builder) {
// Insert a contiguous block of VarLocInfos for each instruction, mapping it
// to the start and end position in the vector with VarLocsBeforeInst. This
- // block includes VarLocs for any DPValues attached to that instruction.
+ // block includes VarLocs for any DbgVariableRecords attached to that
+ // instruction.
for (auto &P : Builder.VarLocsBeforeInst) {
// Process VarLocs attached to a DbgRecord alongside their marker
// Instruction.
@@ -226,12 +227,12 @@ void FunctionVarLocs::init(FunctionVarLocsBuilder &Builder) {
// Any VarLocInfos attached to a DbgRecord should now be remapped to their
// marker Instruction, in order of DbgRecord appearance and prior to any
// VarLocInfos attached directly to that instruction.
- for (const DPValue &DPV : filterDbgVars(I->getDbgRecordRange())) {
- // Even though DPV defines a variable location, VarLocsBeforeInst can
+ for (const DbgVariableRecord &DVR : filterDbgVars(I->getDbgRecordRange())) {
+ // Even though DVR defines a variable location, VarLocsBeforeInst can
// still be empty if that VarLoc was redundant.
- if (!Builder.VarLocsBeforeInst.count(&DPV))
+ if (!Builder.VarLocsBeforeInst.count(&DVR))
continue;
- for (const VarLocInfo &VarLoc : Builder.VarLocsBeforeInst[&DPV])
+ for (const VarLocInfo &VarLoc : Builder.VarLocsBeforeInst[&DVR])
VarLocRecords.emplace_back(VarLoc);
}
for (const VarLocInfo &VarLoc : P.second)
@@ -830,10 +831,10 @@ class MemLocFragmentFill {
void process(BasicBlock &BB, VarFragMap &LiveSet) {
BBInsertBeforeMap[&BB].clear();
for (auto &I : BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
- if (const auto *Locs = FnVarLocs->getWedge(&DPV)) {
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (const auto *Locs = FnVarLocs->getWedge(&DVR)) {
for (const VarLocInfo &Loc : *Locs) {
- addDef(Loc, &DPV, *I.getParent(), LiveSet);
+ addDef(Loc, &DVR, *I.getParent(), LiveSet);
}
}
}
@@ -1027,7 +1028,7 @@ class AssignmentTrackingLowering {
/// i.e. for all values x and y where x != y:
/// join(x, x) = x
/// join(x, y) = NoneOrPhi
- using AssignRecord = PointerUnion<DbgAssignIntrinsic *, DPValue *>;
+ using AssignRecord = PointerUnion<DbgAssignIntrinsic *, DbgVariableRecord *>;
struct Assignment {
enum S { Known, NoneOrPhi } Status;
/// ID of the assignment. nullptr if Status is not Known.
@@ -1054,16 +1055,16 @@ class AssignmentTrackingLowering {
else if (isa<DbgAssignIntrinsic *>(Source))
OS << Source.get<DbgAssignIntrinsic *>();
else
- OS << Source.get<DPValue *>();
+ OS << Source.get<DbgVariableRecord *>();
OS << ")";
}
static Assignment make(DIAssignID *ID, DbgAssignIntrinsic *Source) {
return Assignment(Known, ID, Source);
}
- static Assignment make(DIAssignID *ID, DPValue *Source) {
+ static Assignment make(DIAssignID *ID, DbgVariableRecord *Source) {
assert(Source->isDbgAssign() &&
- "Cannot make an assignment from a non-assign DPValue");
+ "Cannot make an assignment from a non-assign DbgVariableRecord");
return Assignment(Known, ID, Source);
}
static Assignment make(DIAssignID *ID, AssignRecord Source) {
@@ -1084,7 +1085,7 @@ class AssignmentTrackingLowering {
// If the Status is Known then we expect there to be an assignment ID.
assert(Status == NoneOrPhi || ID);
}
- Assignment(S Status, DIAssignID *ID, DPValue *Source)
+ Assignment(S Status, DIAssignID *ID, DbgVariableRecord *Source)
: Status(Status), ID(ID), Source(Source) {
// If the Status is Known then we expect there to be an assignment ID.
assert(Status == NoneOrPhi || ID);
@@ -1119,10 +1120,10 @@ class AssignmentTrackingLowering {
/// Clear the location definitions currently cached for insertion after /p
/// After.
void resetInsertionPoint(Instruction &After);
- void resetInsertionPoint(DPValue &After);
+ void resetInsertionPoint(DbgVariableRecord &After);
// emitDbgValue can be called with:
- // Source=[AssignRecord|DbgValueInst*|DbgAssignIntrinsic*|DPValue*]
+ // Source=[AssignRecord|DbgValueInst*|DbgAssignIntrinsic*|DbgVariableRecord*]
// Since AssignRecord can be cast to one of the latter two types, and all
// other types have a shared interface, we use a template to handle the latter
// three types, and an explicit overload for AssignRecord that forwards to
@@ -1355,9 +1356,10 @@ class AssignmentTrackingLowering {
/// attachment, \p I.
void processUntaggedInstruction(Instruction &I, BlockInfo *LiveSet);
void processDbgAssign(AssignRecord Assign, BlockInfo *LiveSet);
- void processDPValue(DPValue &DPV, BlockInfo *LiveSet);
- void processDbgValue(PointerUnion<DbgValueInst *, DPValue *> DbgValueRecord,
- BlockInfo *LiveSet);
+ void processDbgVariableRecord(DbgVariableRecord &DVR, BlockInfo *LiveSet);
+ void processDbgValue(
+ PointerUnion<DbgValueInst *, DbgVariableRecord *> DbgValueRecord,
+ BlockInfo *LiveSet);
/// Add an assignment to memory for the variable /p Var.
void addMemDef(BlockInfo *LiveSet, VariableID Var, const Assignment &AV);
/// Add an assignment to the variable /p Var.
@@ -1457,10 +1459,10 @@ static DIAssignID *getIDFromMarker(const DbgAssignIntrinsic &DAI) {
return cast<DIAssignID>(DAI.getAssignID());
}
-static DIAssignID *getIDFromMarker(const DPValue &DPV) {
- assert(DPV.isDbgAssign() &&
- "Cannot get a DIAssignID from a non-assign DPValue!");
- return DPV.getAssignID();
+static DIAssignID *getIDFromMarker(const DbgVariableRecord &DVR) {
+ assert(DVR.isDbgAssign() &&
+ "Cannot get a DIAssignID from a non-assign DbgVariableRecord!");
+ return DVR.getAssignID();
}
/// Return true if \p Var has an assignment in \p M matching \p AV.
@@ -1493,10 +1495,10 @@ const char *locStr(AssignmentTrackingLowering::LocKind Loc) {
}
#endif
-VarLocInsertPt getNextNode(const DbgRecord *DPV) {
- auto NextIt = ++(DPV->getIterator());
- if (NextIt == DPV->getMarker()->getDbgRecordRange().end())
- return DPV->getMarker()->MarkedInstr;
+VarLocInsertPt getNextNode(const DbgRecord *DVR) {
+ auto NextIt = ++(DVR->getIterator());
+ if (NextIt == DVR->getMarker()->getDbgRecordRange().end())
+ return DVR->getMarker()->MarkedInstr;
return &*NextIt;
}
VarLocInsertPt getNextNode(const Instruction *Inst) {
@@ -1515,10 +1517,10 @@ DbgAssignIntrinsic *CastToDbgAssign(DbgVariableIntrinsic *DVI) {
return cast<DbgAssignIntrinsic>(DVI);
}
-DPValue *CastToDbgAssign(DPValue *DPV) {
- assert(DPV->isDbgAssign() &&
- "Attempted to cast non-assign DPValue to DPVAssign.");
- return DPV;
+DbgVariableRecord *CastToDbgAssign(DbgVariableRecord *DVR) {
+ assert(DVR->isDbgAssign() &&
+ "Attempted to cast non-assign DbgVariableRecord to DVRAssign.");
+ return DVR;
}
void AssignmentTrackingLowering::emitDbgValue(
@@ -1527,7 +1529,7 @@ void AssignmentTrackingLowering::emitDbgValue(
if (isa<DbgAssignIntrinsic *>(Source))
emitDbgValue(Kind, cast<DbgAssignIntrinsic *>(Source), After);
else
- emitDbgValue(Kind, cast<DPValue *>(Source), After);
+ emitDbgValue(Kind, cast<DbgVariableRecord *>(Source), After);
}
template <typename T>
void AssignmentTrackingLowering::emitDbgValue(
@@ -1674,7 +1676,7 @@ void AssignmentTrackingLowering::processUntaggedInstruction(
void AssignmentTrackingLowering::processTaggedInstruction(
Instruction &I, AssignmentTrackingLowering::BlockInfo *LiveSet) {
auto Linked = at::getAssignmentMarkers(&I);
- auto LinkedDPAssigns = at::getDPVAssignmentMarkers(&I);
+ auto LinkedDPAssigns = at::getDVRAssignmentMarkers(&I);
// No dbg.assign intrinsics linked.
// FIXME: All vars that have a stack slot this store modifies that don't have
// a dbg.assign linked to it should probably treat this like an untagged
@@ -1757,8 +1759,8 @@ void AssignmentTrackingLowering::processTaggedInstruction(
};
for (DbgAssignIntrinsic *DAI : Linked)
ProcessLinkedAssign(DAI);
- for (DPValue *DPV : LinkedDPAssigns)
- ProcessLinkedAssign(DPV);
+ for (DbgVariableRecord *DVR : LinkedDPAssigns)
+ ProcessLinkedAssign(DVR);
}
void AssignmentTrackingLowering::processDbgAssign(AssignRecord Assign,
@@ -1803,13 +1805,13 @@ void AssignmentTrackingLowering::processDbgAssign(AssignRecord Assign,
emitDbgValue(LocKind::Val, DbgAssign, DbgAssign);
}
};
- if (isa<DPValue *>(Assign))
- return ProcessDbgAssignImpl(cast<DPValue *>(Assign));
+ if (isa<DbgVariableRecord *>(Assign))
+ return ProcessDbgAssignImpl(cast<DbgVariableRecord *>(Assign));
return ProcessDbgAssignImpl(cast<DbgAssignIntrinsic *>(Assign));
}
void AssignmentTrackingLowering::processDbgValue(
- PointerUnion<DbgValueInst *, DPValue *> DbgValueRecord,
+ PointerUnion<DbgValueInst *, DbgVariableRecord *> DbgValueRecord,
BlockInfo *LiveSet) {
auto ProcessDbgValueImpl = [&](auto *DbgValue) {
// Only other tracking variables that are at some point stack homed.
@@ -1834,8 +1836,8 @@ void AssignmentTrackingLowering::processDbgValue(
setLocKind(LiveSet, Var, LocKind::Val);
emitDbgValue(LocKind::Val, DbgValue, DbgValue);
};
- if (isa<DPValue *>(DbgValueRecord))
- return ProcessDbgValueImpl(cast<DPValue *>(DbgValueRecord));
+ if (isa<DbgVariableRecord *>(DbgValueRecord))
+ return ProcessDbgValueImpl(cast<DbgVariableRecord *>(DbgValueRecord));
return ProcessDbgValueImpl(cast<DbgValueInst *>(DbgValueRecord));
}
@@ -1860,16 +1862,16 @@ void AssignmentTrackingLowering::processDbgInstruction(
else if (auto *DVI = dyn_cast<DbgValueInst>(&I))
processDbgValue(DVI, LiveSet);
}
-void AssignmentTrackingLowering::processDPValue(
- DPValue &DPV, AssignmentTrackingLowering::BlockInfo *LiveSet) {
+void AssignmentTrackingLowering::processDbgVariableRecord(
+ DbgVariableRecord &DVR, AssignmentTrackingLowering::BlockInfo *LiveSet) {
// Ignore assignments to zero bits of the variable.
- if (hasZeroSizedFragment(DPV))
+ if (hasZeroSizedFragment(DVR))
return;
- if (DPV.isDbgAssign())
- processDbgAssign(&DPV, LiveSet);
- else if (DPV.isDbgValue())
- processDbgValue(&DPV, LiveSet);
+ if (DVR.isDbgAssign())
+ processDbgAssign(&DVR, LiveSet);
+ else if (DVR.isDbgValue())
+ processDbgValue(&DVR, LiveSet);
}
void AssignmentTrackingLowering::resetInsertionPoint(Instruction &After) {
@@ -1879,7 +1881,7 @@ void AssignmentTrackingLowering::resetInsertionPoint(Instruction &After) {
return;
R->second.clear();
}
-void AssignmentTrackingLowering::resetInsertionPoint(DPValue &After) {
+void AssignmentTrackingLowering::resetInsertionPoint(DbgVariableRecord &After) {
auto *R = InsertBeforeMap.find(getNextNode(&After));
if (R == InsertBeforeMap.end())
return;
@@ -1919,9 +1921,9 @@ void AssignmentTrackingLowering::process(BasicBlock &BB, BlockInfo *LiveSet) {
// 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 : filterDbgVars(II->getDbgRecordRange())) {
- resetInsertionPoint(DPV);
- processDPValue(DPV, LiveSet);
+ for (DbgVariableRecord &DVR : filterDbgVars(II->getDbgRecordRange())) {
+ resetInsertionPoint(DVR);
+ processDbgVariableRecord(DVR, LiveSet);
assert(LiveSet->isValid());
}
}
@@ -2000,9 +2002,11 @@ AssignmentTrackingLowering::joinAssignment(const Assignment &A,
return A.Source;
if (!A.Source || !B.Source)
return AssignRecord();
- assert(isa<DPValue *>(A.Source) == isa<DPValue *>(B.Source));
- if (isa<DPValue *>(A.Source) &&
- cast<DPValue *>(A.Source)->isEquivalentTo(*cast<DPValue *>(B.Source)))
+ assert(isa<DbgVariableRecord *>(A.Source) ==
+ isa<DbgVariableRecord *>(B.Source));
+ if (isa<DbgVariableRecord *>(A.Source) &&
+ cast<DbgVariableRecord *>(A.Source)->isEquivalentTo(
+ *cast<DbgVariableRecord *>(B.Source)))
return A.Source;
if (isa<DbgAssignIntrinsic *>(A.Source) &&
cast<DbgAssignIntrinsic *>(A.Source)->isIdenticalTo(
@@ -2123,8 +2127,8 @@ DbgDeclareInst *DynCastToDbgDeclare(DbgVariableIntrinsic *DVI) {
return dyn_cast<DbgDeclareInst>(DVI);
}
-DPValue *DynCastToDbgDeclare(DPValue *DPV) {
- return DPV->isDbgDeclare() ? DPV : nullptr;
+DbgVariableRecord *DynCastToDbgDeclare(DbgVariableRecord *DVR) {
+ return DVR->isDbgDeclare() ? DVR : nullptr;
}
/// Build a map of {Variable x: Variables y} where all variable fragments
@@ -2161,7 +2165,7 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
// We need to add fragments for untagged stores too so that we can correctly
// clobber overlapped fragment locations later.
SmallVector<DbgDeclareInst *> InstDeclares;
- SmallVector<DPValue *> DPDeclares;
+ SmallVector<DbgVariableRecord *> DPDeclares;
auto ProcessDbgRecord = [&](auto *Record, auto &DeclareList) {
if (auto *Declare = DynCastToDbgDeclare(Record)) {
DeclareList.push_back(Declare);
@@ -2176,8 +2180,8 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
};
for (auto &BB : Fn) {
for (auto &I : BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- ProcessDbgRecord(&DPV, DPDeclares);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ ProcessDbgRecord(&DVR, DPDeclares);
if (auto *DII = dyn_cast<DbgVariableIntrinsic>(&I)) {
ProcessDbgRecord(DII, InstDeclares);
} else if (auto Info = getUntaggedStoreAssignmentInfo(
@@ -2218,8 +2222,8 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
};
for (DbgAssignIntrinsic *DAI : at::getAssignmentMarkers(Info->Base))
HandleDbgAssignForStore(DAI);
- for (DPValue *DPV : at::getDPVAssignmentMarkers(Info->Base))
- HandleDbgAssignForStore(DPV);
+ for (DbgVariableRecord *DVR : at::getDVRAssignmentMarkers(Info->Base))
+ HandleDbgAssignForStore(DVR);
}
}
}
@@ -2269,10 +2273,10 @@ static AssignmentTrackingLowering::OverlapMap buildOverlapMapAndRecordDeclares(
for (auto *DDI : InstDeclares)
FnVarLocs->addSingleLocVar(DebugVariable(DDI), DDI->getExpression(),
DDI->getDebugLoc(), DDI->getWrappedLocation());
- for (auto *DPV : DPDeclares)
- FnVarLocs->addSingleLocVar(DebugVariable(DPV), DPV->getExpression(),
- DPV->getDebugLoc(),
- RawLocationWrapper(DPV->getRawLocation()));
+ for (auto *DVR : DPDeclares)
+ FnVarLocs->addSingleLocVar(DebugVariable(DVR), DVR->getExpression(),
+ DVR->getDebugLoc(),
+ RawLocationWrapper(DVR->getRawLocation()));
return Map;
}
@@ -2466,9 +2470,9 @@ bool AssignmentTrackingLowering::emitPromotedVarLocs(
for (auto &BB : Fn) {
for (auto &I : BB) {
// Skip instructions other than dbg.values and dbg.assigns.
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- if (DPV.isDbgValue() || DPV.isDbgAssign())
- TranslateDbgRecord(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ if (DVR.isDbgValue() || DVR.isDbgAssign())
+ TranslateDbgRecord(&DVR);
auto *DVI = dyn_cast<DbgValueInst>(&I);
if (DVI)
TranslateDbgRecord(DVI);
@@ -2568,8 +2572,8 @@ removeRedundantDbgLocsUsingBackwardScan(const BasicBlock *BB,
}
};
HandleLocsForWedge(&I);
- for (DPValue &DPV : reverse(filterDbgVars(I.getDbgRecordRange())))
- HandleLocsForWedge(&DPV);
+ for (DbgVariableRecord &DVR : reverse(filterDbgVars(I.getDbgRecordRange())))
+ HandleLocsForWedge(&DVR);
}
return Changed;
@@ -2633,8 +2637,8 @@ removeRedundantDbgLocsUsingForwardScan(const BasicBlock *BB,
}
};
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- HandleLocsForWedge(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ HandleLocsForWedge(&DVR);
HandleLocsForWedge(&I);
}
@@ -2719,8 +2723,8 @@ removeUndefDbgLocsFromEntryBlock(const BasicBlock *BB,
Changed = true;
}
};
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- HandleLocsForWedge(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ HandleLocsForWedge(&DVR);
HandleLocsForWedge(&I);
}
@@ -2753,8 +2757,8 @@ static DenseSet<DebugAggregate> findVarsWithStackSlot(Function &Fn) {
for (DbgAssignIntrinsic *DAI : at::getAssignmentMarkers(&I)) {
Result.insert({DAI->getVariable(), DAI->getDebugLoc().getInlinedAt()});
}
- for (DPValue *DPV : at::getDPVAssignmentMarkers(&I)) {
- Result.insert({DPV->getVariable(), DPV->getDebugLoc().getInlinedAt()});
+ for (DbgVariableRecord *DVR : at::getDVRAssignmentMarkers(&I)) {
+ Result.insert({DVR->getVariable(), DVR->getDebugLoc().getInlinedAt()});
}
}
}
diff --git a/llvm/lib/CodeGen/CodeGenPrepare.cpp b/llvm/lib/CodeGen/CodeGenPrepare.cpp
index bece70a6e008bc..270b27f32ca020 100644
--- a/llvm/lib/CodeGen/CodeGenPrepare.cpp
+++ b/llvm/lib/CodeGen/CodeGenPrepare.cpp
@@ -445,8 +445,8 @@ class CodeGenPrepare {
bool optimizeExtractElementInst(Instruction *Inst);
bool dupRetToEnableTailCallOpts(BasicBlock *BB, ModifyDT &ModifiedDT);
bool fixupDbgValue(Instruction *I);
- bool fixupDPValue(DPValue &I);
- bool fixupDPValuesOnInst(Instruction &I);
+ bool fixupDbgVariableRecord(DbgVariableRecord &I);
+ bool fixupDbgVariableRecordsOnInst(Instruction &I);
bool placeDbgValues(Function &F);
bool placePseudoProbes(Function &F);
bool canFormExtLd(const SmallVectorImpl<Instruction *> &MovedExts,
@@ -3187,7 +3187,7 @@ class TypePromotionTransaction {
/// Keep track of the debug users.
SmallVector<DbgValueInst *, 1> DbgValues;
/// And non-instruction debug-users too.
- SmallVector<DPValue *, 1> DPValues;
+ SmallVector<DbgVariableRecord *, 1> DbgVariableRecords;
/// Keep track of the new value so that we can undo it by replacing
/// instances of the new value with the original value.
@@ -3208,7 +3208,7 @@ class TypePromotionTransaction {
}
// Record the debug uses separately. They are not in the instruction's
// use list, but they are replaced by RAUW.
- findDbgValues(DbgValues, Inst, &DPValues);
+ findDbgValues(DbgValues, Inst, &DbgVariableRecords);
// Now, we can replace the uses.
Inst->replaceAllUsesWith(New);
@@ -3225,10 +3225,11 @@ class TypePromotionTransaction {
// correctness and utility of debug value instructions.
for (auto *DVI : DbgValues)
DVI->replaceVariableLocationOp(New, Inst);
- // Similar story with DPValues, the non-instruction representation of
- // dbg.values.
- for (DPValue *DPV : DPValues) // tested by transaction-test I'm adding
- DPV->replaceVariableLocationOp(New, Inst);
+ // Similar story with DbgVariableRecords, the non-instruction
+ // representation of dbg.values.
+ for (DbgVariableRecord *DVR :
+ DbgVariableRecords) // tested by transaction-test I'm adding
+ DVR->replaceVariableLocationOp(New, Inst);
}
};
@@ -7080,9 +7081,9 @@ bool CodeGenPrepare::optimizeSelectInst(SelectInst *SI) {
CurInstIterator = std::next(LastSI->getIterator());
// Examine debug-info attached to the consecutive select instructions. They
// won't be individually optimised by optimizeInst, so we need to perform
- // DPValue maintenence here instead.
+ // DbgVariableRecord maintenence here instead.
for (SelectInst *SI : ArrayRef(ASI).drop_front())
- fixupDPValuesOnInst(*SI);
+ fixupDbgVariableRecordsOnInst(*SI);
bool VectorCond = !SI->getCondition()->getType()->isIntegerTy(1);
@@ -8238,7 +8239,7 @@ static bool optimizeBranch(BranchInst *Branch, const TargetLowering &TLI,
bool CodeGenPrepare::optimizeInst(Instruction *I, ModifyDT &ModifiedDT) {
bool AnyChange = false;
- AnyChange = fixupDPValuesOnInst(*I);
+ AnyChange = fixupDbgVariableRecordsOnInst(*I);
// Bail out if we inserted the instruction to prevent optimizations from
// stepping on each other's toes.
@@ -8504,24 +8505,24 @@ bool CodeGenPrepare::fixupDbgValue(Instruction *I) {
return AnyChange;
}
-bool CodeGenPrepare::fixupDPValuesOnInst(Instruction &I) {
+bool CodeGenPrepare::fixupDbgVariableRecordsOnInst(Instruction &I) {
bool AnyChange = false;
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- AnyChange |= fixupDPValue(DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ AnyChange |= fixupDbgVariableRecord(DVR);
return AnyChange;
}
// FIXME: should updating debug-info really cause the "changed" flag to fire,
// which can cause a function to be reprocessed?
-bool CodeGenPrepare::fixupDPValue(DPValue &DPV) {
- if (DPV.Type != DPValue::LocationType::Value &&
- DPV.Type != DPValue::LocationType::Assign)
+bool CodeGenPrepare::fixupDbgVariableRecord(DbgVariableRecord &DVR) {
+ if (DVR.Type != DbgVariableRecord::LocationType::Value &&
+ DVR.Type != DbgVariableRecord::LocationType::Assign)
return false;
- // Does this DPValue refer to a sunk address calculation?
+ // Does this DbgVariableRecord refer to a sunk address calculation?
bool AnyChange = false;
- SmallDenseSet<Value *> LocationOps(DPV.location_ops().begin(),
- DPV.location_ops().end());
+ SmallDenseSet<Value *> LocationOps(DVR.location_ops().begin(),
+ DVR.location_ops().end());
for (Value *Location : LocationOps) {
WeakTrackingVH SunkAddrVH = SunkAddrs[Location];
Value *SunkAddr = SunkAddrVH.pointsToAliveValue() ? SunkAddrVH : nullptr;
@@ -8531,7 +8532,7 @@ bool CodeGenPrepare::fixupDPValue(DPValue &DPV) {
// of pointer being referred to; however this makes no difference to
// debugging information, and we can't generate bitcasts that may affect
// codegen.
- DPV.replaceVariableLocationOp(Location, SunkAddr);
+ DVR.replaceVariableLocationOp(Location, SunkAddr);
AnyChange = true;
}
}
@@ -8546,13 +8547,13 @@ static void DbgInserterHelper(DbgValueInst *DVI, Instruction *VI) {
DVI->insertAfter(VI);
}
-static void DbgInserterHelper(DPValue *DPV, Instruction *VI) {
- DPV->removeFromParent();
+static void DbgInserterHelper(DbgVariableRecord *DVR, Instruction *VI) {
+ DVR->removeFromParent();
BasicBlock *VIBB = VI->getParent();
if (isa<PHINode>(VI))
- VIBB->insertDbgRecordBefore(DPV, VIBB->getFirstInsertionPt());
+ VIBB->insertDbgRecordBefore(DVR, VIBB->getFirstInsertionPt());
else
- VIBB->insertDbgRecordAfter(DPV, VI);
+ VIBB->insertDbgRecordAfter(DVR, VI);
}
// A llvm.dbg.value may be using a value before its definition, due to
@@ -8617,13 +8618,13 @@ bool CodeGenPrepare::placeDbgValues(Function &F) {
continue;
}
- // If this isn't a dbg.value, process any attached DPValue records
- // attached to this instruction.
- for (DPValue &DPV : llvm::make_early_inc_range(
+ // If this isn't a dbg.value, process any attached DbgVariableRecord
+ // records attached to this instruction.
+ for (DbgVariableRecord &DVR : llvm::make_early_inc_range(
filterDbgVars(Insn.getDbgRecordRange()))) {
- if (DPV.Type != DPValue::LocationType::Value)
+ if (DVR.Type != DbgVariableRecord::LocationType::Value)
continue;
- DbgProcessor(&DPV, &Insn);
+ DbgProcessor(&DVR, &Insn);
}
}
}
diff --git a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
index 94fdb37e283bb4..8a7262fcf31731 100644
--- a/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
+++ b/llvm/lib/CodeGen/GlobalISel/IRTranslator.cpp
@@ -3287,16 +3287,16 @@ void IRTranslator::translateDbgInfo(const Instruction &Inst,
MIRBuilder.buildDbgLabel(DPL->getLabel());
continue;
}
- DPValue &DPV = cast<DPValue>(DR);
- const DILocalVariable *Variable = DPV.getVariable();
- const DIExpression *Expression = DPV.getExpression();
- Value *V = DPV.getVariableLocationOp(0);
- if (DPV.isDbgDeclare())
- translateDbgDeclareRecord(V, DPV.hasArgList(), Variable,
- Expression, DPV.getDebugLoc(), MIRBuilder);
+ DbgVariableRecord &DVR = cast<DbgVariableRecord>(DR);
+ const DILocalVariable *Variable = DVR.getVariable();
+ const DIExpression *Expression = DVR.getExpression();
+ Value *V = DVR.getVariableLocationOp(0);
+ if (DVR.isDbgDeclare())
+ translateDbgDeclareRecord(V, DVR.hasArgList(), Variable, Expression,
+ DVR.getDebugLoc(), MIRBuilder);
else
- translateDbgValueRecord(V, DPV.hasArgList(), Variable,
- Expression, DPV.getDebugLoc(), MIRBuilder);
+ translateDbgValueRecord(V, DVR.hasArgList(), Variable, Expression,
+ DVR.getDebugLoc(), MIRBuilder);
}
}
diff --git a/llvm/lib/CodeGen/SelectOptimize.cpp b/llvm/lib/CodeGen/SelectOptimize.cpp
index f65d5320bab90d..2e03ae6aec94d3 100644
--- a/llvm/lib/CodeGen/SelectOptimize.cpp
+++ b/llvm/lib/CodeGen/SelectOptimize.cpp
@@ -624,8 +624,8 @@ void SelectOptimizeImpl::convertProfitableSIGroups(SelectGroups &ProfSIGroups) {
// With RemoveDIs turned off, SplitPt can be a dbg.* intrinsic. With
// RemoveDIs turned on, SplitPt would instead point to the next
// instruction. To match existing dbg.* intrinsic behaviour with RemoveDIs,
- // tell splitBasicBlock that we want to include any DPValues attached to
- // SplitPt in the splice.
+ // tell splitBasicBlock that we want to include any DbgVariableRecords
+ // attached to SplitPt in the splice.
SplitPt.setHeadBit(true);
BasicBlock *EndBlock = StartBlock->splitBasicBlock(SplitPt, "select.end");
BFI->setBlockFreq(EndBlock, BFI->getBlockFreq(StartBlock));
diff --git a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
index cce91dbd9531c9..8b834862fb4d89 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FastISel.cpp
@@ -1205,27 +1205,27 @@ void FastISel::handleDbgInfo(const Instruction *II) {
continue;
}
- DPValue &DPV = cast<DPValue>(DR);
+ DbgVariableRecord &DVR = cast<DbgVariableRecord>(DR);
Value *V = nullptr;
- if (!DPV.hasArgList())
- V = DPV.getVariableLocationOp(0);
+ if (!DVR.hasArgList())
+ V = DVR.getVariableLocationOp(0);
bool Res = false;
- if (DPV.getType() == DPValue::LocationType::Value ||
- DPV.getType() == DPValue::LocationType::Assign) {
- Res = lowerDbgValue(V, DPV.getExpression(), DPV.getVariable(),
- DPV.getDebugLoc());
+ if (DVR.getType() == DbgVariableRecord::LocationType::Value ||
+ DVR.getType() == DbgVariableRecord::LocationType::Assign) {
+ Res = lowerDbgValue(V, DVR.getExpression(), DVR.getVariable(),
+ DVR.getDebugLoc());
} else {
- assert(DPV.getType() == DPValue::LocationType::Declare);
- if (FuncInfo.PreprocessedDPVDeclares.contains(&DPV))
+ assert(DVR.getType() == DbgVariableRecord::LocationType::Declare);
+ if (FuncInfo.PreprocessedDVRDeclares.contains(&DVR))
continue;
- Res = lowerDbgDeclare(V, DPV.getExpression(), DPV.getVariable(),
- DPV.getDebugLoc());
+ Res = lowerDbgDeclare(V, DVR.getExpression(), DVR.getVariable(),
+ DVR.getDebugLoc());
}
if (!Res)
- LLVM_DEBUG(dbgs() << "Dropping debug-info for " << DPV << "\n";);
+ LLVM_DEBUG(dbgs() << "Dropping debug-info for " << DVR << "\n";);
}
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
index e01cd8cbf925a2..8fb6b11b8805c5 100644
--- a/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp
@@ -358,7 +358,7 @@ void FunctionLoweringInfo::clear() {
StatepointRelocationMaps.clear();
PreferredExtendType.clear();
PreprocessedDbgDeclares.clear();
- PreprocessedDPVDeclares.clear();
+ PreprocessedDVRDeclares.clear();
}
/// CreateReg - Allocate a single virtual register for the given type.
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
index b6a35f7ad4c4c6..82ca2592999c00 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
@@ -1245,14 +1245,14 @@ void SelectionDAGBuilder::visitDbgInfo(const Instruction &I) {
}
}
- // We must skip DPValues if they've already been processed above as we
- // have just emitted the debug values resulting from assignment tracking
- // analysis, making any existing DPValues redundant (and probably less
- // correct). We still need to process DPLabels. This does sink DPLabels
+ // We must skip DbgVariableRecords if they've already been processed above as
+ // we have just emitted the debug values resulting from assignment tracking
+ // analysis, making any existing DbgVariableRecords redundant (and probably
+ // less correct). We still need to process DPLabels. This does sink DPLabels
// to the bottom of the group of debug records. That sholdn't be important
- // as it does so deterministcally and ordering between DPLabels and DPValues
- // is immaterial (other than for MIR/IR printing).
- bool SkipDPValues = DAG.getFunctionVarLocs();
+ // as it does so deterministcally and ordering between DPLabels and
+ // DbgVariableRecords is immaterial (other than for MIR/IR printing).
+ bool SkipDbgVariableRecords = 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.getDbgRecordRange()) {
@@ -1264,44 +1264,45 @@ void SelectionDAGBuilder::visitDbgInfo(const Instruction &I) {
continue;
}
- if (SkipDPValues)
+ if (SkipDbgVariableRecords)
continue;
- DPValue &DPV = cast<DPValue>(DR);
- DILocalVariable *Variable = DPV.getVariable();
- DIExpression *Expression = DPV.getExpression();
+ DbgVariableRecord &DVR = cast<DbgVariableRecord>(DR);
+ DILocalVariable *Variable = DVR.getVariable();
+ DIExpression *Expression = DVR.getExpression();
dropDanglingDebugInfo(Variable, Expression);
- if (DPV.getType() == DPValue::LocationType::Declare) {
- if (FuncInfo.PreprocessedDPVDeclares.contains(&DPV))
+ if (DVR.getType() == DbgVariableRecord::LocationType::Declare) {
+ if (FuncInfo.PreprocessedDVRDeclares.contains(&DVR))
continue;
- LLVM_DEBUG(dbgs() << "SelectionDAG visiting dbg_declare: " << DPV
+ LLVM_DEBUG(dbgs() << "SelectionDAG visiting dbg_declare: " << DVR
<< "\n");
- handleDebugDeclare(DPV.getVariableLocationOp(0), Variable, Expression,
- DPV.getDebugLoc());
+ handleDebugDeclare(DVR.getVariableLocationOp(0), Variable, Expression,
+ DVR.getDebugLoc());
continue;
}
- // A DPValue with no locations is a kill location.
- SmallVector<Value *, 4> Values(DPV.location_ops());
+ // A DbgVariableRecord with no locations is a kill location.
+ SmallVector<Value *, 4> Values(DVR.location_ops());
if (Values.empty()) {
- handleKillDebugValue(Variable, Expression, DPV.getDebugLoc(),
+ handleKillDebugValue(Variable, Expression, DVR.getDebugLoc(),
SDNodeOrder);
continue;
}
- // A DPValue with an undef or absent location is also a kill location.
+ // A DbgVariableRecord with an undef or absent location is also a kill
+ // location.
if (llvm::any_of(Values,
[](Value *V) { return !V || isa<UndefValue>(V); })) {
- handleKillDebugValue(Variable, Expression, DPV.getDebugLoc(),
+ handleKillDebugValue(Variable, Expression, DVR.getDebugLoc(),
SDNodeOrder);
continue;
}
- bool IsVariadic = DPV.hasArgList();
- if (!handleDebugValue(Values, Variable, Expression, DPV.getDebugLoc(),
+ bool IsVariadic = DVR.hasArgList();
+ if (!handleDebugValue(Values, Variable, Expression, DVR.getDebugLoc(),
SDNodeOrder, IsVariadic)) {
addDanglingDebugInfo(Values, Variable, Expression, IsVariadic,
- DPV.getDebugLoc(), SDNodeOrder);
+ DVR.getDebugLoc(), SDNodeOrder);
}
}
}
diff --git a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
index 30f67d37e2e25e..d629c36bc792e3 100644
--- a/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp
@@ -1461,12 +1461,12 @@ 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 : filterDbgVars(I.getDbgRecordRange())) {
- if (DPV.Type == DPValue::LocationType::Declare &&
- processDbgDeclare(FuncInfo, DPV.getVariableLocationOp(0),
- DPV.getExpression(), DPV.getVariable(),
- DPV.getDebugLoc()))
- FuncInfo.PreprocessedDPVDeclares.insert(&DPV);
+ for (const DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (DVR.Type == DbgVariableRecord::LocationType::Declare &&
+ processDbgDeclare(FuncInfo, DVR.getVariableLocationOp(0),
+ DVR.getExpression(), DVR.getVariable(),
+ DVR.getDebugLoc()))
+ FuncInfo.PreprocessedDVRDeclares.insert(&DVR);
}
}
}
diff --git a/llvm/lib/IR/AsmWriter.cpp b/llvm/lib/IR/AsmWriter.cpp
index 11383ea6214bf3..3567ead41524dc 100644
--- a/llvm/lib/IR/AsmWriter.cpp
+++ b/llvm/lib/IR/AsmWriter.cpp
@@ -862,7 +862,7 @@ class SlotTracker : public AbstractSlotTrackerStorage {
void processInstructionMetadata(const Instruction &I);
/// Add all of the metadata from a DbgRecord.
- void processDbgRecordMetadata(const DbgRecord &DPV);
+ void processDbgRecordMetadata(const DbgRecord &DVR);
};
} // end namespace llvm
@@ -1139,13 +1139,13 @@ void SlotTracker::processFunctionMetadata(const Function &F) {
}
void SlotTracker::processDbgRecordMetadata(const DbgRecord &DR) {
- if (const DPValue *DPV = dyn_cast<const DPValue>(&DR)) {
+ if (const DbgVariableRecord *DVR = dyn_cast<const DbgVariableRecord>(&DR)) {
// Process metadata used by DbgRecords; we only specifically care about the
// DILocalVariable, DILocation, and DIAssignID fields, as the Value and
// Expression fields should only be printed inline and so do not use a slot.
- CreateMetadataSlot(DPV->getRawVariable());
- if (DPV->isDbgAssign())
- CreateMetadataSlot(cast<MDNode>(DPV->getRawAssignID()));
+ CreateMetadataSlot(DVR->getRawVariable());
+ if (DVR->isDbgAssign())
+ CreateMetadataSlot(cast<MDNode>(DVR->getRawAssignID()));
} else if (const DPLabel *DPL = dyn_cast<const DPLabel>(&DR)) {
CreateMetadataSlot(DPL->getRawLabel());
} else {
@@ -2703,7 +2703,7 @@ class AssemblyWriter {
void printInstructionLine(const Instruction &I);
void printInstruction(const Instruction &I);
void printDPMarker(const DPMarker &DPI);
- void printDPValue(const DPValue &DPI);
+ void printDbgVariableRecord(const DbgVariableRecord &DPI);
void printDPLabel(const DPLabel &DPL);
void printDbgRecord(const DbgRecord &DPI);
void printDbgRecordLine(const DbgRecord &DPI);
@@ -4604,46 +4604,47 @@ void AssemblyWriter::printDPMarker(const DPMarker &Marker) {
}
void AssemblyWriter::printDbgRecord(const DbgRecord &DR) {
- if (auto *DPV = dyn_cast<DPValue>(&DR))
- printDPValue(*DPV);
+ if (auto *DVR = dyn_cast<DbgVariableRecord>(&DR))
+ printDbgVariableRecord(*DVR);
else if (auto *DPL = dyn_cast<DPLabel>(&DR))
printDPLabel(*DPL);
else
llvm_unreachable("Unexpected DbgRecord kind");
}
-void AssemblyWriter::printDPValue(const DPValue &DPV) {
+void AssemblyWriter::printDbgVariableRecord(const DbgVariableRecord &DVR) {
auto WriterCtx = getContext();
Out << "#dbg_";
- switch (DPV.getType()) {
- case DPValue::LocationType::Value:
+ switch (DVR.getType()) {
+ case DbgVariableRecord::LocationType::Value:
Out << "value";
break;
- case DPValue::LocationType::Declare:
+ case DbgVariableRecord::LocationType::Declare:
Out << "declare";
break;
- case DPValue::LocationType::Assign:
+ case DbgVariableRecord::LocationType::Assign:
Out << "assign";
break;
default:
- llvm_unreachable("Tried to print a DPValue with an invalid LocationType!");
+ llvm_unreachable(
+ "Tried to print a DbgVariableRecord with an invalid LocationType!");
}
Out << "(";
- WriteAsOperandInternal(Out, DPV.getRawLocation(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawLocation(), WriterCtx, true);
Out << ", ";
- WriteAsOperandInternal(Out, DPV.getRawVariable(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawVariable(), WriterCtx, true);
Out << ", ";
- WriteAsOperandInternal(Out, DPV.getRawExpression(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawExpression(), WriterCtx, true);
Out << ", ";
- if (DPV.isDbgAssign()) {
- WriteAsOperandInternal(Out, DPV.getRawAssignID(), WriterCtx, true);
+ if (DVR.isDbgAssign()) {
+ WriteAsOperandInternal(Out, DVR.getRawAssignID(), WriterCtx, true);
Out << ", ";
- WriteAsOperandInternal(Out, DPV.getRawAddress(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawAddress(), WriterCtx, true);
Out << ", ";
- WriteAsOperandInternal(Out, DPV.getRawAddressExpression(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getRawAddressExpression(), WriterCtx, true);
Out << ", ";
}
- WriteAsOperandInternal(Out, DPV.getDebugLoc().getAsMDNode(), WriterCtx, true);
+ WriteAsOperandInternal(Out, DVR.getDebugLoc().getAsMDNode(), WriterCtx, true);
Out << ")";
}
@@ -4897,7 +4898,7 @@ void DPMarker::print(raw_ostream &ROS, bool IsForDebug) const {
print(ROS, MST, IsForDebug);
}
-void DPValue::print(raw_ostream &ROS, bool IsForDebug) const {
+void DbgVariableRecord::print(raw_ostream &ROS, bool IsForDebug) const {
ModuleSlotTracker MST(getModuleFromDPI(this), true);
print(ROS, MST, IsForDebug);
@@ -4924,8 +4925,8 @@ void DPLabel::print(raw_ostream &ROS, bool IsForDebug) const {
print(ROS, MST, IsForDebug);
}
-void DPValue::print(raw_ostream &ROS, ModuleSlotTracker &MST,
- bool IsForDebug) const {
+void DbgVariableRecord::print(raw_ostream &ROS, ModuleSlotTracker &MST,
+ bool IsForDebug) const {
formatted_raw_ostream OS(ROS);
SlotTracker EmptySlotTable(static_cast<const Module *>(nullptr));
SlotTracker &SlotTable =
@@ -4938,7 +4939,7 @@ void DPValue::print(raw_ostream &ROS, ModuleSlotTracker &MST,
? Marker->getParent()->getParent()
: nullptr);
AssemblyWriter W(OS, SlotTable, getModuleFromDPI(this), nullptr, IsForDebug);
- W.printDPValue(*this);
+ W.printDbgVariableRecord(*this);
}
void DPLabel::print(raw_ostream &ROS, ModuleSlotTracker &MST,
diff --git a/llvm/lib/IR/BasicBlock.cpp b/llvm/lib/IR/BasicBlock.cpp
index 4dd1bdd6e2f4ad..ee5bb5a4134c58 100644
--- a/llvm/lib/IR/BasicBlock.cpp
+++ b/llvm/lib/IR/BasicBlock.cpp
@@ -66,34 +66,34 @@ void BasicBlock::convertToNewDbgValues() {
// Iterate over all instructions in the instruction list, collecting debug
// info intrinsics and converting them to DbgRecords. Once we find a "real"
// instruction, attach all those DbgRecords to a DPMarker in that instruction.
- SmallVector<DbgRecord *, 4> DPVals;
+ SmallVector<DbgRecord *, 4> DbgVarRecs;
for (Instruction &I : make_early_inc_range(InstList)) {
assert(!I.DbgMarker && "DbgMarker already set on old-format instrs?");
if (DbgVariableIntrinsic *DVI = dyn_cast<DbgVariableIntrinsic>(&I)) {
- // Convert this dbg.value to a DPValue.
- DPValue *Value = new DPValue(DVI);
- DPVals.push_back(Value);
+ // Convert this dbg.value to a DbgVariableRecord.
+ DbgVariableRecord *Value = new DbgVariableRecord(DVI);
+ DbgVarRecs.push_back(Value);
DVI->eraseFromParent();
continue;
}
if (DbgLabelInst *DLI = dyn_cast<DbgLabelInst>(&I)) {
- DPVals.push_back(new DPLabel(DLI->getLabel(), DLI->getDebugLoc()));
+ DbgVarRecs.push_back(new DPLabel(DLI->getLabel(), DLI->getDebugLoc()));
DLI->eraseFromParent();
continue;
}
- if (DPVals.empty())
+ if (DbgVarRecs.empty())
continue;
// Create a marker to store DbgRecords in.
createMarker(&I);
DPMarker *Marker = I.DbgMarker;
- for (DbgRecord *DPV : DPVals)
- Marker->insertDbgRecord(DPV, false);
+ for (DbgRecord *DVR : DbgVarRecs)
+ Marker->insertDbgRecord(DVR, false);
- DPVals.clear();
+ DbgVarRecs.clear();
}
}
@@ -1029,21 +1029,21 @@ void BasicBlock::splice(iterator Dest, BasicBlock *Src, iterator First,
flushTerminatorDbgRecords();
}
-void BasicBlock::insertDbgRecordAfter(DbgRecord *DPV, Instruction *I) {
+void BasicBlock::insertDbgRecordAfter(DbgRecord *DVR, Instruction *I) {
assert(IsNewDbgInfoFormat);
assert(I->getParent() == this);
iterator NextIt = std::next(I->getIterator());
DPMarker *NextMarker = createMarker(NextIt);
- NextMarker->insertDbgRecord(DPV, true);
+ NextMarker->insertDbgRecord(DVR, true);
}
-void BasicBlock::insertDbgRecordBefore(DbgRecord *DPV,
+void BasicBlock::insertDbgRecordBefore(DbgRecord *DVR,
InstListType::iterator Where) {
assert(Where == end() || Where->getParent() == this);
bool InsertAtHead = Where.getHeadBit();
DPMarker *M = createMarker(Where);
- M->insertDbgRecord(DPV, InsertAtHead);
+ M->insertDbgRecord(DVR, InsertAtHead);
}
DPMarker *BasicBlock::getNextMarker(Instruction *I) {
diff --git a/llvm/lib/IR/DIBuilder.cpp b/llvm/lib/IR/DIBuilder.cpp
index c673abd8bc30d0..0d9cb905d580ae 100644
--- a/llvm/lib/IR/DIBuilder.cpp
+++ b/llvm/lib/IR/DIBuilder.cpp
@@ -951,14 +951,14 @@ DbgInstPtr DIBuilder::insertDbgAssign(Instruction *LinkedInstr, Value *Val,
assert(Link && "Linked instruction must have DIAssign metadata attached");
if (M.IsNewDbgInfoFormat) {
- DPValue *DPV = DPValue::createDPVAssign(Val, SrcVar, ValExpr, Link, Addr,
- AddrExpr, DL);
+ DbgVariableRecord *DVR = DbgVariableRecord::createDVRAssign(
+ Val, SrcVar, ValExpr, Link, Addr, AddrExpr, DL);
BasicBlock *InsertBB = LinkedInstr->getParent();
// Insert after LinkedInstr.
BasicBlock::iterator NextIt = std::next(LinkedInstr->getIterator());
Instruction *InsertBefore = NextIt == InsertBB->end() ? nullptr : &*NextIt;
- insertDPValue(DPV, InsertBB, InsertBefore, true);
- return DPV;
+ insertDbgVariableRecord(DVR, InsertBB, InsertBefore, true);
+ return DVR;
}
LLVMContext &Ctx = LinkedInstr->getContext();
@@ -1040,9 +1040,10 @@ DbgInstPtr DIBuilder::insertDbgValueIntrinsic(
llvm::Value *Val, DILocalVariable *VarInfo, DIExpression *Expr,
const DILocation *DL, BasicBlock *InsertBB, Instruction *InsertBefore) {
if (M.IsNewDbgInfoFormat) {
- DPValue *DPV = DPValue::createDPValue(Val, VarInfo, Expr, DL);
- insertDPValue(DPV, InsertBB, InsertBefore);
- return DPV;
+ DbgVariableRecord *DVR =
+ DbgVariableRecord::createDbgVariableRecord(Val, VarInfo, Expr, DL);
+ insertDbgVariableRecord(DVR, InsertBB, InsertBefore);
+ return DVR;
}
if (!ValueFn)
@@ -1062,9 +1063,10 @@ DbgInstPtr DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
"Expected matching subprograms");
if (M.IsNewDbgInfoFormat) {
- DPValue *DPV = DPValue::createDPVDeclare(Storage, VarInfo, Expr, DL);
- insertDPValue(DPV, InsertBB, InsertBefore);
- return DPV;
+ DbgVariableRecord *DVR =
+ DbgVariableRecord::createDVRDeclare(Storage, VarInfo, Expr, DL);
+ insertDbgVariableRecord(DVR, InsertBB, InsertBefore);
+ return DVR;
}
if (!DeclareFn)
@@ -1081,13 +1083,15 @@ DbgInstPtr DIBuilder::insertDeclare(Value *Storage, DILocalVariable *VarInfo,
return B.CreateCall(DeclareFn, Args);
}
-void DIBuilder::insertDPValue(DPValue *DPV, BasicBlock *InsertBB,
- Instruction *InsertBefore, bool InsertAtHead) {
+void DIBuilder::insertDbgVariableRecord(DbgVariableRecord *DVR,
+ BasicBlock *InsertBB,
+ Instruction *InsertBefore,
+ bool InsertAtHead) {
assert(InsertBefore || InsertBB);
- trackIfUnresolved(DPV->getVariable());
- trackIfUnresolved(DPV->getExpression());
- if (DPV->isDbgAssign())
- trackIfUnresolved(DPV->getAddressExpression());
+ trackIfUnresolved(DVR->getVariable());
+ trackIfUnresolved(DVR->getExpression());
+ if (DVR->isDbgAssign())
+ trackIfUnresolved(DVR->getAddressExpression());
BasicBlock::iterator InsertPt;
if (InsertBB && InsertBefore)
@@ -1095,7 +1099,7 @@ void DIBuilder::insertDPValue(DPValue *DPV, BasicBlock *InsertBB,
else if (InsertBB)
InsertPt = InsertBB->end();
InsertPt.setHeadBit(InsertAtHead);
- InsertBB->insertDbgRecordBefore(DPV, InsertPt);
+ InsertBB->insertDbgRecordBefore(DVR, InsertPt);
}
Instruction *DIBuilder::insertDbgIntrinsic(llvm::Function *IntrinsicFn,
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp
index 8587f17148d286..846a1add17bb4d 100644
--- a/llvm/lib/IR/DebugInfo.cpp
+++ b/llvm/lib/IR/DebugInfo.cpp
@@ -63,7 +63,7 @@ TinyPtrVector<DbgDeclareInst *> llvm::findDbgDeclares(Value *V) {
return Declares;
}
-TinyPtrVector<DPValue *> llvm::findDPVDeclares(Value *V) {
+TinyPtrVector<DbgVariableRecord *> llvm::findDVRDeclares(Value *V) {
// This function is hot. Check whether the value has any metadata to avoid a
// DenseMap lookup.
if (!V->isUsedByMetadata())
@@ -72,18 +72,19 @@ TinyPtrVector<DPValue *> llvm::findDPVDeclares(Value *V) {
if (!L)
return {};
- TinyPtrVector<DPValue *> Declares;
- for (DPValue *DPV : L->getAllDPValueUsers())
- if (DPV->getType() == DPValue::LocationType::Declare)
- Declares.push_back(DPV);
+ TinyPtrVector<DbgVariableRecord *> Declares;
+ for (DbgVariableRecord *DVR : L->getAllDbgVariableRecordUsers())
+ if (DVR->getType() == DbgVariableRecord::LocationType::Declare)
+ Declares.push_back(DVR);
return Declares;
}
-template <typename IntrinsicT,
- DPValue::LocationType Type = DPValue::LocationType::Any>
-static void findDbgIntrinsics(SmallVectorImpl<IntrinsicT *> &Result, Value *V,
- SmallVectorImpl<DPValue *> *DPValues) {
+template <typename IntrinsicT, DbgVariableRecord::LocationType Type =
+ DbgVariableRecord::LocationType::Any>
+static void
+findDbgIntrinsics(SmallVectorImpl<IntrinsicT *> &Result, Value *V,
+ SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords) {
// This function is hot. Check whether the value has any metadata to avoid a
// DenseMap lookup.
if (!V->isUsedByMetadata())
@@ -96,25 +97,27 @@ static void findDbgIntrinsics(SmallVectorImpl<IntrinsicT *> &Result, Value *V,
// V will also appear twice in a dbg.assign if its used in the both the value
// and address components.
SmallPtrSet<IntrinsicT *, 4> EncounteredIntrinsics;
- SmallPtrSet<DPValue *, 4> EncounteredDPValues;
+ SmallPtrSet<DbgVariableRecord *, 4> EncounteredDbgVariableRecords;
/// Append IntrinsicT users of MetadataAsValue(MD).
- auto AppendUsers = [&Ctx, &EncounteredIntrinsics, &EncounteredDPValues,
- &Result, DPValues](Metadata *MD) {
+ auto AppendUsers = [&Ctx, &EncounteredIntrinsics,
+ &EncounteredDbgVariableRecords, &Result,
+ DbgVariableRecords](Metadata *MD) {
if (auto *MDV = MetadataAsValue::getIfExists(Ctx, MD)) {
for (User *U : MDV->users())
if (IntrinsicT *DVI = dyn_cast<IntrinsicT>(U))
if (EncounteredIntrinsics.insert(DVI).second)
Result.push_back(DVI);
}
- if (!DPValues)
+ if (!DbgVariableRecords)
return;
- // Get DPValues that use this as a single value.
+ // Get DbgVariableRecords that use this as a single value.
if (LocalAsMetadata *L = dyn_cast<LocalAsMetadata>(MD)) {
- for (DPValue *DPV : L->getAllDPValueUsers()) {
- if (Type == DPValue::LocationType::Any || DPV->getType() == Type)
- if (EncounteredDPValues.insert(DPV).second)
- DPValues->push_back(DPV);
+ for (DbgVariableRecord *DVR : L->getAllDbgVariableRecordUsers()) {
+ if (Type == DbgVariableRecord::LocationType::Any ||
+ DVR->getType() == Type)
+ if (EncounteredDbgVariableRecords.insert(DVR).second)
+ DbgVariableRecords->push_back(DVR);
}
}
};
@@ -123,27 +126,30 @@ static void findDbgIntrinsics(SmallVectorImpl<IntrinsicT *> &Result, Value *V,
AppendUsers(L);
for (Metadata *AL : L->getAllArgListUsers()) {
AppendUsers(AL);
- if (!DPValues)
+ if (!DbgVariableRecords)
continue;
DIArgList *DI = cast<DIArgList>(AL);
- for (DPValue *DPV : DI->getAllDPValueUsers())
- if (Type == DPValue::LocationType::Any || DPV->getType() == Type)
- if (EncounteredDPValues.insert(DPV).second)
- DPValues->push_back(DPV);
+ for (DbgVariableRecord *DVR : DI->getAllDbgVariableRecordUsers())
+ if (Type == DbgVariableRecord::LocationType::Any ||
+ DVR->getType() == Type)
+ if (EncounteredDbgVariableRecords.insert(DVR).second)
+ DbgVariableRecords->push_back(DVR);
}
}
}
-void llvm::findDbgValues(SmallVectorImpl<DbgValueInst *> &DbgValues,
- Value *V, SmallVectorImpl<DPValue *> *DPValues) {
- findDbgIntrinsics<DbgValueInst, DPValue::LocationType::Value>(DbgValues, V,
- DPValues);
+void llvm::findDbgValues(
+ SmallVectorImpl<DbgValueInst *> &DbgValues, Value *V,
+ SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords) {
+ findDbgIntrinsics<DbgValueInst, DbgVariableRecord::LocationType::Value>(
+ DbgValues, V, DbgVariableRecords);
}
-void llvm::findDbgUsers(SmallVectorImpl<DbgVariableIntrinsic *> &DbgUsers,
- Value *V, SmallVectorImpl<DPValue *> *DPValues) {
- findDbgIntrinsics<DbgVariableIntrinsic, DPValue::LocationType::Any>(
- DbgUsers, V, DPValues);
+void llvm::findDbgUsers(
+ SmallVectorImpl<DbgVariableIntrinsic *> &DbgUsers, Value *V,
+ SmallVectorImpl<DbgVariableRecord *> *DbgVariableRecords) {
+ findDbgIntrinsics<DbgVariableIntrinsic, DbgVariableRecord::LocationType::Any>(
+ DbgUsers, V, DbgVariableRecords);
}
DISubprogram *llvm::getDISubprogram(const MDNode *Scope) {
@@ -164,16 +170,16 @@ DebugLoc llvm::getDebugValueLoc(DbgVariableIntrinsic *DII) {
return DILocation::get(DII->getContext(), 0, 0, Scope, InlinedAt);
}
-DebugLoc llvm::getDebugValueLoc(DPValue *DPV) {
+DebugLoc llvm::getDebugValueLoc(DbgVariableRecord *DVR) {
// Original dbg.declare must have a location.
- const DebugLoc &DeclareLoc = DPV->getDebugLoc();
+ const DebugLoc &DeclareLoc = DVR->getDebugLoc();
MDNode *Scope = DeclareLoc.getScope();
DILocation *InlinedAt = DeclareLoc.getInlinedAt();
// Because no machine insts can come from debug intrinsics, only the scope
// and inlinedAt is significant. Zero line numbers are used in case this
// DebugLoc leaks into any adjacent instructions. Produce an unknown location
// with the correct scope / inlinedAt fields.
- return DILocation::get(DPV->getContext(), 0, 0, Scope, InlinedAt);
+ return DILocation::get(DVR->getContext(), 0, 0, Scope, InlinedAt);
}
//===----------------------------------------------------------------------===//
@@ -253,8 +259,8 @@ void DebugInfoFinder::processLocation(const Module &M, const DILocation *Loc) {
}
void DebugInfoFinder::processDbgRecord(const Module &M, const DbgRecord &DR) {
- if (const DPValue *DPV = dyn_cast<const DPValue>(&DR))
- processVariable(M, DPV->getVariable());
+ if (const DbgVariableRecord *DVR = dyn_cast<const DbgVariableRecord>(&DR))
+ processVariable(M, DVR->getVariable());
processLocation(M, DR.getDebugLoc().get());
}
@@ -1800,14 +1806,14 @@ AssignmentMarkerRange at::getAssignmentMarkers(DIAssignID *ID) {
void at::deleteAssignmentMarkers(const Instruction *Inst) {
auto Range = getAssignmentMarkers(Inst);
- SmallVector<DPValue *> DPVAssigns = getDPVAssignmentMarkers(Inst);
- if (Range.empty() && DPVAssigns.empty())
+ SmallVector<DbgVariableRecord *> DVRAssigns = getDVRAssignmentMarkers(Inst);
+ if (Range.empty() && DVRAssigns.empty())
return;
SmallVector<DbgAssignIntrinsic *> ToDelete(Range.begin(), Range.end());
for (auto *DAI : ToDelete)
DAI->eraseFromParent();
- for (auto *DPV : DPVAssigns)
- DPV->eraseFromParent();
+ for (auto *DVR : DVRAssigns)
+ DVR->eraseFromParent();
}
void at::RAUW(DIAssignID *Old, DIAssignID *New) {
@@ -1825,12 +1831,12 @@ void at::RAUW(DIAssignID *Old, DIAssignID *New) {
void at::deleteAll(Function *F) {
SmallVector<DbgAssignIntrinsic *, 12> ToDelete;
- SmallVector<DPValue *, 12> DPToDelete;
+ SmallVector<DbgVariableRecord *, 12> DPToDelete;
for (BasicBlock &BB : *F) {
for (Instruction &I : BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- if (DPV.isDbgAssign())
- DPToDelete.push_back(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ if (DVR.isDbgAssign())
+ DPToDelete.push_back(&DVR);
if (auto *DAI = dyn_cast<DbgAssignIntrinsic>(&I))
ToDelete.push_back(DAI);
else
@@ -1839,20 +1845,20 @@ void at::deleteAll(Function *F) {
}
for (auto *DAI : ToDelete)
DAI->eraseFromParent();
- for (auto *DPV : DPToDelete)
- DPV->eraseFromParent();
+ for (auto *DVR : DPToDelete)
+ DVR->eraseFromParent();
}
/// Get the FragmentInfo for the variable if it exists, otherwise return a
/// FragmentInfo that covers the entire variable if the variable size is
/// known, otherwise return a zero-sized fragment.
static DIExpression::FragmentInfo
-getFragmentOrEntireVariable(const DPValue *DPV) {
+getFragmentOrEntireVariable(const DbgVariableRecord *DVR) {
DIExpression::FragmentInfo VariableSlice(0, 0);
// Get the fragment or variable size, or zero.
- if (auto Sz = DPV->getFragmentSizeInBits())
+ if (auto Sz = DVR->getFragmentSizeInBits())
VariableSlice.SizeInBits = *Sz;
- if (auto Frag = DPV->getExpression()->getFragmentInfo())
+ if (auto Frag = DVR->getExpression()->getFragmentInfo())
VariableSlice.OffsetInBits = Frag->OffsetInBits;
return VariableSlice;
}
@@ -2016,10 +2022,10 @@ bool at::calculateFragmentIntersect(
}
bool at::calculateFragmentIntersect(
const DataLayout &DL, const Value *Dest, uint64_t SliceOffsetInBits,
- uint64_t SliceSizeInBits, const DPValue *DPVAssign,
+ uint64_t SliceSizeInBits, const DbgVariableRecord *DVRAssign,
std::optional<DIExpression::FragmentInfo> &Result) {
return calculateFragmentIntersectImpl(DL, Dest, SliceOffsetInBits,
- SliceSizeInBits, DPVAssign, Result);
+ SliceSizeInBits, DVRAssign, Result);
}
/// Collect constant properies (base, size, offset) of \p StoreDest.
@@ -2113,7 +2119,7 @@ static void emitDbgAssign(AssignmentInfo Info, Value *Val, Value *Dest,
DIExpression *AddrExpr =
DIExpression::get(StoreLikeInst.getContext(), std::nullopt);
if (StoreLikeInst.getParent()->IsNewDbgInfoFormat) {
- auto *Assign = DPValue::createLinkedDPVAssign(
+ auto *Assign = DbgVariableRecord::createLinkedDVRAssign(
&StoreLikeInst, Val, VarRec.Var, Expr, Dest, AddrExpr, VarRec.DL);
(void)Assign;
LLVM_DEBUG(if (Assign) errs() << " > INSERT: " << *Assign << "\n");
@@ -2231,7 +2237,7 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) {
// storage" is limited to Allocas). We'll use this to find dbg.declares to
// delete after running `trackAssignments`.
DenseMap<const AllocaInst *, SmallPtrSet<DbgDeclareInst *, 2>> DbgDeclares;
- DenseMap<const AllocaInst *, SmallPtrSet<DPValue *, 2>> DPVDeclares;
+ DenseMap<const AllocaInst *, SmallPtrSet<DbgVariableRecord *, 2>> DVRDeclares;
// Create another similar map of {storage : variables} that we'll pass to
// trackAssignments.
StorageToVarsMap Vars;
@@ -2257,9 +2263,9 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) {
};
for (auto &BB : F) {
for (auto &I : BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
- if (DPV.isDbgDeclare())
- ProcessDeclare(&DPV, DPVDeclares);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (DVR.isDbgDeclare())
+ ProcessDeclare(&DVR, DVRDeclares);
}
if (DbgDeclareInst *DDI = dyn_cast<DbgDeclareInst>(&I))
ProcessDeclare(DDI, DbgDeclares);
@@ -2300,8 +2306,8 @@ bool AssignmentTrackingPass::runOnFunction(Function &F) {
};
for (auto &P : DbgDeclares)
DeleteSubsumedDeclare(at::getAssignmentMarkers(P.first), P.second);
- for (auto &P : DPVDeclares)
- DeleteSubsumedDeclare(at::getDPVAssignmentMarkers(P.first), P.second);
+ for (auto &P : DVRDeclares)
+ DeleteSubsumedDeclare(at::getDVRAssignmentMarkers(P.first), P.second);
return Changed;
}
diff --git a/llvm/lib/IR/DebugInfoMetadata.cpp b/llvm/lib/IR/DebugInfoMetadata.cpp
index 28f96653d815b5..f7e328fa8afca4 100644
--- a/llvm/lib/IR/DebugInfoMetadata.cpp
+++ b/llvm/lib/IR/DebugInfoMetadata.cpp
@@ -42,10 +42,10 @@ DebugVariable::DebugVariable(const DbgVariableIntrinsic *DII)
Fragment(DII->getExpression()->getFragmentInfo()),
InlinedAt(DII->getDebugLoc().getInlinedAt()) {}
-DebugVariable::DebugVariable(const DPValue *DPV)
- : Variable(DPV->getVariable()),
- Fragment(DPV->getExpression()->getFragmentInfo()),
- InlinedAt(DPV->getDebugLoc().getInlinedAt()) {}
+DebugVariable::DebugVariable(const DbgVariableRecord *DVR)
+ : Variable(DVR->getVariable()),
+ Fragment(DVR->getExpression()->getFragmentInfo()),
+ InlinedAt(DVR->getDebugLoc().getInlinedAt()) {}
DebugVariableAggregate::DebugVariableAggregate(const DbgVariableIntrinsic *DVI)
: DebugVariable(DVI->getVariable(), std::nullopt,
diff --git a/llvm/lib/IR/DebugProgramInstruction.cpp b/llvm/lib/IR/DebugProgramInstruction.cpp
index f34d3aecfa0a38..1fb435f46a5fc0 100644
--- a/llvm/lib/IR/DebugProgramInstruction.cpp
+++ b/llvm/lib/IR/DebugProgramInstruction.cpp
@@ -28,7 +28,7 @@ template class DbgRecordParamRef<DIExpression>;
template class DbgRecordParamRef<DILabel>;
template class DbgRecordParamRef<DILocalVariable>;
-DPValue::DPValue(const DbgVariableIntrinsic *DVI)
+DbgVariableRecord::DbgVariableRecord(const DbgVariableIntrinsic *DVI)
: DbgRecord(ValueKind, DVI->getDebugLoc()),
DebugValueUser({DVI->getRawLocation(), nullptr, nullptr}),
Variable(DVI->getVariable()), Expression(DVI->getExpression()),
@@ -51,25 +51,27 @@ DPValue::DPValue(const DbgVariableIntrinsic *DVI)
}
default:
llvm_unreachable(
- "Trying to create a DPValue with an invalid intrinsic type!");
+ "Trying to create a DbgVariableRecord with an invalid intrinsic type!");
}
}
-DPValue::DPValue(const DPValue &DPV)
- : DbgRecord(ValueKind, DPV.getDebugLoc()), DebugValueUser(DPV.DebugValues),
- Type(DPV.getType()), Variable(DPV.getVariable()),
- Expression(DPV.getExpression()),
- AddressExpression(DPV.AddressExpression) {}
+DbgVariableRecord::DbgVariableRecord(const DbgVariableRecord &DVR)
+ : DbgRecord(ValueKind, DVR.getDebugLoc()), DebugValueUser(DVR.DebugValues),
+ Type(DVR.getType()), Variable(DVR.getVariable()),
+ Expression(DVR.getExpression()),
+ AddressExpression(DVR.AddressExpression) {}
-DPValue::DPValue(Metadata *Location, DILocalVariable *DV, DIExpression *Expr,
- const DILocation *DI, LocationType Type)
+DbgVariableRecord::DbgVariableRecord(Metadata *Location, DILocalVariable *DV,
+ DIExpression *Expr, const DILocation *DI,
+ LocationType Type)
: DbgRecord(ValueKind, DI), DebugValueUser({Location, nullptr, nullptr}),
Type(Type), Variable(DV), Expression(Expr) {}
-DPValue::DPValue(Metadata *Value, DILocalVariable *Variable,
- DIExpression *Expression, DIAssignID *AssignID,
- Metadata *Address, DIExpression *AddressExpression,
- const DILocation *DI)
+DbgVariableRecord::DbgVariableRecord(Metadata *Value, DILocalVariable *Variable,
+ DIExpression *Expression,
+ DIAssignID *AssignID, Metadata *Address,
+ DIExpression *AddressExpression,
+ const DILocation *DI)
: DbgRecord(ValueKind, DI), DebugValueUser({Value, Address, AssignID}),
Type(LocationType::Assign), Variable(Variable), Expression(Expression),
AddressExpression(AddressExpression) {}
@@ -77,7 +79,7 @@ DPValue::DPValue(Metadata *Value, DILocalVariable *Variable,
void DbgRecord::deleteRecord() {
switch (RecordKind) {
case ValueKind:
- delete cast<DPValue>(this);
+ delete cast<DbgVariableRecord>(this);
return;
case LabelKind:
delete cast<DPLabel>(this);
@@ -89,7 +91,7 @@ void DbgRecord::deleteRecord() {
void DbgRecord::print(raw_ostream &O, bool IsForDebug) const {
switch (RecordKind) {
case ValueKind:
- cast<DPValue>(this)->print(O, IsForDebug);
+ cast<DbgVariableRecord>(this)->print(O, IsForDebug);
return;
case LabelKind:
cast<DPLabel>(this)->print(O, IsForDebug);
@@ -102,7 +104,7 @@ void DbgRecord::print(raw_ostream &O, ModuleSlotTracker &MST,
bool IsForDebug) const {
switch (RecordKind) {
case ValueKind:
- cast<DPValue>(this)->print(O, MST, IsForDebug);
+ cast<DbgVariableRecord>(this)->print(O, MST, IsForDebug);
return;
case LabelKind:
cast<DPLabel>(this)->print(O, MST, IsForDebug);
@@ -116,7 +118,8 @@ bool DbgRecord::isIdenticalToWhenDefined(const DbgRecord &R) const {
return false;
switch (RecordKind) {
case ValueKind:
- return cast<DPValue>(this)->isIdenticalToWhenDefined(*cast<DPValue>(&R));
+ return cast<DbgVariableRecord>(this)->isIdenticalToWhenDefined(
+ *cast<DbgVariableRecord>(&R));
case LabelKind:
return cast<DPLabel>(this)->getLabel() == cast<DPLabel>(R).getLabel();
};
@@ -131,7 +134,7 @@ DbgInfoIntrinsic *
DbgRecord::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const {
switch (RecordKind) {
case ValueKind:
- return cast<DPValue>(this)->createDebugIntrinsic(M, InsertBefore);
+ return cast<DbgVariableRecord>(this)->createDebugIntrinsic(M, InsertBefore);
case LabelKind:
return cast<DPLabel>(this)->createDebugIntrinsic(M, InsertBefore);
};
@@ -153,79 +156,83 @@ DPLabel *DPLabel::createUnresolvedDPLabel(MDNode *Label, MDNode *DL) {
return new DPLabel(Label, DL);
}
-DPValue::DPValue(DPValue::LocationType Type, Metadata *Val, MDNode *Variable,
- MDNode *Expression, MDNode *AssignID, Metadata *Address,
- MDNode *AddressExpression, MDNode *DI)
+DbgVariableRecord::DbgVariableRecord(DbgVariableRecord::LocationType Type,
+ Metadata *Val, MDNode *Variable,
+ MDNode *Expression, MDNode *AssignID,
+ Metadata *Address,
+ MDNode *AddressExpression, MDNode *DI)
: DbgRecord(ValueKind, DebugLoc(DI)),
DebugValueUser({Val, Address, AssignID}), Type(Type), Variable(Variable),
Expression(Expression), AddressExpression(AddressExpression) {}
-DPValue *DPValue::createUnresolvedDPValue(DPValue::LocationType Type,
- Metadata *Val, MDNode *Variable,
- MDNode *Expression, MDNode *AssignID,
- Metadata *Address,
- MDNode *AddressExpression,
- MDNode *DI) {
- return new DPValue(Type, Val, Variable, Expression, AssignID, Address,
- AddressExpression, DI);
+DbgVariableRecord *DbgVariableRecord::createUnresolvedDbgVariableRecord(
+ DbgVariableRecord::LocationType Type, Metadata *Val, MDNode *Variable,
+ MDNode *Expression, MDNode *AssignID, Metadata *Address,
+ MDNode *AddressExpression, MDNode *DI) {
+ return new DbgVariableRecord(Type, Val, Variable, Expression, AssignID,
+ Address, AddressExpression, DI);
}
-DPValue *DPValue::createDPValue(Value *Location, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI) {
- return new DPValue(ValueAsMetadata::get(Location), DV, Expr, DI,
- LocationType::Value);
+DbgVariableRecord *
+DbgVariableRecord::createDbgVariableRecord(Value *Location, DILocalVariable *DV,
+ DIExpression *Expr,
+ const DILocation *DI) {
+ return new DbgVariableRecord(ValueAsMetadata::get(Location), DV, Expr, DI,
+ LocationType::Value);
}
-DPValue *DPValue::createDPValue(Value *Location, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI,
- DPValue &InsertBefore) {
- auto *NewDPValue = createDPValue(Location, DV, Expr, DI);
- NewDPValue->insertBefore(&InsertBefore);
- return NewDPValue;
+DbgVariableRecord *DbgVariableRecord::createDbgVariableRecord(
+ Value *Location, DILocalVariable *DV, DIExpression *Expr,
+ const DILocation *DI, DbgVariableRecord &InsertBefore) {
+ auto *NewDbgVariableRecord = createDbgVariableRecord(Location, DV, Expr, DI);
+ NewDbgVariableRecord->insertBefore(&InsertBefore);
+ return NewDbgVariableRecord;
}
-DPValue *DPValue::createDPVDeclare(Value *Address, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI) {
- return new DPValue(ValueAsMetadata::get(Address), DV, Expr, DI,
- LocationType::Declare);
+DbgVariableRecord *DbgVariableRecord::createDVRDeclare(Value *Address,
+ DILocalVariable *DV,
+ DIExpression *Expr,
+ const DILocation *DI) {
+ return new DbgVariableRecord(ValueAsMetadata::get(Address), DV, Expr, DI,
+ LocationType::Declare);
}
-DPValue *DPValue::createDPVDeclare(Value *Address, DILocalVariable *DV,
- DIExpression *Expr, const DILocation *DI,
- DPValue &InsertBefore) {
- auto *NewDPVDeclare = createDPVDeclare(Address, DV, Expr, DI);
- NewDPVDeclare->insertBefore(&InsertBefore);
- return NewDPVDeclare;
+DbgVariableRecord *
+DbgVariableRecord::createDVRDeclare(Value *Address, DILocalVariable *DV,
+ DIExpression *Expr, const DILocation *DI,
+ DbgVariableRecord &InsertBefore) {
+ auto *NewDVRDeclare = createDVRDeclare(Address, DV, Expr, DI);
+ NewDVRDeclare->insertBefore(&InsertBefore);
+ return NewDVRDeclare;
}
-DPValue *DPValue::createDPVAssign(Value *Val, DILocalVariable *Variable,
- DIExpression *Expression,
- DIAssignID *AssignID, Value *Address,
- DIExpression *AddressExpression,
- const DILocation *DI) {
- return new DPValue(ValueAsMetadata::get(Val), Variable, Expression, AssignID,
- ValueAsMetadata::get(Address), AddressExpression, DI);
+DbgVariableRecord *DbgVariableRecord::createDVRAssign(
+ Value *Val, DILocalVariable *Variable, DIExpression *Expression,
+ DIAssignID *AssignID, Value *Address, DIExpression *AddressExpression,
+ const DILocation *DI) {
+ return new DbgVariableRecord(ValueAsMetadata::get(Val), Variable, Expression,
+ AssignID, ValueAsMetadata::get(Address),
+ AddressExpression, DI);
}
-DPValue *DPValue::createLinkedDPVAssign(Instruction *LinkedInstr, Value *Val,
- DILocalVariable *Variable,
- DIExpression *Expression,
- Value *Address,
- DIExpression *AddressExpression,
- const DILocation *DI) {
+DbgVariableRecord *DbgVariableRecord::createLinkedDVRAssign(
+ Instruction *LinkedInstr, Value *Val, DILocalVariable *Variable,
+ DIExpression *Expression, Value *Address, DIExpression *AddressExpression,
+ const DILocation *DI) {
auto *Link = LinkedInstr->getMetadata(LLVMContext::MD_DIAssignID);
assert(Link && "Linked instruction must have DIAssign metadata attached");
- auto *NewDPVAssign = DPValue::createDPVAssign(Val, Variable, Expression,
- cast<DIAssignID>(Link), Address,
- AddressExpression, DI);
- LinkedInstr->getParent()->insertDbgRecordAfter(NewDPVAssign, LinkedInstr);
- return NewDPVAssign;
+ auto *NewDVRAssign = DbgVariableRecord::createDVRAssign(
+ Val, Variable, Expression, cast<DIAssignID>(Link), Address,
+ AddressExpression, DI);
+ LinkedInstr->getParent()->insertDbgRecordAfter(NewDVRAssign, LinkedInstr);
+ return NewDVRAssign;
}
-iterator_range<DPValue::location_op_iterator> DPValue::location_ops() const {
+iterator_range<DbgVariableRecord::location_op_iterator>
+DbgVariableRecord::location_ops() const {
auto *MD = getRawLocation();
- // If a Value has been deleted, the "location" for this DPValue will be
- // replaced by nullptr. Return an empty range.
+ // If a Value has been deleted, the "location" for this DbgVariableRecord will
+ // be replaced by nullptr. Return an empty range.
if (!MD)
return {location_op_iterator(static_cast<ValueAsMetadata *>(nullptr)),
location_op_iterator(static_cast<ValueAsMetadata *>(nullptr))};
@@ -245,13 +252,13 @@ iterator_range<DPValue::location_op_iterator> DPValue::location_ops() const {
location_op_iterator(static_cast<ValueAsMetadata *>(nullptr))};
}
-unsigned DPValue::getNumVariableLocationOps() const {
+unsigned DbgVariableRecord::getNumVariableLocationOps() const {
if (hasArgList())
return cast<DIArgList>(getRawLocation())->getArgs().size();
return 1;
}
-Value *DPValue::getVariableLocationOp(unsigned OpIdx) const {
+Value *DbgVariableRecord::getVariableLocationOp(unsigned OpIdx) const {
auto *MD = getRawLocation();
if (!MD)
return nullptr;
@@ -261,7 +268,7 @@ Value *DPValue::getVariableLocationOp(unsigned OpIdx) const {
if (isa<MDNode>(MD))
return nullptr;
assert(isa<ValueAsMetadata>(MD) &&
- "Attempted to get location operand from DPValue with none.");
+ "Attempted to get location operand from DbgVariableRecord with none.");
auto *V = cast<ValueAsMetadata>(MD);
assert(OpIdx == 0 && "Operand Index must be 0 for a debug intrinsic with a "
"single location operand.");
@@ -274,8 +281,9 @@ static ValueAsMetadata *getAsMetadata(Value *V) {
: ValueAsMetadata::get(V);
}
-void DPValue::replaceVariableLocationOp(Value *OldValue, Value *NewValue,
- bool AllowEmpty) {
+void DbgVariableRecord::replaceVariableLocationOp(Value *OldValue,
+ Value *NewValue,
+ bool AllowEmpty) {
assert(NewValue && "Values must be non-null");
bool DbgAssignAddrReplaced = isDbgAssign() && OldValue == getAddress();
@@ -307,7 +315,8 @@ void DPValue::replaceVariableLocationOp(Value *OldValue, Value *NewValue,
setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
}
-void DPValue::replaceVariableLocationOp(unsigned OpIdx, Value *NewValue) {
+void DbgVariableRecord::replaceVariableLocationOp(unsigned OpIdx,
+ Value *NewValue) {
assert(OpIdx < getNumVariableLocationOps() && "Invalid Operand Index");
if (!hasArgList()) {
@@ -326,8 +335,8 @@ void DPValue::replaceVariableLocationOp(unsigned OpIdx, Value *NewValue) {
setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
}
-void DPValue::addVariableLocationOps(ArrayRef<Value *> NewValues,
- DIExpression *NewExpr) {
+void DbgVariableRecord::addVariableLocationOps(ArrayRef<Value *> NewValues,
+ DIExpression *NewExpr) {
assert(NewExpr->hasAllLocationOps(getNumVariableLocationOps() +
NewValues.size()) &&
"NewExpr for debug variable intrinsic does not reference every "
@@ -342,7 +351,7 @@ void DPValue::addVariableLocationOps(ArrayRef<Value *> NewValues,
setRawLocation(DIArgList::get(getVariableLocationOp(0)->getContext(), MDs));
}
-void DPValue::setKillLocation() {
+void DbgVariableRecord::setKillLocation() {
// TODO: When/if we remove duplicate values from DIArgLists, we don't need
// this set anymore.
SmallPtrSet<Value *, 4> RemovedValues;
@@ -354,13 +363,13 @@ void DPValue::setKillLocation() {
}
}
-bool DPValue::isKillLocation() const {
+bool DbgVariableRecord::isKillLocation() const {
return (getNumVariableLocationOps() == 0 &&
!getExpression()->isComplex()) ||
any_of(location_ops(), [](Value *V) { return isa<UndefValue>(V); });
}
-std::optional<uint64_t> DPValue::getFragmentSizeInBits() const {
+std::optional<uint64_t> DbgVariableRecord::getFragmentSizeInBits() const {
if (auto Fragment = getExpression()->getFragmentInfo())
return Fragment->SizeInBits;
return getVariable()->getSizeInBits();
@@ -369,21 +378,24 @@ std::optional<uint64_t> DPValue::getFragmentSizeInBits() const {
DbgRecord *DbgRecord::clone() const {
switch (RecordKind) {
case ValueKind:
- return cast<DPValue>(this)->clone();
+ return cast<DbgVariableRecord>(this)->clone();
case LabelKind:
return cast<DPLabel>(this)->clone();
};
llvm_unreachable("unsupported DbgRecord kind");
}
-DPValue *DPValue::clone() const { return new DPValue(*this); }
+DbgVariableRecord *DbgVariableRecord::clone() const {
+ return new DbgVariableRecord(*this);
+}
DPLabel *DPLabel::clone() const {
return new DPLabel(getLabel(), getDebugLoc());
}
DbgVariableIntrinsic *
-DPValue::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const {
+DbgVariableRecord::createDebugIntrinsic(Module *M,
+ Instruction *InsertBefore) const {
[[maybe_unused]] DICompileUnit *Unit =
getDebugLoc().get()->getScope()->getSubprogram()->getUnit();
assert(M && Unit &&
@@ -394,24 +406,25 @@ DPValue::createDebugIntrinsic(Module *M, Instruction *InsertBefore) const {
// Work out what sort of intrinsic we're going to produce.
switch (getType()) {
- case DPValue::LocationType::Declare:
+ case DbgVariableRecord::LocationType::Declare:
IntrinsicFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_declare);
break;
- case DPValue::LocationType::Value:
+ case DbgVariableRecord::LocationType::Value:
IntrinsicFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_value);
break;
- case DPValue::LocationType::Assign:
+ case DbgVariableRecord::LocationType::Assign:
IntrinsicFn = Intrinsic::getDeclaration(M, Intrinsic::dbg_assign);
break;
- case DPValue::LocationType::End:
- case DPValue::LocationType::Any:
+ case DbgVariableRecord::LocationType::End:
+ case DbgVariableRecord::LocationType::Any:
llvm_unreachable("Invalid LocationType");
}
- // Create the intrinsic from this DPValue's information, optionally insert
- // into the target location.
+ // Create the intrinsic from this DbgVariableRecord's information, optionally
+ // insert into the target location.
DbgVariableIntrinsic *DVI;
- assert(getRawLocation() && "DPValue's RawLocation should be non-null.");
+ assert(getRawLocation() &&
+ "DbgVariableRecord's RawLocation should be non-null.");
if (isDbgAssign()) {
Value *AssignArgs[] = {
MetadataAsValue::get(Context, getRawLocation()),
@@ -451,7 +464,7 @@ DbgLabelInst *DPLabel::createDebugIntrinsic(Module *M,
return DbgLabel;
}
-Value *DPValue::getAddress() const {
+Value *DbgVariableRecord::getAddress() const {
auto *MD = getRawAddress();
if (auto *V = dyn_cast<ValueAsMetadata>(MD))
return V->getValue();
@@ -461,18 +474,20 @@ Value *DPValue::getAddress() const {
return nullptr;
}
-DIAssignID *DPValue::getAssignID() const {
+DIAssignID *DbgVariableRecord::getAssignID() const {
return cast<DIAssignID>(DebugValues[2]);
}
-void DPValue::setAssignId(DIAssignID *New) { resetDebugValue(2, New); }
+void DbgVariableRecord::setAssignId(DIAssignID *New) {
+ resetDebugValue(2, New);
+}
-void DPValue::setKillAddress() {
+void DbgVariableRecord::setKillAddress() {
resetDebugValue(
1, ValueAsMetadata::get(UndefValue::get(getAddress()->getType())));
}
-bool DPValue::isKillAddress() const {
+bool DbgVariableRecord::isKillAddress() const {
Value *Addr = getAddress();
return !Addr || isa<UndefValue>(Addr);
}
@@ -647,8 +662,8 @@ void DPMarker::insertDbgRecordAfter(DbgRecord *New, DbgRecord *InsertAfter) {
void DPMarker::absorbDebugValues(DPMarker &Src, bool InsertAtHead) {
auto It = InsertAtHead ? StoredDbgRecords.begin() : StoredDbgRecords.end();
- for (DbgRecord &DPV : Src.StoredDbgRecords)
- DPV.setMarker(this);
+ for (DbgRecord &DVR : Src.StoredDbgRecords)
+ DVR.setMarker(this);
StoredDbgRecords.splice(It, Src.StoredDbgRecords);
}
@@ -677,8 +692,8 @@ iterator_range<simple_ilist<DbgRecord>::iterator> DPMarker::cloneDebugInfoFrom(
if (from_here.has_value())
Range = make_range(*from_here, From->StoredDbgRecords.end());
- // Clone each DPValue and insert into StoreDPValues; optionally place them at
- // the start or the end of the list.
+ // Clone each DbgVariableRecord and insert into StoreDbgVariableRecords;
+ // optionally place them at the start or the end of the list.
auto Pos = (InsertAtHead) ? StoredDbgRecords.begin() : StoredDbgRecords.end();
for (DbgRecord &DR : Range) {
DbgRecord *New = DR.clone();
diff --git a/llvm/lib/IR/Instruction.cpp b/llvm/lib/IR/Instruction.cpp
index 7a677d7f3c2be8..9744eb32d27a5e 100644
--- a/llvm/lib/IR/Instruction.cpp
+++ b/llvm/lib/IR/Instruction.cpp
@@ -143,8 +143,8 @@ void Instruction::insertBefore(BasicBlock &BB,
return;
// We've inserted "this": if InsertAtHead is set then it comes before any
- // DPValues attached to InsertPos. But if it's not set, then any DbgRecords
- // should now come before "this".
+ // DbgVariableRecords attached to InsertPos. But if it's not set, then any
+ // DbgRecords should now come before "this".
bool InsertAtHead = InsertPos.getHeadBit();
if (!InsertAtHead) {
DPMarker *SrcMarker = BB.getMarker(InsertPos);
@@ -217,7 +217,7 @@ void Instruction::moveBeforeImpl(BasicBlock &BB, InstListType::iterator I,
if (BB.IsNewDbgInfoFormat && DbgMarker && !Preserve) {
if (I != this->getIterator() || InsertAtHead) {
// "this" is definitely moving in the list, or it's moving ahead of its
- // attached DPValues. Detach any existing DbgRecords.
+ // attached DbgVariableRecords. Detach any existing DbgRecords.
handleMarkerRemoval();
}
}
@@ -320,8 +320,8 @@ void Instruction::dropDbgRecords() {
DbgMarker->dropDbgRecords();
}
-void Instruction::dropOneDbgRecord(DbgRecord *DPV) {
- DbgMarker->dropOneDbgRecord(DPV);
+void Instruction::dropOneDbgRecord(DbgRecord *DVR) {
+ DbgMarker->dropOneDbgRecord(DVR);
}
bool Instruction::comesBefore(const Instruction *Other) const {
diff --git a/llvm/lib/IR/LLVMContextImpl.cpp b/llvm/lib/IR/LLVMContextImpl.cpp
index a471314ccb940a..72fedd8d673980 100644
--- a/llvm/lib/IR/LLVMContextImpl.cpp
+++ b/llvm/lib/IR/LLVMContextImpl.cpp
@@ -48,8 +48,8 @@ LLVMContextImpl::~LLVMContextImpl() {
#ifndef NDEBUG
// Check that any variable location records that fell off the end of a block
// when it's terminator was removed were eventually replaced. This assertion
- // firing indicates that DPValues went missing during the lifetime of the
- // LLVMContext.
+ // firing indicates that DbgVariableRecords went missing during the lifetime
+ // of the LLVMContext.
assert(TrailingDbgRecords.empty() && "DbgRecords in blocks not cleaned");
#endif
diff --git a/llvm/lib/IR/LLVMContextImpl.h b/llvm/lib/IR/LLVMContextImpl.h
index b1dcb262fb657f..ea367750ee426f 100644
--- a/llvm/lib/IR/LLVMContextImpl.h
+++ b/llvm/lib/IR/LLVMContextImpl.h
@@ -1670,20 +1670,20 @@ class LLVMContextImpl {
/// LLVMContext is used by compilation.
void setOptPassGate(OptPassGate &);
- /// Mapping of blocks to collections of "trailing" DPValues. As part of the
- /// "RemoveDIs" project, debug-info variable location records are going to
- /// cease being instructions... which raises the problem of where should they
- /// be recorded when we remove the terminator of a blocks, such as:
+ /// Mapping of blocks to collections of "trailing" DbgVariableRecords. As part
+ /// of the "RemoveDIs" project, debug-info variable location records are going
+ /// to cease being instructions... which raises the problem of where should
+ /// they be recorded when we remove the terminator of a blocks, such as:
///
/// %foo = add i32 0, 0
/// br label %bar
///
/// If the branch is removed, a legitimate transient state while editing a
/// block, any debug-records between those two instructions will not have a
- /// location. Each block thus records any DPValue records that "trail" in
- /// such a way. These are stored in LLVMContext because typically LLVM only
- /// edits a small number of blocks at a time, so there's no need to bloat
- /// BasicBlock with such a data structure.
+ /// location. Each block thus records any DbgVariableRecord records that
+ /// "trail" in such a way. These are stored in LLVMContext because typically
+ /// LLVM only edits a small number of blocks at a time, so there's no need to
+ /// bloat BasicBlock with such a data structure.
SmallDenseMap<BasicBlock *, DPMarker *> TrailingDbgRecords;
// Set, get and delete operations for TrailingDbgRecords.
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp
index 8945c6dbc8d848..953f21ce740590 100644
--- a/llvm/lib/IR/LegacyPassManager.cpp
+++ b/llvm/lib/IR/LegacyPassManager.cpp
@@ -528,8 +528,9 @@ bool PassManagerImpl::run(Module &M) {
dumpArguments();
dumpPasses();
- // RemoveDIs: if a command line flag is given, convert to the DPValue
- // representation of debug-info for the duration of these passes.
+ // RemoveDIs: if a command line flag is given, convert to the
+ // DbgVariableRecord representation of debug-info for the duration of these
+ // passes.
bool shouldConvertDbgInfo = UseNewDbgInfoFormat && !M.IsNewDbgInfoFormat;
if (shouldConvertDbgInfo)
M.convertToNewDbgValues();
diff --git a/llvm/lib/IR/Metadata.cpp b/llvm/lib/IR/Metadata.cpp
index 06db91fe4f8e74..4472bf128c323f 100644
--- a/llvm/lib/IR/Metadata.cpp
+++ b/llvm/lib/IR/Metadata.cpp
@@ -148,9 +148,11 @@ void MetadataAsValue::untrack() {
MetadataTracking::untrack(MD);
}
-DPValue *DebugValueUser::getUser() { return static_cast<DPValue *>(this); }
-const DPValue *DebugValueUser::getUser() const {
- return static_cast<const DPValue *>(this);
+DbgVariableRecord *DebugValueUser::getUser() {
+ return static_cast<DbgVariableRecord *>(this);
+}
+const DbgVariableRecord *DebugValueUser::getUser() const {
+ return static_cast<const DbgVariableRecord *>(this);
}
void DebugValueUser::handleChangedValue(void *Old, Metadata *New) {
@@ -266,28 +268,29 @@ SmallVector<Metadata *> ReplaceableMetadataImpl::getAllArgListUsers() {
return MDUsers;
}
-SmallVector<DPValue *> ReplaceableMetadataImpl::getAllDPValueUsers() {
- SmallVector<std::pair<OwnerTy, uint64_t> *> DPVUsersWithID;
+SmallVector<DbgVariableRecord *>
+ReplaceableMetadataImpl::getAllDbgVariableRecordUsers() {
+ SmallVector<std::pair<OwnerTy, uint64_t> *> DVRUsersWithID;
for (auto Pair : UseMap) {
OwnerTy Owner = Pair.second.first;
if (Owner.isNull())
continue;
if (!Owner.is<DebugValueUser *>())
continue;
- DPVUsersWithID.push_back(&UseMap[Pair.first]);
+ DVRUsersWithID.push_back(&UseMap[Pair.first]);
}
- // Order DPValue users in reverse-creation order. Normal dbg.value users
- // of MetadataAsValues are ordered by their UseList, i.e. reverse order of
- // when they were added: we need to replicate that here. The structure of
+ // Order DbgVariableRecord users in reverse-creation order. Normal dbg.value
+ // users of MetadataAsValues are ordered by their UseList, i.e. reverse order
+ // of when they were added: we need to replicate that here. The structure of
// debug-info output depends on the ordering of intrinsics, thus we need
// to keep them consistent for comparisons sake.
- llvm::sort(DPVUsersWithID, [](auto UserA, auto UserB) {
+ llvm::sort(DVRUsersWithID, [](auto UserA, auto UserB) {
return UserA->second > UserB->second;
});
- SmallVector<DPValue *> DPVUsers;
- for (auto UserWithID : DPVUsersWithID)
- DPVUsers.push_back(UserWithID->first.get<DebugValueUser *>()->getUser());
- return DPVUsers;
+ SmallVector<DbgVariableRecord *> DVRUsers;
+ for (auto UserWithID : DVRUsersWithID)
+ DVRUsers.push_back(UserWithID->first.get<DebugValueUser *>()->getUser());
+ return DVRUsers;
}
void ReplaceableMetadataImpl::addRef(void *Ref, OwnerTy Owner) {
diff --git a/llvm/lib/IR/Value.cpp b/llvm/lib/IR/Value.cpp
index c4e47975b18221..61e1c35ba4a3a2 100644
--- a/llvm/lib/IR/Value.cpp
+++ b/llvm/lib/IR/Value.cpp
@@ -574,16 +574,16 @@ void Value::replaceUsesWithIf(Value *New,
/// with New.
static void replaceDbgUsesOutsideBlock(Value *V, Value *New, BasicBlock *BB) {
SmallVector<DbgVariableIntrinsic *> DbgUsers;
- SmallVector<DPValue *> DPUsers;
+ SmallVector<DbgVariableRecord *> DPUsers;
findDbgUsers(DbgUsers, V, &DPUsers);
for (auto *DVI : DbgUsers) {
if (DVI->getParent() != BB)
DVI->replaceVariableLocationOp(V, New);
}
- for (auto *DPV : DPUsers) {
- DPMarker *Marker = DPV->getMarker();
+ for (auto *DVR : DPUsers) {
+ DPMarker *Marker = DVR->getMarker();
if (Marker->getParent() != BB)
- DPV->replaceVariableLocationOp(V, New);
+ DVR->replaceVariableLocationOp(V, New);
}
}
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 2b9dc745d7bfc5..9572d5a4154498 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -180,21 +180,21 @@ struct VerifierSupport {
}
}
- void Write(DPValue::LocationType Type) {
+ void Write(DbgVariableRecord::LocationType Type) {
switch (Type) {
- case DPValue::LocationType::Value:
+ case DbgVariableRecord::LocationType::Value:
*OS << "value";
break;
- case DPValue::LocationType::Declare:
+ case DbgVariableRecord::LocationType::Declare:
*OS << "declare";
break;
- case DPValue::LocationType::Assign:
+ case DbgVariableRecord::LocationType::Assign:
*OS << "assign";
break;
- case DPValue::LocationType::End:
+ case DbgVariableRecord::LocationType::End:
*OS << "end";
break;
- case DPValue::LocationType::Any:
+ case DbgVariableRecord::LocationType::Any:
*OS << "any";
break;
};
@@ -545,7 +545,7 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
void visitTemplateParams(const MDNode &N, const Metadata &RawParams);
void visit(DPLabel &DPL);
- void visit(DPValue &DPV);
+ void visit(DbgVariableRecord &DVR);
// InstVisitor overrides...
using InstVisitor<Verifier>::visit;
void visitDbgRecords(Instruction &I);
@@ -632,15 +632,15 @@ class Verifier : public InstVisitor<Verifier>, VerifierSupport {
void verifySiblingFuncletUnwinds();
void verifyFragmentExpression(const DbgVariableIntrinsic &I);
- void verifyFragmentExpression(const DPValue &I);
+ void verifyFragmentExpression(const DbgVariableRecord &I);
template <typename ValueOrMetadata>
void verifyFragmentExpression(const DIVariable &V,
DIExpression::FragmentInfo Fragment,
ValueOrMetadata *Desc);
void verifyFnArgs(const DbgVariableIntrinsic &I);
- void verifyFnArgs(const DPValue &DPV);
+ void verifyFnArgs(const DbgVariableRecord &DVR);
void verifyNotEntryValue(const DbgVariableIntrinsic &I);
- void verifyNotEntryValue(const DPValue &I);
+ void verifyNotEntryValue(const DbgVariableRecord &I);
/// Module-level debug info verification...
void verifyCompileUnits();
@@ -690,12 +690,12 @@ void Verifier::visitDbgRecords(Instruction &I) {
if (auto *Loc =
dyn_cast_or_null<DILocation>(DR.getDebugLoc().getAsMDNode()))
visitMDNode(*Loc, AreDebugLocsAllowed::Yes);
- if (auto *DPV = dyn_cast<DPValue>(&DR)) {
- visit(*DPV);
+ if (auto *DVR = dyn_cast<DbgVariableRecord>(&DR)) {
+ visit(*DVR);
// These have to appear after `visit` for consistency with existing
// intrinsic behaviour.
- verifyFragmentExpression(*DPV);
- verifyNotEntryValue(*DPV);
+ verifyFragmentExpression(*DVR);
+ verifyNotEntryValue(*DVR);
} else if (auto *DPL = dyn_cast<DPLabel>(&DR)) {
visit(*DPL);
}
@@ -4807,11 +4807,12 @@ void Verifier::visitDIAssignIDMetadata(Instruction &I, MDNode *MD) {
"dbg.assign not in same function as inst", DAI, &I);
}
}
- for (DPValue *DPV : cast<DIAssignID>(MD)->getAllDPValueUsers()) {
- CheckDI(DPV->isDbgAssign(),
- "!DIAssignID should only be used by Assign DPVs.", MD, DPV);
- CheckDI(DPV->getFunction() == I.getFunction(),
- "DPVAssign not in same function as inst", DPV, &I);
+ for (DbgVariableRecord *DVR :
+ cast<DIAssignID>(MD)->getAllDbgVariableRecordUsers()) {
+ CheckDI(DVR->isDbgAssign(),
+ "!DIAssignID should only be used by Assign DVRs.", MD, DVR);
+ CheckDI(DVR->getFunction() == I.getFunction(),
+ "DVRAssign not in same function as inst", DVR, &I);
}
}
@@ -6247,71 +6248,72 @@ void Verifier::visit(DPLabel &DPL) {
Loc->getScope()->getSubprogram());
}
-void Verifier::visit(DPValue &DPV) {
- BasicBlock *BB = DPV.getParent();
+void Verifier::visit(DbgVariableRecord &DVR) {
+ BasicBlock *BB = DVR.getParent();
Function *F = BB->getParent();
- CheckDI(DPV.getType() == DPValue::LocationType::Value ||
- DPV.getType() == DPValue::LocationType::Declare ||
- DPV.getType() == DPValue::LocationType::Assign,
- "invalid #dbg record type", &DPV, DPV.getType());
+ CheckDI(DVR.getType() == DbgVariableRecord::LocationType::Value ||
+ DVR.getType() == DbgVariableRecord::LocationType::Declare ||
+ DVR.getType() == DbgVariableRecord::LocationType::Assign,
+ "invalid #dbg record type", &DVR, DVR.getType());
- // The location for a DPValue must be either a ValueAsMetadata, DIArgList, or
- // an empty MDNode (which is a legacy representation for an "undef" location).
- auto *MD = DPV.getRawLocation();
+ // The location for a DbgVariableRecord must be either a ValueAsMetadata,
+ // DIArgList, or an empty MDNode (which is a legacy representation for an
+ // "undef" location).
+ auto *MD = DVR.getRawLocation();
CheckDI(MD && (isa<ValueAsMetadata>(MD) || isa<DIArgList>(MD) ||
(isa<MDNode>(MD) && !cast<MDNode>(MD)->getNumOperands())),
- "invalid #dbg record address/value", &DPV, MD);
+ "invalid #dbg record address/value", &DVR, MD);
if (auto *VAM = dyn_cast<ValueAsMetadata>(MD))
visitValueAsMetadata(*VAM, F);
else if (auto *AL = dyn_cast<DIArgList>(MD))
visitDIArgList(*AL, F);
- CheckDI(isa_and_nonnull<DILocalVariable>(DPV.getRawVariable()),
- "invalid #dbg record variable", &DPV, DPV.getRawVariable());
- visitMDNode(*DPV.getRawVariable(), AreDebugLocsAllowed::No);
+ CheckDI(isa_and_nonnull<DILocalVariable>(DVR.getRawVariable()),
+ "invalid #dbg record variable", &DVR, DVR.getRawVariable());
+ visitMDNode(*DVR.getRawVariable(), AreDebugLocsAllowed::No);
- CheckDI(isa_and_nonnull<DIExpression>(DPV.getRawExpression()),
- "invalid #dbg record expression", &DPV, DPV.getRawExpression());
- visitMDNode(*DPV.getExpression(), AreDebugLocsAllowed::No);
+ CheckDI(isa_and_nonnull<DIExpression>(DVR.getRawExpression()),
+ "invalid #dbg record expression", &DVR, DVR.getRawExpression());
+ visitMDNode(*DVR.getExpression(), AreDebugLocsAllowed::No);
- if (DPV.isDbgAssign()) {
- CheckDI(isa_and_nonnull<DIAssignID>(DPV.getRawAssignID()),
- "invalid #dbg_assign DIAssignID", &DPV, DPV.getRawAssignID());
- visitMDNode(*cast<DIAssignID>(DPV.getRawAssignID()),
+ if (DVR.isDbgAssign()) {
+ CheckDI(isa_and_nonnull<DIAssignID>(DVR.getRawAssignID()),
+ "invalid #dbg_assign DIAssignID", &DVR, DVR.getRawAssignID());
+ visitMDNode(*cast<DIAssignID>(DVR.getRawAssignID()),
AreDebugLocsAllowed::No);
- const auto *RawAddr = DPV.getRawAddress();
- // Similarly to the location above, the address for an assign DPValue must
- // be a ValueAsMetadata or an empty MDNode, which represents an undef
- // address.
+ const auto *RawAddr = DVR.getRawAddress();
+ // Similarly to the location above, the address for an assign
+ // DbgVariableRecord must be a ValueAsMetadata or an empty MDNode, which
+ // represents an undef address.
CheckDI(
isa<ValueAsMetadata>(RawAddr) ||
(isa<MDNode>(RawAddr) && !cast<MDNode>(RawAddr)->getNumOperands()),
- "invalid #dbg_assign address", &DPV, DPV.getRawAddress());
+ "invalid #dbg_assign address", &DVR, DVR.getRawAddress());
if (auto *VAM = dyn_cast<ValueAsMetadata>(RawAddr))
visitValueAsMetadata(*VAM, F);
- CheckDI(isa_and_nonnull<DIExpression>(DPV.getRawAddressExpression()),
- "invalid #dbg_assign address expression", &DPV,
- DPV.getRawAddressExpression());
- visitMDNode(*DPV.getAddressExpression(), AreDebugLocsAllowed::No);
+ CheckDI(isa_and_nonnull<DIExpression>(DVR.getRawAddressExpression()),
+ "invalid #dbg_assign address expression", &DVR,
+ DVR.getRawAddressExpression());
+ visitMDNode(*DVR.getAddressExpression(), AreDebugLocsAllowed::No);
- // All of the linked instructions should be in the same function as DPV.
- for (Instruction *I : at::getAssignmentInsts(&DPV))
- CheckDI(DPV.getFunction() == I->getFunction(),
- "inst not in same function as #dbg_assign", I, &DPV);
+ // All of the linked instructions should be in the same function as DVR.
+ for (Instruction *I : at::getAssignmentInsts(&DVR))
+ CheckDI(DVR.getFunction() == I->getFunction(),
+ "inst not in same function as #dbg_assign", I, &DVR);
}
// This check is redundant with one in visitLocalVariable().
- DILocalVariable *Var = DPV.getVariable();
+ DILocalVariable *Var = DVR.getVariable();
CheckDI(isType(Var->getRawType()), "invalid type ref", Var,
Var->getRawType());
- auto *DLNode = DPV.getDebugLoc().getAsMDNode();
+ auto *DLNode = DVR.getDebugLoc().getAsMDNode();
CheckDI(isa_and_nonnull<DILocation>(DLNode), "invalid #dbg record DILocation",
- &DPV, DLNode);
- DILocation *Loc = DPV.getDebugLoc();
+ &DVR, DLNode);
+ DILocation *Loc = DVR.getDebugLoc();
// The scopes for variables and !dbg attachments must agree.
DISubprogram *VarSP = getSubprogram(Var->getRawScope());
@@ -6321,10 +6323,10 @@ void Verifier::visit(DPValue &DPV) {
CheckDI(VarSP == LocSP,
"mismatched subprogram between #dbg record variable and DILocation",
- &DPV, BB, F, Var, Var->getScope()->getSubprogram(), Loc,
+ &DVR, BB, F, Var, Var->getScope()->getSubprogram(), Loc,
Loc->getScope()->getSubprogram());
- verifyFnArgs(DPV);
+ verifyFnArgs(DVR);
}
void Verifier::visitVPIntrinsic(VPIntrinsic &VPI) {
@@ -6685,9 +6687,9 @@ void Verifier::verifyFragmentExpression(const DbgVariableIntrinsic &I) {
verifyFragmentExpression(*V, *Fragment, &I);
}
-void Verifier::verifyFragmentExpression(const DPValue &DPV) {
- DILocalVariable *V = dyn_cast_or_null<DILocalVariable>(DPV.getRawVariable());
- DIExpression *E = dyn_cast_or_null<DIExpression>(DPV.getRawExpression());
+void Verifier::verifyFragmentExpression(const DbgVariableRecord &DVR) {
+ DILocalVariable *V = dyn_cast_or_null<DILocalVariable>(DVR.getRawVariable());
+ DIExpression *E = dyn_cast_or_null<DIExpression>(DVR.getRawExpression());
// We don't know whether this intrinsic verified correctly.
if (!V || !E || !E->isValid())
@@ -6707,7 +6709,7 @@ void Verifier::verifyFragmentExpression(const DPValue &DPV) {
if (V->isArtificial())
return;
- verifyFragmentExpression(*V, *Fragment, &DPV);
+ verifyFragmentExpression(*V, *Fragment, &DVR);
}
template <typename ValueOrMetadata>
@@ -6755,7 +6757,7 @@ void Verifier::verifyFnArgs(const DbgVariableIntrinsic &I) {
CheckDI(!Prev || (Prev == Var), "conflicting debug info for argument", &I,
Prev, Var);
}
-void Verifier::verifyFnArgs(const DPValue &DPV) {
+void Verifier::verifyFnArgs(const DbgVariableRecord &DVR) {
// This function does not take the scope of noninlined function arguments into
// account. Don't run it if current function is nodebug, because it may
// contain inlined debug intrinsics.
@@ -6763,10 +6765,10 @@ void Verifier::verifyFnArgs(const DPValue &DPV) {
return;
// For performance reasons only check non-inlined ones.
- if (DPV.getDebugLoc()->getInlinedAt())
+ if (DVR.getDebugLoc()->getInlinedAt())
return;
- DILocalVariable *Var = DPV.getVariable();
+ DILocalVariable *Var = DVR.getVariable();
CheckDI(Var, "#dbg record without variable");
unsigned ArgNo = Var->getArg();
@@ -6780,7 +6782,7 @@ void Verifier::verifyFnArgs(const DPValue &DPV) {
auto *Prev = DebugFnArgs[ArgNo - 1];
DebugFnArgs[ArgNo - 1] = Var;
- CheckDI(!Prev || (Prev == Var), "conflicting debug info for argument", &DPV,
+ CheckDI(!Prev || (Prev == Var), "conflicting debug info for argument", &DVR,
Prev, Var);
}
@@ -6807,15 +6809,15 @@ void Verifier::verifyNotEntryValue(const DbgVariableIntrinsic &I) {
"swiftasync Argument",
&I);
}
-void Verifier::verifyNotEntryValue(const DPValue &DPV) {
- DIExpression *E = dyn_cast_or_null<DIExpression>(DPV.getRawExpression());
+void Verifier::verifyNotEntryValue(const DbgVariableRecord &DVR) {
+ DIExpression *E = dyn_cast_or_null<DIExpression>(DVR.getRawExpression());
// We don't know whether this intrinsic verified correctly.
if (!E || !E->isValid())
return;
- if (isa<ValueAsMetadata>(DPV.getRawLocation())) {
- Value *VarValue = DPV.getVariableLocationOp(0);
+ if (isa<ValueAsMetadata>(DVR.getRawLocation())) {
+ Value *VarValue = DVR.getVariableLocationOp(0);
if (isa<UndefValue>(VarValue) || isa<PoisonValue>(VarValue))
return;
// We allow EntryValues for swift async arguments, as they have an
@@ -6828,7 +6830,7 @@ void Verifier::verifyNotEntryValue(const DPValue &DPV) {
CheckDI(!E->isEntryValue(),
"Entry values are only allowed in MIR unless they target a "
"swiftasync Argument",
- &DPV);
+ &DVR);
}
void Verifier::verifyCompileUnits() {
diff --git a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
index ef7c517732ef3f..d2bdeebd0e5af8 100644
--- a/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
+++ b/llvm/lib/Target/AArch64/AArch64StackTagging.cpp
@@ -532,7 +532,7 @@ bool AArch64StackTagging::runOnFunction(Function &Fn) {
ConstantInt::get(IRB.getInt64Ty(), Tag)});
if (Info.AI->hasName())
TagPCall->setName(Info.AI->getName() + ".tag");
- // Does not replace metadata, so we don't have to handle DPValues.
+ // Does not replace metadata, so we don't have to handle DbgVariableRecords.
Info.AI->replaceNonMetadataUsesWith(TagPCall);
TagPCall->setOperand(0, Info.AI);
diff --git a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
index ae2a06a1d4748a..08a4522e3fac6d 100644
--- a/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroFrame.cpp
@@ -971,7 +971,7 @@ static void cacheDIVar(FrameDataInfo &FrameData,
DIVarCache.insert({V, (*I)->getVariable()});
};
CacheIt(findDbgDeclares(V));
- CacheIt(findDPVDeclares(V));
+ CacheIt(findDVRDeclares(V));
}
}
@@ -1123,7 +1123,7 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
"Coroutine with switch ABI should own Promise alloca");
TinyPtrVector<DbgDeclareInst *> DIs = findDbgDeclares(PromiseAlloca);
- TinyPtrVector<DPValue *> DPVs = findDPVDeclares(PromiseAlloca);
+ TinyPtrVector<DbgVariableRecord *> DVRs = findDVRDeclares(PromiseAlloca);
DILocalVariable *PromiseDIVariable = nullptr;
DILocation *DILoc = nullptr;
@@ -1131,10 +1131,10 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
DbgDeclareInst *PromiseDDI = DIs.front();
PromiseDIVariable = PromiseDDI->getVariable();
DILoc = PromiseDDI->getDebugLoc().get();
- } else if (!DPVs.empty()) {
- DPValue *PromiseDPV = DPVs.front();
- PromiseDIVariable = PromiseDPV->getVariable();
- DILoc = PromiseDPV->getDebugLoc().get();
+ } else if (!DVRs.empty()) {
+ DbgVariableRecord *PromiseDVR = DVRs.front();
+ PromiseDIVariable = PromiseDVR->getVariable();
+ DILoc = PromiseDVR->getDebugLoc().get();
} else {
return;
}
@@ -1273,11 +1273,12 @@ static void buildFrameDebugInfo(Function &F, coro::Shape &Shape,
}
if (UseNewDbgInfoFormat) {
- DPValue *NewDPV = new DPValue(ValueAsMetadata::get(Shape.FramePtr),
- FrameDIVar, DBuilder.createExpression(),
- DILoc, DPValue::LocationType::Declare);
+ DbgVariableRecord *NewDVR =
+ new DbgVariableRecord(ValueAsMetadata::get(Shape.FramePtr), FrameDIVar,
+ DBuilder.createExpression(), DILoc,
+ DbgVariableRecord::LocationType::Declare);
BasicBlock::iterator It = Shape.getInsertPtAfterFramePtr();
- It->getParent()->insertDbgRecordBefore(NewDPV, It);
+ It->getParent()->insertDbgRecordBefore(NewDVR, It);
} else {
DBuilder.insertDeclare(Shape.FramePtr, FrameDIVar,
DBuilder.createExpression(), DILoc,
@@ -1862,13 +1863,13 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
SpillAlignment, E.first->getName() + Twine(".reload"));
TinyPtrVector<DbgDeclareInst *> DIs = findDbgDeclares(Def);
- TinyPtrVector<DPValue *> DPVs = findDPVDeclares(Def);
+ TinyPtrVector<DbgVariableRecord *> DVRs = findDVRDeclares(Def);
// Try best to find dbg.declare. If the spill is a temp, there may not
// be a direct dbg.declare. Walk up the load chain to find one from an
// alias.
if (F->getSubprogram()) {
auto *CurDef = Def;
- while (DIs.empty() && DPVs.empty() && isa<LoadInst>(CurDef)) {
+ while (DIs.empty() && DVRs.empty() && isa<LoadInst>(CurDef)) {
auto *LdInst = cast<LoadInst>(CurDef);
// Only consider ptr to ptr same type load.
if (LdInst->getPointerOperandType() != LdInst->getType())
@@ -1877,7 +1878,7 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
if (!isa<AllocaInst, LoadInst>(CurDef))
break;
DIs = findDbgDeclares(CurDef);
- DPVs = findDPVDeclares(CurDef);
+ DVRs = findDVRDeclares(CurDef);
}
}
@@ -1887,12 +1888,12 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
// fragments. It will be unreachable in the main function, and
// processed by coro::salvageDebugInfo() by CoroCloner.
if (UseNewDbgInfoFormat) {
- DPValue *NewDPV =
- new DPValue(ValueAsMetadata::get(CurrentReload),
- DDI->getVariable(), DDI->getExpression(),
- DDI->getDebugLoc(), DPValue::LocationType::Declare);
+ DbgVariableRecord *NewDVR = new DbgVariableRecord(
+ ValueAsMetadata::get(CurrentReload), DDI->getVariable(),
+ DDI->getExpression(), DDI->getDebugLoc(),
+ DbgVariableRecord::LocationType::Declare);
Builder.GetInsertPoint()->getParent()->insertDbgRecordBefore(
- NewDPV, Builder.GetInsertPoint());
+ NewDVR, Builder.GetInsertPoint());
} else {
DIBuilder(*CurrentBlock->getParent()->getParent(), AllowUnresolved)
.insertDeclare(CurrentReload, DDI->getVariable(),
@@ -1905,7 +1906,7 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
false /*UseEntryValue*/);
};
for_each(DIs, SalvageOne);
- for_each(DPVs, SalvageOne);
+ for_each(DVRs, SalvageOne);
}
// If we have a single edge PHINode, remove it and replace it with a
@@ -1925,8 +1926,8 @@ 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 : filterDbgVars(U->getDbgRecordRange()))
- DPV.replaceVariableLocationOp(Def, CurrentReload, true);
+ for (DbgVariableRecord &DVR : filterDbgVars(U->getDbgRecordRange()))
+ DVR.replaceVariableLocationOp(Def, CurrentReload, true);
}
}
@@ -1977,12 +1978,12 @@ static void insertSpills(const FrameDataInfo &FrameData, coro::Shape &Shape) {
G->setName(Alloca->getName() + Twine(".reload.addr"));
SmallVector<DbgVariableIntrinsic *, 4> DIs;
- SmallVector<DPValue *> DPValues;
- findDbgUsers(DIs, Alloca, &DPValues);
+ SmallVector<DbgVariableRecord *> DbgVariableRecords;
+ findDbgUsers(DIs, Alloca, &DbgVariableRecords);
for (auto *DVI : DIs)
DVI->replaceUsesOfWith(Alloca, G);
- for (auto *DPV : DPValues)
- DPV->replaceVariableLocationOp(Alloca, G);
+ for (auto *DVR : DbgVariableRecords)
+ DVR->replaceVariableLocationOp(Alloca, G);
for (Instruction *I : UsersToUpdate) {
// It is meaningless to retain the lifetime intrinsics refer for the
@@ -2960,30 +2961,30 @@ void coro::salvageDebugInfo(
}
void coro::salvageDebugInfo(
- SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap, DPValue &DPV,
- bool OptimizeFrame, bool UseEntryValue) {
+ SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
+ DbgVariableRecord &DVR, bool OptimizeFrame, bool UseEntryValue) {
- Function *F = DPV.getFunction();
+ Function *F = DVR.getFunction();
// Follow the pointer arithmetic all the way to the incoming
// function argument and convert into a DIExpression.
- bool SkipOutermostLoad = DPV.isDbgDeclare();
- Value *OriginalStorage = DPV.getVariableLocationOp(0);
+ bool SkipOutermostLoad = DVR.isDbgDeclare();
+ Value *OriginalStorage = DVR.getVariableLocationOp(0);
auto SalvagedInfo = ::salvageDebugInfoImpl(
ArgToAllocaMap, OptimizeFrame, UseEntryValue, F, OriginalStorage,
- DPV.getExpression(), SkipOutermostLoad);
+ DVR.getExpression(), SkipOutermostLoad);
if (!SalvagedInfo)
return;
Value *Storage = &SalvagedInfo->first;
DIExpression *Expr = &SalvagedInfo->second;
- DPV.replaceVariableLocationOp(OriginalStorage, Storage);
- DPV.setExpression(Expr);
+ DVR.replaceVariableLocationOp(OriginalStorage, Storage);
+ DVR.setExpression(Expr);
// We only hoist dbg.declare today since it doesn't make sense to hoist
// dbg.value since it does not have the same function wide guarantees that
// dbg.declare does.
- if (DPV.getType() == DPValue::LocationType::Declare) {
+ if (DVR.getType() == DbgVariableRecord::LocationType::Declare) {
std::optional<BasicBlock::iterator> InsertPt;
if (auto *I = dyn_cast<Instruction>(Storage)) {
InsertPt = I->getInsertionPointAfterDef();
@@ -2991,12 +2992,12 @@ void coro::salvageDebugInfo(
// optimizations. See https://github.com/llvm/llvm-project/pull/75104 for
// an example.
if (!OptimizeFrame && I->getDebugLoc())
- DPV.setDebugLoc(I->getDebugLoc());
+ DVR.setDebugLoc(I->getDebugLoc());
} else if (isa<Argument>(Storage))
InsertPt = F->getEntryBlock().begin();
if (InsertPt) {
- DPV.removeFromParent();
- (*InsertPt)->getParent()->insertDbgRecordBefore(&DPV, *InsertPt);
+ DVR.removeFromParent();
+ (*InsertPt)->getParent()->insertDbgRecordBefore(&DVR, *InsertPt);
}
}
}
@@ -3188,15 +3189,15 @@ void coro::buildCoroutineFrame(
for (auto &Iter : FrameData.Spills) {
auto *V = Iter.first;
SmallVector<DbgValueInst *, 16> DVIs;
- SmallVector<DPValue *, 16> DPVs;
- findDbgValues(DVIs, V, &DPVs);
+ SmallVector<DbgVariableRecord *, 16> DVRs;
+ findDbgValues(DVIs, V, &DVRs);
for (DbgValueInst *DVI : DVIs)
if (Checker.isDefinitionAcrossSuspend(*V, DVI))
FrameData.Spills[V].push_back(DVI);
// Add the instructions which carry debug info that is in the frame.
- for (DPValue *DPV : DPVs)
- if (Checker.isDefinitionAcrossSuspend(*V, DPV->Marker->MarkedInstr))
- FrameData.Spills[V].push_back(DPV->Marker->MarkedInstr);
+ for (DbgVariableRecord *DVR : DVRs)
+ if (Checker.isDefinitionAcrossSuspend(*V, DVR->Marker->MarkedInstr))
+ FrameData.Spills[V].push_back(DVR->Marker->MarkedInstr);
}
LLVM_DEBUG(dumpSpills("Spills", FrameData.Spills));
diff --git a/llvm/lib/Transforms/Coroutines/CoroInternal.h b/llvm/lib/Transforms/Coroutines/CoroInternal.h
index 09d1430b4c559e..84fd88806154e3 100644
--- a/llvm/lib/Transforms/Coroutines/CoroInternal.h
+++ b/llvm/lib/Transforms/Coroutines/CoroInternal.h
@@ -35,8 +35,8 @@ void salvageDebugInfo(
SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
DbgVariableIntrinsic &DVI, bool OptimizeFrame, bool IsEntryPoint);
void salvageDebugInfo(
- SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap, DPValue &DPV,
- bool OptimizeFrame, bool UseEntryValue);
+ SmallDenseMap<Argument *, AllocaInst *, 4> &ArgToAllocaMap,
+ DbgVariableRecord &DVR, bool OptimizeFrame, bool UseEntryValue);
// Keeps data and helper functions for lowering coroutine intrinsics.
struct LowererBase {
diff --git a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
index 0fce596d3e2ca0..3f3d81474fafe4 100644
--- a/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
+++ b/llvm/lib/Transforms/Coroutines/CoroSplit.cpp
@@ -679,17 +679,18 @@ static void replaceSwiftErrorOps(Function &F, coro::Shape &Shape,
}
/// Returns all DbgVariableIntrinsic in F.
-static std::pair<SmallVector<DbgVariableIntrinsic *, 8>, SmallVector<DPValue *>>
+static std::pair<SmallVector<DbgVariableIntrinsic *, 8>,
+ SmallVector<DbgVariableRecord *>>
collectDbgVariableIntrinsics(Function &F) {
SmallVector<DbgVariableIntrinsic *, 8> Intrinsics;
- SmallVector<DPValue *> DPValues;
+ SmallVector<DbgVariableRecord *> DbgVariableRecords;
for (auto &I : instructions(F)) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- DPValues.push_back(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ DbgVariableRecords.push_back(&DVR);
if (auto *DVI = dyn_cast<DbgVariableIntrinsic>(&I))
Intrinsics.push_back(DVI);
}
- return {Intrinsics, DPValues};
+ return {Intrinsics, DbgVariableRecords};
}
void CoroCloner::replaceSwiftErrorOps() {
@@ -697,7 +698,7 @@ void CoroCloner::replaceSwiftErrorOps() {
}
void CoroCloner::salvageDebugInfo() {
- auto [Worklist, DPValues] = collectDbgVariableIntrinsics(*NewF);
+ auto [Worklist, DbgVariableRecords] = collectDbgVariableIntrinsics(*NewF);
SmallDenseMap<Argument *, AllocaInst *, 4> ArgToAllocaMap;
// Only 64-bit ABIs have a register we can refer to with the entry value.
@@ -706,8 +707,8 @@ void CoroCloner::salvageDebugInfo() {
for (DbgVariableIntrinsic *DVI : Worklist)
coro::salvageDebugInfo(ArgToAllocaMap, *DVI, Shape.OptimizeFrame,
UseEntryValue);
- for (DPValue *DPV : DPValues)
- coro::salvageDebugInfo(ArgToAllocaMap, *DPV, Shape.OptimizeFrame,
+ for (DbgVariableRecord *DVR : DbgVariableRecords)
+ coro::salvageDebugInfo(ArgToAllocaMap, *DVR, Shape.OptimizeFrame,
UseEntryValue);
// Remove all salvaged dbg.declare intrinsics that became
@@ -732,7 +733,7 @@ void CoroCloner::salvageDebugInfo() {
}
};
for_each(Worklist, RemoveOne);
- for_each(DPValues, RemoveOne);
+ for_each(DbgVariableRecords, RemoveOne);
}
void CoroCloner::replaceEntryBlock() {
@@ -2107,12 +2108,12 @@ splitCoroutine(Function &F, SmallVectorImpl<Function *> &Clones,
// original function. The Cloner has already salvaged debug info in the new
// coroutine funclets.
SmallDenseMap<Argument *, AllocaInst *, 4> ArgToAllocaMap;
- auto [DbgInsts, DPValues] = collectDbgVariableIntrinsics(F);
+ auto [DbgInsts, DbgVariableRecords] = collectDbgVariableIntrinsics(F);
for (auto *DDI : DbgInsts)
coro::salvageDebugInfo(ArgToAllocaMap, *DDI, Shape.OptimizeFrame,
false /*UseEntryValue*/);
- for (DPValue *DPV : DPValues)
- coro::salvageDebugInfo(ArgToAllocaMap, *DPV, Shape.OptimizeFrame,
+ for (DbgVariableRecord *DVR : DbgVariableRecords)
+ coro::salvageDebugInfo(ArgToAllocaMap, *DVR, Shape.OptimizeFrame,
false /*UseEntryValue*/);
return Shape;
}
diff --git a/llvm/lib/Transforms/IPO/IROutliner.cpp b/llvm/lib/Transforms/IPO/IROutliner.cpp
index 37f4a8749fd8e8..29f9264f2fc249 100644
--- a/llvm/lib/Transforms/IPO/IROutliner.cpp
+++ b/llvm/lib/Transforms/IPO/IROutliner.cpp
@@ -723,8 +723,8 @@ static void moveFunctionData(Function &Old, Function &New,
for (Instruction &Val : CurrBB) {
// Since debug-info originates from many different locations in the
// 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.
+ // the same debug instructions. Drop non-intrinsic DbgVariableRecords
+ // here, collect intrinsics for removal later.
Val.dropDbgRecords();
// We must handle the scoping of called functions differently than
diff --git a/llvm/lib/Transforms/IPO/MergeFunctions.cpp b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
index 4ff14b671af61a..05a3b169aaaf4c 100644
--- a/llvm/lib/Transforms/IPO/MergeFunctions.cpp
+++ b/llvm/lib/Transforms/IPO/MergeFunctions.cpp
@@ -256,20 +256,22 @@ class MergeFunctions {
/// Fill PDIUnrelatedWL with instructions from the entry block that are
/// unrelated to parameter related debug info.
- /// \param PDPVUnrelatedWL The equivalent non-intrinsic debug records.
- void filterInstsUnrelatedToPDI(BasicBlock *GEntryBlock,
- std::vector<Instruction *> &PDIUnrelatedWL,
- std::vector<DPValue *> &PDPVUnrelatedWL);
+ /// \param PDVRUnrelatedWL The equivalent non-intrinsic debug records.
+ void
+ filterInstsUnrelatedToPDI(BasicBlock *GEntryBlock,
+ std::vector<Instruction *> &PDIUnrelatedWL,
+ std::vector<DbgVariableRecord *> &PDVRUnrelatedWL);
/// Erase the rest of the CFG (i.e. barring the entry block).
void eraseTail(Function *G);
/// Erase the instructions in PDIUnrelatedWL as they are unrelated to the
/// parameter debug info, from the entry block.
- /// \param PDPVUnrelatedWL contains the equivalent set of non-instruction
+ /// \param PDVRUnrelatedWL contains the equivalent set of non-instruction
/// debug-info records.
- void eraseInstsUnrelatedToPDI(std::vector<Instruction *> &PDIUnrelatedWL,
- std::vector<DPValue *> &PDPVUnrelatedWL);
+ void
+ eraseInstsUnrelatedToPDI(std::vector<Instruction *> &PDIUnrelatedWL,
+ std::vector<DbgVariableRecord *> &PDVRUnrelatedWL);
/// Replace G with a simple tail call to bitcast(F). Also (unless
/// MergeFunctionsPDI holds) replace direct uses of G with bitcast(F),
@@ -512,7 +514,7 @@ static Value *createCast(IRBuilder<> &Builder, Value *V, Type *DestTy) {
// parameter debug info, from the entry block.
void MergeFunctions::eraseInstsUnrelatedToPDI(
std::vector<Instruction *> &PDIUnrelatedWL,
- std::vector<DPValue *> &PDPVUnrelatedWL) {
+ std::vector<DbgVariableRecord *> &PDVRUnrelatedWL) {
LLVM_DEBUG(
dbgs() << " Erasing instructions (in reverse order of appearance in "
"entry block) unrelated to parameter debug info from entry "
@@ -526,13 +528,13 @@ void MergeFunctions::eraseInstsUnrelatedToPDI(
PDIUnrelatedWL.pop_back();
}
- while (!PDPVUnrelatedWL.empty()) {
- DPValue *DPV = PDPVUnrelatedWL.back();
- LLVM_DEBUG(dbgs() << " Deleting DPValue ");
- LLVM_DEBUG(DPV->print(dbgs()));
+ while (!PDVRUnrelatedWL.empty()) {
+ DbgVariableRecord *DVR = PDVRUnrelatedWL.back();
+ LLVM_DEBUG(dbgs() << " Deleting DbgVariableRecord ");
+ LLVM_DEBUG(DVR->print(dbgs()));
LLVM_DEBUG(dbgs() << "\n");
- DPV->eraseFromParent();
- PDPVUnrelatedWL.pop_back();
+ DVR->eraseFromParent();
+ PDVRUnrelatedWL.pop_back();
}
LLVM_DEBUG(dbgs() << " } // Done erasing instructions unrelated to parameter "
@@ -564,12 +566,12 @@ void MergeFunctions::eraseTail(Function *G) {
// PDIUnrelatedWL with such instructions.
void MergeFunctions::filterInstsUnrelatedToPDI(
BasicBlock *GEntryBlock, std::vector<Instruction *> &PDIUnrelatedWL,
- std::vector<DPValue *> &PDPVUnrelatedWL) {
+ std::vector<DbgVariableRecord *> &PDVRUnrelatedWL) {
std::set<Instruction *> PDIRelated;
- std::set<DPValue *> PDPVRelated;
+ std::set<DbgVariableRecord *> PDVRRelated;
- // Work out whether a dbg.value intrinsic or an equivalent DPValue is a
- // parameter to be preserved.
+ // Work out whether a dbg.value intrinsic or an equivalent DbgVariableRecord
+ // is a parameter to be preserved.
auto ExamineDbgValue = [](auto *DbgVal, auto &Container) {
LLVM_DEBUG(dbgs() << " Deciding: ");
LLVM_DEBUG(DbgVal->print(dbgs()));
@@ -641,14 +643,14 @@ void MergeFunctions::filterInstsUnrelatedToPDI(
for (BasicBlock::iterator BI = GEntryBlock->begin(), BIE = GEntryBlock->end();
BI != BIE; ++BI) {
- // Examine DPValues as they happen "before" the instruction. Are they
- // connected to parameters?
- for (DPValue &DPV : filterDbgVars(BI->getDbgRecordRange())) {
- if (DPV.isDbgValue() || DPV.isDbgAssign()) {
- ExamineDbgValue(&DPV, PDPVRelated);
+ // Examine DbgVariableRecords as they happen "before" the instruction. Are
+ // they connected to parameters?
+ for (DbgVariableRecord &DVR : filterDbgVars(BI->getDbgRecordRange())) {
+ if (DVR.isDbgValue() || DVR.isDbgAssign()) {
+ ExamineDbgValue(&DVR, PDVRRelated);
} else {
- assert(DPV.isDbgDeclare());
- ExamineDbgDeclare(&DPV, PDPVRelated);
+ assert(DVR.isDbgDeclare());
+ ExamineDbgDeclare(&DVR, PDVRRelated);
}
}
@@ -686,8 +688,8 @@ void MergeFunctions::filterInstsUnrelatedToPDI(
// Collect the set of unrelated instructions and debug records.
for (Instruction &I : *GEntryBlock) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange()))
- IsPDIRelated(&DPV, PDPVRelated, PDPVUnrelatedWL);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ IsPDIRelated(&DVR, PDVRRelated, PDVRUnrelatedWL);
IsPDIRelated(&I, PDIRelated, PDIUnrelatedWL);
}
LLVM_DEBUG(dbgs() << " }\n");
@@ -728,7 +730,7 @@ static void copyMetadataIfPresent(Function *From, Function *To, StringRef Key) {
void MergeFunctions::writeThunk(Function *F, Function *G) {
BasicBlock *GEntryBlock = nullptr;
std::vector<Instruction *> PDIUnrelatedWL;
- std::vector<DPValue *> PDPVUnrelatedWL;
+ std::vector<DbgVariableRecord *> PDVRUnrelatedWL;
BasicBlock *BB = nullptr;
Function *NewG = nullptr;
if (MergeFunctionsPDI) {
@@ -740,7 +742,7 @@ void MergeFunctions::writeThunk(Function *F, Function *G) {
dbgs() << "writeThunk: (MergeFunctionsPDI) filter parameter related "
"debug info for "
<< G->getName() << "() {\n");
- filterInstsUnrelatedToPDI(GEntryBlock, PDIUnrelatedWL, PDPVUnrelatedWL);
+ filterInstsUnrelatedToPDI(GEntryBlock, PDIUnrelatedWL, PDVRUnrelatedWL);
GEntryBlock->getTerminator()->eraseFromParent();
BB = GEntryBlock;
} else {
@@ -790,7 +792,7 @@ void MergeFunctions::writeThunk(Function *F, Function *G) {
<< G->getName() << "()\n");
}
eraseTail(G);
- eraseInstsUnrelatedToPDI(PDIUnrelatedWL, PDPVUnrelatedWL);
+ eraseInstsUnrelatedToPDI(PDIUnrelatedWL, PDVRUnrelatedWL);
LLVM_DEBUG(
dbgs() << "} // End of parameter related debug info filtering for: "
<< G->getName() << "()\n");
diff --git a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
index dd6062d303d42e..6d00645b83dfab 100644
--- a/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
+++ b/llvm/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp
@@ -581,8 +581,8 @@ llvm::ThinLTOBitcodeWriterPass::run(Module &M, ModuleAnalysisManager &AM) {
FunctionAnalysisManager &FAM =
AM.getResult<FunctionAnalysisManagerModuleProxy>(M).getManager();
- // RemoveDIs: there's no bitcode representation of the DPValue debug-info,
- // convert to dbg.values before writing out.
+ // RemoveDIs: there's no bitcode representation of the DbgVariableRecord
+ // debug-info, convert to dbg.values before writing out.
bool IsNewDbgInfoFormat = M.IsNewDbgInfoFormat;
if (IsNewDbgInfoFormat)
M.convertFromNewDbgValues();
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
index 694b18017babc5..adad0269b95bb6 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstCombineCalls.cpp
@@ -274,7 +274,7 @@ Instruction *InstCombinerImpl::SimplifyAnyMemSet(AnyMemSetInst *MI) {
DbgAssign->replaceVariableLocationOp(FillC, FillVal);
};
for_each(at::getAssignmentMarkers(S), replaceOpForAssignmentMarkers);
- for_each(at::getDPVAssignmentMarkers(S), replaceOpForAssignmentMarkers);
+ for_each(at::getDVRAssignmentMarkers(S), replaceOpForAssignmentMarkers);
S->setAlignment(Alignment);
if (isa<AtomicMemSetInst>(MI))
diff --git a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
index 6a1ef6edeb4077..7cdd8b25fa109f 100644
--- a/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
+++ b/llvm/lib/Transforms/InstCombine/InstCombineInternal.h
@@ -757,10 +757,9 @@ class LLVM_LIBRARY_VISIBILITY InstCombinerImpl final
void tryToSinkInstructionDbgValues(
Instruction *I, BasicBlock::iterator InsertPos, BasicBlock *SrcBlock,
BasicBlock *DestBlock, SmallVectorImpl<DbgVariableIntrinsic *> &DbgUsers);
- void tryToSinkInstructionDPValues(Instruction *I,
- BasicBlock::iterator InsertPos,
- BasicBlock *SrcBlock, BasicBlock *DestBlock,
- SmallVectorImpl<DPValue *> &DPUsers);
+ void tryToSinkInstructionDbgVariableRecords(
+ Instruction *I, BasicBlock::iterator InsertPos, BasicBlock *SrcBlock,
+ BasicBlock *DestBlock, SmallVectorImpl<DbgVariableRecord *> &DPUsers);
bool removeInstructionsBeforeUnreachable(Instruction &I);
void addDeadEdge(BasicBlock *From, BasicBlock *To,
diff --git a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
index 1d73f8d96300f0..7492314f79555c 100644
--- a/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
+++ b/llvm/lib/Transforms/InstCombine/InstructionCombining.cpp
@@ -3075,10 +3075,10 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) {
// If we are removing an alloca with a dbg.declare, insert dbg.value calls
// before each store.
SmallVector<DbgVariableIntrinsic *, 8> DVIs;
- SmallVector<DPValue *, 8> DPVs;
+ SmallVector<DbgVariableRecord *, 8> DVRs;
std::unique_ptr<DIBuilder> DIB;
if (isa<AllocaInst>(MI)) {
- findDbgUsers(DVIs, &MI, &DPVs);
+ findDbgUsers(DVIs, &MI, &DVRs);
DIB.reset(new DIBuilder(*MI.getModule(), /*AllowUnresolved=*/false));
}
@@ -3118,9 +3118,9 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) {
for (auto *DVI : DVIs)
if (DVI->isAddressOfVariable())
ConvertDebugDeclareToDebugValue(DVI, SI, *DIB);
- for (auto *DPV : DPVs)
- if (DPV->isAddressOfVariable())
- ConvertDebugDeclareToDebugValue(DPV, SI, *DIB);
+ for (auto *DVR : DVRs)
+ if (DVR->isAddressOfVariable())
+ ConvertDebugDeclareToDebugValue(DVR, SI, *DIB);
} else {
// Casts, GEP, or anything else: we're about to delete this instruction,
// so it can not have any valid uses.
@@ -3165,9 +3165,9 @@ Instruction *InstCombinerImpl::visitAllocSite(Instruction &MI) {
for (auto *DVI : DVIs)
if (DVI->isAddressOfVariable() || DVI->getExpression()->startsWithDeref())
DVI->eraseFromParent();
- for (auto *DPV : DPVs)
- if (DPV->isAddressOfVariable() || DPV->getExpression()->startsWithDeref())
- DPV->eraseFromParent();
+ for (auto *DVR : DVRs)
+ if (DVR->isAddressOfVariable() || DVR->getExpression()->startsWithDeref())
+ DVR->eraseFromParent();
return eraseInstFromFunction(MI);
}
@@ -4568,12 +4568,13 @@ bool InstCombinerImpl::tryToSinkInstruction(Instruction *I,
// mark the location undef: we know it was supposed to receive a new location
// here, but that computation has been sunk.
SmallVector<DbgVariableIntrinsic *, 2> DbgUsers;
- SmallVector<DPValue *, 2> DPValues;
- findDbgUsers(DbgUsers, I, &DPValues);
+ SmallVector<DbgVariableRecord *, 2> DbgVariableRecords;
+ findDbgUsers(DbgUsers, I, &DbgVariableRecords);
if (!DbgUsers.empty())
tryToSinkInstructionDbgValues(I, InsertPos, SrcBlock, DestBlock, DbgUsers);
- if (!DPValues.empty())
- tryToSinkInstructionDPValues(I, InsertPos, SrcBlock, DestBlock, DPValues);
+ if (!DbgVariableRecords.empty())
+ tryToSinkInstructionDbgVariableRecords(I, InsertPos, SrcBlock, DestBlock,
+ DbgVariableRecords);
// PS: there are numerous flaws with this behaviour, not least that right now
// assignments can be re-ordered past other assignments to the same variable
@@ -4646,47 +4647,48 @@ void InstCombinerImpl::tryToSinkInstructionDbgValues(
}
}
-void InstCombinerImpl::tryToSinkInstructionDPValues(
+void InstCombinerImpl::tryToSinkInstructionDbgVariableRecords(
Instruction *I, BasicBlock::iterator InsertPos, BasicBlock *SrcBlock,
- BasicBlock *DestBlock, SmallVectorImpl<DPValue *> &DPValues) {
- // Implementation of tryToSinkInstructionDbgValues, but for the DPValue of
- // variable assignments rather than dbg.values.
-
- // Fetch all DPValues not already in the destination.
- SmallVector<DPValue *, 2> DPValuesToSalvage;
- for (auto &DPV : DPValues)
- if (DPV->getParent() != DestBlock)
- DPValuesToSalvage.push_back(DPV);
-
- // Fetch a second collection, of DPValues in the source block that we're going
- // to sink.
- SmallVector<DPValue *> DPValuesToSink;
- for (DPValue *DPV : DPValuesToSalvage)
- if (DPV->getParent() == SrcBlock)
- DPValuesToSink.push_back(DPV);
-
- // Sort DPValues according to their position in the block. This is a partial
- // order: DPValues attached to different instructions will be ordered by the
- // instruction order, but DPValues attached to the same instruction won't
- // have an order.
- auto Order = [](DPValue *A, DPValue *B) -> bool {
+ BasicBlock *DestBlock,
+ SmallVectorImpl<DbgVariableRecord *> &DbgVariableRecords) {
+ // Implementation of tryToSinkInstructionDbgValues, but for the
+ // DbgVariableRecord of variable assignments rather than dbg.values.
+
+ // Fetch all DbgVariableRecords not already in the destination.
+ SmallVector<DbgVariableRecord *, 2> DbgVariableRecordsToSalvage;
+ for (auto &DVR : DbgVariableRecords)
+ if (DVR->getParent() != DestBlock)
+ DbgVariableRecordsToSalvage.push_back(DVR);
+
+ // Fetch a second collection, of DbgVariableRecords in the source block that
+ // we're going to sink.
+ SmallVector<DbgVariableRecord *> DbgVariableRecordsToSink;
+ for (DbgVariableRecord *DVR : DbgVariableRecordsToSalvage)
+ if (DVR->getParent() == SrcBlock)
+ DbgVariableRecordsToSink.push_back(DVR);
+
+ // Sort DbgVariableRecords according to their position in the block. This is a
+ // partial order: DbgVariableRecords attached to different instructions will
+ // be ordered by the instruction order, but DbgVariableRecords attached to the
+ // same instruction won't have an order.
+ auto Order = [](DbgVariableRecord *A, DbgVariableRecord *B) -> bool {
return B->getInstruction()->comesBefore(A->getInstruction());
};
- llvm::stable_sort(DPValuesToSink, Order);
+ llvm::stable_sort(DbgVariableRecordsToSink, Order);
// If there are two assignments to the same variable attached to the same
// instruction, the ordering between the two assignments is important. Scan
// for this (rare) case and establish which is the last assignment.
using InstVarPair = std::pair<const Instruction *, DebugVariable>;
- SmallDenseMap<InstVarPair, DPValue *> FilterOutMap;
- if (DPValuesToSink.size() > 1) {
+ SmallDenseMap<InstVarPair, DbgVariableRecord *> FilterOutMap;
+ if (DbgVariableRecordsToSink.size() > 1) {
SmallDenseMap<InstVarPair, unsigned> CountMap;
// Count how many assignments to each variable there is per instruction.
- for (DPValue *DPV : DPValuesToSink) {
+ for (DbgVariableRecord *DVR : DbgVariableRecordsToSink) {
DebugVariable DbgUserVariable =
- DebugVariable(DPV->getVariable(), DPV->getExpression(),
- DPV->getDebugLoc()->getInlinedAt());
- CountMap[std::make_pair(DPV->getInstruction(), DbgUserVariable)] += 1;
+ DebugVariable(DVR->getVariable(), DVR->getExpression(),
+ DVR->getDebugLoc()->getInlinedAt());
+ CountMap[std::make_pair(DVR->getInstruction(), DbgUserVariable)] += 1;
}
// If there are any instructions with two assignments, add them to the
@@ -4702,74 +4704,74 @@ void InstCombinerImpl::tryToSinkInstructionDPValues(
// For all instruction/variable pairs needing extra filtering, find the
// latest assignment.
for (const Instruction *Inst : DupSet) {
- for (DPValue &DPV :
+ for (DbgVariableRecord &DVR :
llvm::reverse(filterDbgVars(Inst->getDbgRecordRange()))) {
DebugVariable DbgUserVariable =
- DebugVariable(DPV.getVariable(), DPV.getExpression(),
- DPV.getDebugLoc()->getInlinedAt());
+ DebugVariable(DVR.getVariable(), DVR.getExpression(),
+ DVR.getDebugLoc()->getInlinedAt());
auto FilterIt =
FilterOutMap.find(std::make_pair(Inst, DbgUserVariable));
if (FilterIt == FilterOutMap.end())
continue;
if (FilterIt->second != nullptr)
continue;
- FilterIt->second = &DPV;
+ FilterIt->second = &DVR;
}
}
}
- // Perform cloning of the DPValues that we plan on sinking, filter out any
- // duplicate assignments identified above.
- SmallVector<DPValue *, 2> DPVClones;
+ // Perform cloning of the DbgVariableRecords that we plan on sinking, filter
+ // out any duplicate assignments identified above.
+ SmallVector<DbgVariableRecord *, 2> DVRClones;
SmallSet<DebugVariable, 4> SunkVariables;
- for (DPValue *DPV : DPValuesToSink) {
- if (DPV->Type == DPValue::LocationType::Declare)
+ for (DbgVariableRecord *DVR : DbgVariableRecordsToSink) {
+ if (DVR->Type == DbgVariableRecord::LocationType::Declare)
continue;
DebugVariable DbgUserVariable =
- DebugVariable(DPV->getVariable(), DPV->getExpression(),
- DPV->getDebugLoc()->getInlinedAt());
+ DebugVariable(DVR->getVariable(), DVR->getExpression(),
+ DVR->getDebugLoc()->getInlinedAt());
// For any variable where there were multiple assignments in the same place,
// ignore all but the last assignment.
if (!FilterOutMap.empty()) {
- InstVarPair IVP = std::make_pair(DPV->getInstruction(), DbgUserVariable);
+ InstVarPair IVP = std::make_pair(DVR->getInstruction(), DbgUserVariable);
auto It = FilterOutMap.find(IVP);
// Filter out.
- if (It != FilterOutMap.end() && It->second != DPV)
+ if (It != FilterOutMap.end() && It->second != DVR)
continue;
}
if (!SunkVariables.insert(DbgUserVariable).second)
continue;
- if (DPV->isDbgAssign())
+ if (DVR->isDbgAssign())
continue;
- DPVClones.emplace_back(DPV->clone());
- LLVM_DEBUG(dbgs() << "CLONE: " << *DPVClones.back() << '\n');
+ DVRClones.emplace_back(DVR->clone());
+ LLVM_DEBUG(dbgs() << "CLONE: " << *DVRClones.back() << '\n');
}
// Perform salvaging without the clones, then sink the clones.
- if (DPVClones.empty())
+ if (DVRClones.empty())
return;
- salvageDebugInfoForDbgValues(*I, {}, DPValuesToSalvage);
+ salvageDebugInfoForDbgValues(*I, {}, DbgVariableRecordsToSalvage);
// The clones are in reverse order of original appearance. Assert that the
// head bit is set on the iterator as we _should_ have received it via
// getFirstInsertionPt. Inserting like this will reverse the clone order as
// we'll repeatedly insert at the head, such as:
- // DPV-3 (third insertion goes here)
- // DPV-2 (second insertion goes here)
- // DPV-1 (first insertion goes here)
- // Any-Prior-DPVs
+ // DVR-3 (third insertion goes here)
+ // DVR-2 (second insertion goes here)
+ // DVR-1 (first insertion goes here)
+ // Any-Prior-DVRs
// InsertPtInst
assert(InsertPos.getHeadBit());
- for (DPValue *DPVClone : DPVClones) {
- InsertPos->getParent()->insertDbgRecordBefore(DPVClone, InsertPos);
- LLVM_DEBUG(dbgs() << "SINK: " << *DPVClone << '\n');
+ for (DbgVariableRecord *DVRClone : DVRClones) {
+ InsertPos->getParent()->insertDbgRecordBefore(DVRClone, InsertPos);
+ LLVM_DEBUG(dbgs() << "SINK: " << *DVRClone << '\n');
}
}
diff --git a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
index 87584dace32dd4..ca0ccb352195a3 100644
--- a/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
+++ b/llvm/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp
@@ -1390,8 +1390,8 @@ static DbgAssignIntrinsic *DynCastToDbgAssign(DbgVariableIntrinsic *DVI) {
return dyn_cast<DbgAssignIntrinsic>(DVI);
}
-static DPValue *DynCastToDbgAssign(DPValue *DPV) {
- return DPV->isDbgAssign() ? DPV : nullptr;
+static DbgVariableRecord *DynCastToDbgAssign(DbgVariableRecord *DVR) {
+ return DVR->isDbgAssign() ? DVR : nullptr;
}
bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
@@ -1449,7 +1449,8 @@ bool HWAddressSanitizer::instrumentStack(memtag::StackInfo &SInfo,
});
// Helper utility for adding DW_OP_LLVM_tag_offset to debug-info records,
- // abstracted over whether they're intrinsic-stored or DPValue stored.
+ // abstracted over whether they're intrinsic-stored or DbgVariableRecord
+ // stored.
auto AnnotateDbgRecord = [&](auto *DPtr) {
// Prepend "tag_offset, N" to the dwarf expression.
// Tag offset logically applies to the alloca pointer, and it makes sense
diff --git a/llvm/lib/Transforms/Scalar/ADCE.cpp b/llvm/lib/Transforms/Scalar/ADCE.cpp
index 4d901310efe520..96ecd7f368a000 100644
--- a/llvm/lib/Transforms/Scalar/ADCE.cpp
+++ b/llvm/lib/Transforms/Scalar/ADCE.cpp
@@ -544,15 +544,16 @@ ADCEChanged AggressiveDeadCodeElimination::removeDeadInstructions() {
// value of the function, and may therefore be deleted safely.
// NOTE: We reuse the Worklist vector here for memory efficiency.
for (Instruction &I : llvm::reverse(instructions(F))) {
- // With "RemoveDIs" debug-info stored in DPValue objects, debug-info
- // 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.
+ // With "RemoveDIs" debug-info stored in DbgVariableRecord objects,
+ // debug-info 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.getDbgRecordRange())) {
- // Avoid removing a DPV that is linked to instructions because it holds
+ // Avoid removing a DVR that is linked to instructions because it holds
// information about an existing store.
- if (DPValue *DPV = dyn_cast<DPValue>(&DR); DPV && DPV->isDbgAssign())
- if (!at::getAssignmentInsts(DPV).empty())
+ if (DbgVariableRecord *DVR = dyn_cast<DbgVariableRecord>(&DR);
+ DVR && DVR->isDbgAssign())
+ if (!at::getAssignmentInsts(DVR).empty())
continue;
if (AliveScopes.count(DR.getDebugLoc()->getScope()))
continue;
diff --git a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
index 392e6ad5a66bb9..bfc8bd5970bf27 100644
--- a/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
+++ b/llvm/lib/Transforms/Scalar/DeadStoreElimination.cpp
@@ -526,7 +526,8 @@ static void shortenAssignment(Instruction *Inst, Value *OriginalDest,
// returned by getAssignmentMarkers so save a copy of the markers to iterate
// over.
auto LinkedRange = at::getAssignmentMarkers(Inst);
- SmallVector<DPValue *> LinkedDPVAssigns = at::getDPVAssignmentMarkers(Inst);
+ SmallVector<DbgVariableRecord *> LinkedDVRAssigns =
+ at::getDVRAssignmentMarkers(Inst);
SmallVector<DbgAssignIntrinsic *> Linked(LinkedRange.begin(),
LinkedRange.end());
auto InsertAssignForOverlap = [&](auto *Assign) {
@@ -554,7 +555,7 @@ static void shortenAssignment(Instruction *Inst, Value *OriginalDest,
NewAssign->setKillAddress();
};
for_each(Linked, InsertAssignForOverlap);
- for_each(LinkedDPVAssigns, InsertAssignForOverlap);
+ for_each(LinkedDVRAssigns, InsertAssignForOverlap);
}
static bool tryToShorten(Instruction *DeadI, int64_t &DeadStart,
diff --git a/llvm/lib/Transforms/Scalar/JumpThreading.cpp b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
index 5d7b050ed5b2e3..fd68359525707f 100644
--- a/llvm/lib/Transforms/Scalar/JumpThreading.cpp
+++ b/llvm/lib/Transforms/Scalar/JumpThreading.cpp
@@ -401,8 +401,8 @@ 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 : filterDbgVars(I.getDbgRecordRange()))
- DPV.replaceVariableLocationOp(Cond, ToVal, true);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange()))
+ DVR.replaceVariableLocationOp(Cond, ToVal, true);
// Reached the Cond whose uses we are trying to replace, so there are no
// more uses.
@@ -1955,7 +1955,7 @@ void JumpThreadingPass::updateSSA(
SSAUpdater SSAUpdate;
SmallVector<Use *, 16> UsesToRename;
SmallVector<DbgValueInst *, 4> DbgValues;
- SmallVector<DPValue *, 4> DPValues;
+ SmallVector<DbgVariableRecord *, 4> DbgVariableRecords;
for (Instruction &I : *BB) {
// Scan all uses of this instruction to see if it is used outside of its
@@ -1972,16 +1972,16 @@ void JumpThreadingPass::updateSSA(
}
// Find debug values outside of the block
- findDbgValues(DbgValues, &I, &DPValues);
+ findDbgValues(DbgValues, &I, &DbgVariableRecords);
llvm::erase_if(DbgValues, [&](const DbgValueInst *DbgVal) {
return DbgVal->getParent() == BB;
});
- llvm::erase_if(DPValues, [&](const DPValue *DPVal) {
- return DPVal->getParent() == BB;
+ llvm::erase_if(DbgVariableRecords, [&](const DbgVariableRecord *DbgVarRec) {
+ return DbgVarRec->getParent() == BB;
});
// If there are no uses outside the block, we're done with this instruction.
- if (UsesToRename.empty() && DbgValues.empty() && DPValues.empty())
+ if (UsesToRename.empty() && DbgValues.empty() && DbgVariableRecords.empty())
continue;
LLVM_DEBUG(dbgs() << "JT: Renaming non-local uses of: " << I << "\n");
@@ -1994,11 +1994,11 @@ void JumpThreadingPass::updateSSA(
while (!UsesToRename.empty())
SSAUpdate.RewriteUse(*UsesToRename.pop_back_val());
- if (!DbgValues.empty() || !DPValues.empty()) {
+ if (!DbgValues.empty() || !DbgVariableRecords.empty()) {
SSAUpdate.UpdateDebugValues(&I, DbgValues);
- SSAUpdate.UpdateDebugValues(&I, DPValues);
+ SSAUpdate.UpdateDebugValues(&I, DbgVariableRecords);
DbgValues.clear();
- DPValues.clear();
+ DbgVariableRecords.clear();
}
LLVM_DEBUG(dbgs() << "\n");
@@ -2041,11 +2041,11 @@ JumpThreadingPass::cloneInstructions(BasicBlock::iterator BI,
return true;
};
- // Duplicate implementation of the above dbg.value code, using DPValues
- // instead.
- auto RetargetDPValueIfPossible = [&](DPValue *DPV) {
+ // Duplicate implementation of the above dbg.value code, using
+ // DbgVariableRecords instead.
+ auto RetargetDbgVariableRecordIfPossible = [&](DbgVariableRecord *DVR) {
SmallSet<std::pair<Value *, Value *>, 16> OperandsToRemap;
- for (auto *Op : DPV->location_ops()) {
+ for (auto *Op : DVR->location_ops()) {
Instruction *OpInst = dyn_cast<Instruction>(Op);
if (!OpInst)
continue;
@@ -2056,7 +2056,7 @@ JumpThreadingPass::cloneInstructions(BasicBlock::iterator BI,
}
for (auto &[OldOp, MappedOp] : OperandsToRemap)
- DPV->replaceVariableLocationOp(OldOp, MappedOp);
+ DVR->replaceVariableLocationOp(OldOp, MappedOp);
};
BasicBlock *RangeBB = BI->getParent();
@@ -2080,9 +2080,9 @@ JumpThreadingPass::cloneInstructions(BasicBlock::iterator BI,
cloneNoAliasScopes(NoAliasScopes, ClonedScopes, "thread", Context);
auto CloneAndRemapDbgInfo = [&](Instruction *NewInst, Instruction *From) {
- auto DPVRange = NewInst->cloneDebugInfoFrom(From);
- for (DPValue &DPV : filterDbgVars(DPVRange))
- RetargetDPValueIfPossible(&DPV);
+ auto DVRRange = NewInst->cloneDebugInfoFrom(From);
+ for (DbgVariableRecord &DVR : filterDbgVars(DVRRange))
+ RetargetDbgVariableRecordIfPossible(&DVR);
};
// Clone the non-phi instructions of the source basic block into NewBB,
@@ -2109,15 +2109,15 @@ 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.
+ // There may be DbgVariableRecords on the terminator, clone directly from
+ // marker to marker as there isn't an instruction there.
if (BE != RangeBB->end() && BE->hasDbgRecords()) {
// Dump them at the end.
DPMarker *Marker = RangeBB->getMarker(BE);
DPMarker *EndMarker = NewBB->createMarker(NewBB->end());
- auto DPVRange = EndMarker->cloneDebugInfoFrom(Marker, std::nullopt);
- for (DPValue &DPV : filterDbgVars(DPVRange))
- RetargetDPValueIfPossible(&DPV);
+ auto DVRRange = EndMarker->cloneDebugInfoFrom(Marker, std::nullopt);
+ for (DbgVariableRecord &DVR : filterDbgVars(DVRRange))
+ RetargetDbgVariableRecordIfPossible(&DVR);
}
return ValueMapping;
diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
index 7641ba2a219cc3..ec42e2d6e193a6 100644
--- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
+++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp
@@ -6367,10 +6367,10 @@ struct DVIRecoveryRec {
DVIRecoveryRec(DbgValueInst *DbgValue)
: DbgRef(DbgValue), Expr(DbgValue->getExpression()),
HadLocationArgList(false) {}
- DVIRecoveryRec(DPValue *DPV)
- : DbgRef(DPV), Expr(DPV->getExpression()), HadLocationArgList(false) {}
+ DVIRecoveryRec(DbgVariableRecord *DVR)
+ : DbgRef(DVR), Expr(DVR->getExpression()), HadLocationArgList(false) {}
- PointerUnion<DbgValueInst *, DPValue *> DbgRef;
+ PointerUnion<DbgValueInst *, DbgVariableRecord *> DbgRef;
DIExpression *Expr;
bool HadLocationArgList;
SmallVector<WeakVH, 2> LocationOps;
@@ -6466,7 +6466,7 @@ static void UpdateDbgValueInst(DVIRecoveryRec &DVIRec,
if (isa<DbgValueInst *>(DVIRec.DbgRef))
UpdateDbgValueInstImpl(cast<DbgValueInst *>(DVIRec.DbgRef));
else
- UpdateDbgValueInstImpl(cast<DPValue *>(DVIRec.DbgRef));
+ UpdateDbgValueInstImpl(cast<DbgVariableRecord *>(DVIRec.DbgRef));
}
/// Cached location ops may be erased during LSR, in which case a poison is
@@ -6512,7 +6512,7 @@ static void restorePreTransformState(DVIRecoveryRec &DVIRec) {
if (isa<DbgValueInst *>(DVIRec.DbgRef))
RestorePreTransformStateImpl(cast<DbgValueInst *>(DVIRec.DbgRef));
else
- RestorePreTransformStateImpl(cast<DPValue *>(DVIRec.DbgRef));
+ RestorePreTransformStateImpl(cast<DbgVariableRecord *>(DVIRec.DbgRef));
}
static bool SalvageDVI(llvm::Loop *L, ScalarEvolution &SE,
@@ -6522,7 +6522,7 @@ static bool SalvageDVI(llvm::Loop *L, ScalarEvolution &SE,
if (isa<DbgValueInst *>(DVIRec.DbgRef)
? !cast<DbgValueInst *>(DVIRec.DbgRef)->isKillLocation()
- : !cast<DPValue *>(DVIRec.DbgRef)->isKillLocation())
+ : !cast<DbgVariableRecord *>(DVIRec.DbgRef)->isKillLocation())
return false;
// LSR may have caused several changes to the dbg.value in the failed salvage
@@ -6620,7 +6620,7 @@ static bool SalvageDVI(llvm::Loop *L, ScalarEvolution &SE,
<< *cast<DbgValueInst *>(DVIRec.DbgRef) << "\n");
else
LLVM_DEBUG(dbgs() << "scev-salvage: Updated DVI: "
- << *cast<DPValue *>(DVIRec.DbgRef) << "\n");
+ << *cast<DbgVariableRecord *>(DVIRec.DbgRef) << "\n");
return true;
}
@@ -6711,9 +6711,9 @@ static void DbgGatherSalvagableDVI(
SalvageableDVISCEVs.push_back(std::move(NewRec));
return true;
};
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
- if (DPV.isDbgValue() || DPV.isDbgAssign())
- ProcessDbgValue(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (DVR.isDbgValue() || DVR.isDbgAssign())
+ ProcessDbgValue(&DVR);
}
auto DVI = dyn_cast<DbgValueInst>(&I);
if (!DVI)
diff --git a/llvm/lib/Transforms/Scalar/SROA.cpp b/llvm/lib/Transforms/Scalar/SROA.cpp
index e238f311a15bc2..096c6d1b1fad27 100644
--- a/llvm/lib/Transforms/Scalar/SROA.cpp
+++ b/llvm/lib/Transforms/Scalar/SROA.cpp
@@ -319,17 +319,17 @@ static DebugVariable getAggregateVariable(DbgVariableIntrinsic *DVI) {
return DebugVariable(DVI->getVariable(), std::nullopt,
DVI->getDebugLoc().getInlinedAt());
}
-static DebugVariable getAggregateVariable(DPValue *DPV) {
- return DebugVariable(DPV->getVariable(), std::nullopt,
- DPV->getDebugLoc().getInlinedAt());
+static DebugVariable getAggregateVariable(DbgVariableRecord *DVR) {
+ return DebugVariable(DVR->getVariable(), std::nullopt,
+ DVR->getDebugLoc().getInlinedAt());
}
/// Helpers for handling new and old debug info modes in migrateDebugInfo.
/// These overloads unwrap a DbgInstPtr {Instruction* | DbgRecord*} union based
/// on the \p Unused parameter type.
-DPValue *UnwrapDbgInstPtr(DbgInstPtr P, DPValue *Unused) {
+DbgVariableRecord *UnwrapDbgInstPtr(DbgInstPtr P, DbgVariableRecord *Unused) {
(void)Unused;
- return static_cast<DPValue *>(cast<DbgRecord *>(P));
+ return static_cast<DbgVariableRecord *>(cast<DbgRecord *>(P));
}
DbgAssignIntrinsic *UnwrapDbgInstPtr(DbgInstPtr P, DbgAssignIntrinsic *Unused) {
(void)Unused;
@@ -356,9 +356,9 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
Instruction *Inst, Value *Dest, Value *Value,
const DataLayout &DL) {
auto MarkerRange = at::getAssignmentMarkers(OldInst);
- auto DPVAssignMarkerRange = at::getDPVAssignmentMarkers(OldInst);
+ auto DVRAssignMarkerRange = at::getDVRAssignmentMarkers(OldInst);
// Nothing to do if OldInst has no linked dbg.assign intrinsics.
- if (MarkerRange.empty() && DPVAssignMarkerRange.empty())
+ if (MarkerRange.empty() && DVRAssignMarkerRange.empty())
return;
LLVM_DEBUG(dbgs() << " migrateDebugInfo\n");
@@ -379,9 +379,9 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
for (auto *DAI : at::getAssignmentMarkers(OldAlloca))
BaseFragments[getAggregateVariable(DAI)] =
DAI->getExpression()->getFragmentInfo();
- for (auto *DPV : at::getDPVAssignmentMarkers(OldAlloca))
- BaseFragments[getAggregateVariable(DPV)] =
- DPV->getExpression()->getFragmentInfo();
+ for (auto *DVR : at::getDVRAssignmentMarkers(OldAlloca))
+ BaseFragments[getAggregateVariable(DVR)] =
+ DVR->getExpression()->getFragmentInfo();
// The new inst needs a DIAssignID unique metadata tag (if OldInst has
// one). It shouldn't already have one: assert this assumption.
@@ -488,7 +488,7 @@ static void migrateDebugInfo(AllocaInst *OldAlloca, bool IsSplit,
};
for_each(MarkerRange, MigrateDbgAssign);
- for_each(DPVAssignMarkerRange, MigrateDbgAssign);
+ for_each(DVRAssignMarkerRange, MigrateDbgAssign);
}
namespace {
@@ -3195,7 +3195,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
// emit dbg.assign intrinsics for mem intrinsics storing through non-
// constant geps, or storing a variable number of bytes.
assert(at::getAssignmentMarkers(&II).empty() &&
- at::getDPVAssignmentMarkers(&II).empty() &&
+ at::getDVRAssignmentMarkers(&II).empty() &&
"AT: Unexpected link to non-const GEP");
deleteIfTriviallyDead(OldPtr);
return false;
@@ -3350,7 +3350,7 @@ class AllocaSliceRewriter : public InstVisitor<AllocaSliceRewriter, bool> {
DbgAssign->replaceVariableLocationOp(II.getDest(), AdjustedPtr);
};
for_each(at::getAssignmentMarkers(&II), UpdateAssignAddress);
- for_each(at::getDPVAssignmentMarkers(&II), UpdateAssignAddress);
+ for_each(at::getDVRAssignmentMarkers(&II), UpdateAssignAddress);
II.setDest(AdjustedPtr);
II.setDestAlignment(SliceAlign);
} else {
@@ -3939,7 +3939,7 @@ class AggLoadStoreRewriter : public InstVisitor<AggLoadStoreRewriter, bool> {
DL);
} else {
assert(at::getAssignmentMarkers(Store).empty() &&
- at::getDPVAssignmentMarkers(Store).empty() &&
+ at::getDVRAssignmentMarkers(Store).empty() &&
"AT: unexpected debug.assign linked to store through "
"unbounded GEP");
}
@@ -5034,14 +5034,14 @@ static void insertNewDbgInst(DIBuilder &DIB, DbgAssignIntrinsic *Orig,
LLVM_DEBUG(dbgs() << "Created new assign intrinsic: " << *NewAssign << "\n");
(void)NewAssign;
}
-static void insertNewDbgInst(DIBuilder &DIB, DPValue *Orig, AllocaInst *NewAddr,
- DIExpression *NewFragmentExpr,
+static void insertNewDbgInst(DIBuilder &DIB, DbgVariableRecord *Orig,
+ AllocaInst *NewAddr, DIExpression *NewFragmentExpr,
Instruction *BeforeInst) {
(void)DIB;
if (Orig->isDbgDeclare()) {
- DPValue *DPV = DPValue::createDPVDeclare(
+ DbgVariableRecord *DVR = DbgVariableRecord::createDVRDeclare(
NewAddr, Orig->getVariable(), NewFragmentExpr, Orig->getDebugLoc());
- BeforeInst->getParent()->insertDbgRecordBefore(DPV,
+ BeforeInst->getParent()->insertDbgRecordBefore(DVR,
BeforeInst->getIterator());
return;
}
@@ -5049,10 +5049,10 @@ static void insertNewDbgInst(DIBuilder &DIB, DPValue *Orig, AllocaInst *NewAddr,
NewAddr->setMetadata(LLVMContext::MD_DIAssignID,
DIAssignID::getDistinct(NewAddr->getContext()));
}
- DPValue *NewAssign = DPValue::createLinkedDPVAssign(
+ DbgVariableRecord *NewAssign = DbgVariableRecord::createLinkedDVRAssign(
NewAddr, Orig->getValue(), Orig->getVariable(), NewFragmentExpr, NewAddr,
Orig->getAddressExpression(), Orig->getDebugLoc());
- LLVM_DEBUG(dbgs() << "Created new DPVAssign: " << *NewAssign << "\n");
+ LLVM_DEBUG(dbgs() << "Created new DVRAssign: " << *NewAssign << "\n");
(void)NewAssign;
}
@@ -5220,7 +5220,7 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &AS) {
OldDII->eraseFromParent();
};
for_each(findDbgDeclares(Fragment.Alloca), RemoveOne);
- for_each(findDPVDeclares(Fragment.Alloca), RemoveOne);
+ for_each(findDVRDeclares(Fragment.Alloca), RemoveOne);
insertNewDbgInst(DIB, DbgVariable, Fragment.Alloca, FragmentExpr, &AI);
}
@@ -5229,9 +5229,9 @@ bool SROA::splitAlloca(AllocaInst &AI, AllocaSlices &AS) {
// Migrate debug information from the old alloca to the new alloca(s)
// and the individual partitions.
for_each(findDbgDeclares(&AI), MigrateOne);
- for_each(findDPVDeclares(&AI), MigrateOne);
+ for_each(findDVRDeclares(&AI), MigrateOne);
for_each(at::getAssignmentMarkers(&AI), MigrateOne);
- for_each(at::getDPVAssignmentMarkers(&AI), MigrateOne);
+ for_each(at::getDVRAssignmentMarkers(&AI), MigrateOne);
return Changed;
}
@@ -5355,7 +5355,7 @@ bool SROA::deleteDeadInstructions(
DeletedAllocas.insert(AI);
for (DbgDeclareInst *OldDII : findDbgDeclares(AI))
OldDII->eraseFromParent();
- for (DPValue *OldDII : findDPVDeclares(AI))
+ for (DbgVariableRecord *OldDII : findDVRDeclares(AI))
OldDII->eraseFromParent();
}
diff --git a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
index 9fcaf2a89e5639..64b850a6a5c2ff 100644
--- a/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
+++ b/llvm/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp
@@ -1260,8 +1260,9 @@ static BasicBlock *buildClonedLoopBlocks(
Module *M = ClonedPH->getParent()->getParent();
for (auto *ClonedBB : NewBlocks)
for (Instruction &I : *ClonedBB) {
- RemapDPValueRange(M, I.getDbgRecordRange(), VMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecordRange(M, I.getDbgRecordRange(), VMap,
+ RF_NoModuleLevelChanges |
+ RF_IgnoreMissingLocals);
RemapInstruction(&I, VMap,
RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
if (auto *II = dyn_cast<AssumeInst>(&I))
diff --git a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
index 44ea6e9ffefa2b..400b56894174db 100644
--- a/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
+++ b/llvm/lib/Transforms/Scalar/SpeculativeExecution.cpp
@@ -263,7 +263,8 @@ static InstructionCost ComputeSpeculationCost(const Instruction *I,
bool SpeculativeExecutionPass::considerHoistingFromTo(
BasicBlock &FromBlock, BasicBlock &ToBlock) {
SmallPtrSet<const Instruction *, 8> NotHoisted;
- SmallDenseMap<const Instruction *, SmallVector<DPValue *>> DPValuesToHoist;
+ SmallDenseMap<const Instruction *, SmallVector<DbgVariableRecord *>>
+ DbgVariableRecordsToHoist;
auto HasNoUnhoistedInstr = [&NotHoisted](auto Values) {
for (const Value *V : Values) {
if (const auto *I = dyn_cast_or_null<Instruction>(V))
@@ -291,11 +292,11 @@ bool SpeculativeExecutionPass::considerHoistingFromTo(
InstructionCost TotalSpeculationCost = 0;
unsigned NotHoistedInstCount = 0;
for (const auto &I : FromBlock) {
- // Make note of any DPValues that need hoisting. DPLabels
+ // Make note of any DbgVariableRecords that need hoisting. DPLabels
// get left behind just like llvm.dbg.labels.
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
- if (HasNoUnhoistedInstr(DPV.location_ops()))
- DPValuesToHoist[DPV.getInstruction()].push_back(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (HasNoUnhoistedInstr(DVR.location_ops()))
+ DbgVariableRecordsToHoist[DVR.getInstruction()].push_back(&DVR);
}
const InstructionCost Cost = ComputeSpeculationCost(&I, *TTI);
if (Cost.isValid() && isSafeToSpeculativelyExecute(&I) &&
@@ -314,13 +315,13 @@ bool SpeculativeExecutionPass::considerHoistingFromTo(
}
for (auto I = FromBlock.begin(); I != FromBlock.end();) {
- // If any DPValues attached to this instruction should be hoisted, hoist
- // them now - they will end up attached to either the next hoisted
+ // If any DbgVariableRecords attached to this instruction should be hoisted,
+ // hoist them now - they will end up attached to either the next hoisted
// instruction or the ToBlock terminator.
- if (DPValuesToHoist.contains(&*I)) {
- for (auto *DPV : DPValuesToHoist[&*I]) {
- DPV->removeFromParent();
- ToBlock.insertDbgRecordBefore(DPV,
+ if (DbgVariableRecordsToHoist.contains(&*I)) {
+ for (auto *DVR : DbgVariableRecordsToHoist[&*I]) {
+ DVR->removeFromParent();
+ ToBlock.insertDbgRecordBefore(DVR,
ToBlock.getTerminator()->getIterator());
}
}
diff --git a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
index e7ad18df106d8d..bf1de05a647dd2 100644
--- a/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
+++ b/llvm/lib/Transforms/Utils/BasicBlockUtils.cpp
@@ -382,8 +382,9 @@ bool llvm::MergeBlockSuccessorsIntoGivenBlocks(
/// - Check fully overlapping fragments and not only identical fragments.
/// - Support dbg.declare. dbg.label, and possibly other meta instructions being
/// part of the sequence of consecutive instructions.
-static bool DPValuesRemoveRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
- SmallVector<DPValue *, 8> ToBeRemoved;
+static bool
+DbgVariableRecordsRemoveRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
+ SmallVector<DbgVariableRecord *, 8> ToBeRemoved;
SmallDenseSet<DebugVariable> VariableSet;
for (auto &I : reverse(*BB)) {
for (DbgRecord &DR : reverse(I.getDbgRecordRange())) {
@@ -394,10 +395,10 @@ static bool DPValuesRemoveRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
continue;
}
- DPValue &DPV = cast<DPValue>(DR);
+ DbgVariableRecord &DVR = cast<DbgVariableRecord>(DR);
// Skip declare-type records, as the debug intrinsic method only works
// on dbg.value intrinsics.
- if (DPV.getType() == DPValue::LocationType::Declare) {
+ if (DVR.getType() == DbgVariableRecord::LocationType::Declare) {
// The debug intrinsic method treats dbg.declares are "non-debug"
// instructions (i.e., a break in a consecutive range of debug
// intrinsics). Emulate that to create identical outputs. See
@@ -407,8 +408,8 @@ static bool DPValuesRemoveRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
continue;
}
- DebugVariable Key(DPV.getVariable(), DPV.getExpression(),
- DPV.getDebugLoc()->getInlinedAt());
+ DebugVariable Key(DVR.getVariable(), DVR.getExpression(),
+ DVR.getDebugLoc()->getInlinedAt());
auto R = VariableSet.insert(Key);
// If the same variable fragment is described more than once it is enough
// to keep the last one (i.e. the first found since we for reverse
@@ -416,14 +417,14 @@ static bool DPValuesRemoveRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
if (R.second)
continue;
- if (DPV.isDbgAssign()) {
+ if (DVR.isDbgAssign()) {
// Don't delete dbg.assign intrinsics that are linked to instructions.
- if (!at::getAssignmentInsts(&DPV).empty())
+ if (!at::getAssignmentInsts(&DVR).empty())
continue;
// Unlinked dbg.assign intrinsics can be treated like dbg.values.
}
- ToBeRemoved.push_back(&DPV);
+ ToBeRemoved.push_back(&DVR);
continue;
}
// Sequence with consecutive dbg.value instrs ended. Clear the map to
@@ -432,15 +433,15 @@ static bool DPValuesRemoveRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
VariableSet.clear();
}
- for (auto &DPV : ToBeRemoved)
- DPV->eraseFromParent();
+ for (auto &DVR : ToBeRemoved)
+ DVR->eraseFromParent();
return !ToBeRemoved.empty();
}
static bool removeRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
if (BB->IsNewDbgInfoFormat)
- return DPValuesRemoveRedundantDbgInstrsUsingBackwardScan(BB);
+ return DbgVariableRecordsRemoveRedundantDbgInstrsUsingBackwardScan(BB);
SmallVector<DbgValueInst *, 8> ToBeRemoved;
SmallDenseSet<DebugVariable> VariableSet;
@@ -499,29 +500,30 @@ static bool removeRedundantDbgInstrsUsingBackwardScan(BasicBlock *BB) {
///
/// Possible improvements:
/// - Keep track of non-overlapping fragments.
-static bool DPValuesRemoveRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) {
- SmallVector<DPValue *, 8> ToBeRemoved;
+static bool
+DbgVariableRecordsRemoveRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) {
+ SmallVector<DbgVariableRecord *, 8> ToBeRemoved;
DenseMap<DebugVariable, std::pair<SmallVector<Value *, 4>, DIExpression *>>
VariableMap;
for (auto &I : *BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
- if (DPV.getType() == DPValue::LocationType::Declare)
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (DVR.getType() == DbgVariableRecord::LocationType::Declare)
continue;
- DebugVariable Key(DPV.getVariable(), std::nullopt,
- DPV.getDebugLoc()->getInlinedAt());
+ DebugVariable Key(DVR.getVariable(), std::nullopt,
+ DVR.getDebugLoc()->getInlinedAt());
auto VMI = VariableMap.find(Key);
// A dbg.assign with no linked instructions can be treated like a
// dbg.value (i.e. can be deleted).
bool IsDbgValueKind =
- (!DPV.isDbgAssign() || at::getAssignmentInsts(&DPV).empty());
+ (!DVR.isDbgAssign() || at::getAssignmentInsts(&DVR).empty());
// Update the map if we found a new value/expression describing the
// variable, or if the variable wasn't mapped already.
- SmallVector<Value *, 4> Values(DPV.location_ops());
+ SmallVector<Value *, 4> Values(DVR.location_ops());
if (VMI == VariableMap.end() || VMI->second.first != Values ||
- VMI->second.second != DPV.getExpression()) {
+ VMI->second.second != DVR.getExpression()) {
if (IsDbgValueKind)
- VariableMap[Key] = {Values, DPV.getExpression()};
+ VariableMap[Key] = {Values, DVR.getExpression()};
else
VariableMap[Key] = {Values, nullptr};
continue;
@@ -530,55 +532,56 @@ static bool DPValuesRemoveRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) {
if (!IsDbgValueKind)
continue;
// Found an identical mapping. Remember the instruction for later removal.
- ToBeRemoved.push_back(&DPV);
+ ToBeRemoved.push_back(&DVR);
}
}
- for (auto *DPV : ToBeRemoved)
- DPV->eraseFromParent();
+ for (auto *DVR : ToBeRemoved)
+ DVR->eraseFromParent();
return !ToBeRemoved.empty();
}
-static bool DPValuesRemoveUndefDbgAssignsFromEntryBlock(BasicBlock *BB) {
+static bool
+DbgVariableRecordsRemoveUndefDbgAssignsFromEntryBlock(BasicBlock *BB) {
assert(BB->isEntryBlock() && "expected entry block");
- SmallVector<DPValue *, 8> ToBeRemoved;
+ SmallVector<DbgVariableRecord *, 8> ToBeRemoved;
DenseSet<DebugVariable> SeenDefForAggregate;
// Returns the DebugVariable for DVI with no fragment info.
- auto GetAggregateVariable = [](const DPValue &DPV) {
- return DebugVariable(DPV.getVariable(), std::nullopt,
- DPV.getDebugLoc().getInlinedAt());
+ auto GetAggregateVariable = [](const DbgVariableRecord &DVR) {
+ return DebugVariable(DVR.getVariable(), std::nullopt,
+ DVR.getDebugLoc().getInlinedAt());
};
// Remove undef dbg.assign intrinsics that are encountered before
// any non-undef intrinsics from the entry block.
for (auto &I : *BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
- if (!DPV.isDbgValue() && !DPV.isDbgAssign())
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (!DVR.isDbgValue() && !DVR.isDbgAssign())
continue;
bool IsDbgValueKind =
- (DPV.isDbgValue() || at::getAssignmentInsts(&DPV).empty());
- DebugVariable Aggregate = GetAggregateVariable(DPV);
+ (DVR.isDbgValue() || at::getAssignmentInsts(&DVR).empty());
+ DebugVariable Aggregate = GetAggregateVariable(DVR);
if (!SeenDefForAggregate.contains(Aggregate)) {
- bool IsKill = DPV.isKillLocation() && IsDbgValueKind;
+ bool IsKill = DVR.isKillLocation() && IsDbgValueKind;
if (!IsKill) {
SeenDefForAggregate.insert(Aggregate);
- } else if (DPV.isDbgAssign()) {
- ToBeRemoved.push_back(&DPV);
+ } else if (DVR.isDbgAssign()) {
+ ToBeRemoved.push_back(&DVR);
}
}
}
}
- for (DPValue *DPV : ToBeRemoved)
- DPV->eraseFromParent();
+ for (DbgVariableRecord *DVR : ToBeRemoved)
+ DVR->eraseFromParent();
return !ToBeRemoved.empty();
}
static bool removeRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) {
if (BB->IsNewDbgInfoFormat)
- return DPValuesRemoveRedundantDbgInstrsUsingForwardScan(BB);
+ return DbgVariableRecordsRemoveRedundantDbgInstrsUsingForwardScan(BB);
SmallVector<DbgValueInst *, 8> ToBeRemoved;
DenseMap<DebugVariable, std::pair<SmallVector<Value *, 4>, DIExpression *>>
@@ -642,7 +645,7 @@ static bool removeRedundantDbgInstrsUsingForwardScan(BasicBlock *BB) {
/// - Keep track of non-overlapping fragments.
static bool removeUndefDbgAssignsFromEntryBlock(BasicBlock *BB) {
if (BB->IsNewDbgInfoFormat)
- return DPValuesRemoveUndefDbgAssignsFromEntryBlock(BB);
+ return DbgVariableRecordsRemoveUndefDbgAssignsFromEntryBlock(BB);
assert(BB->isEntryBlock() && "expected entry block");
SmallVector<DbgAssignIntrinsic *, 8> ToBeRemoved;
diff --git a/llvm/lib/Transforms/Utils/CloneFunction.cpp b/llvm/lib/Transforms/Utils/CloneFunction.cpp
index 6931d1997aa6b2..3eac726994ae13 100644
--- a/llvm/lib/Transforms/Utils/CloneFunction.cpp
+++ b/llvm/lib/Transforms/Utils/CloneFunction.cpp
@@ -276,8 +276,8 @@ 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.getDbgRecordRange(), VMap, RemapFlag,
- TypeMapper, Materializer);
+ RemapDbgVariableRecordRange(II.getModule(), II.getDbgRecordRange(), VMap,
+ RemapFlag, TypeMapper, Materializer);
}
// Only update !llvm.dbg.cu for DifferentModule (not CloneModule). In the
@@ -641,8 +641,8 @@ void PruningFunctionCloner::CloneBlock(
// Recursively clone any reachable successor blocks.
append_range(ToClone, successors(BB->getTerminator()));
} else {
- // If we didn't create a new terminator, clone DPValues from the old
- // terminator onto the new terminator.
+ // If we didn't create a new terminator, clone DbgVariableRecords from the
+ // old terminator onto the new terminator.
Instruction *NewInst = NewBB->getTerminator();
assert(NewInst);
@@ -884,14 +884,15 @@ void llvm::CloneAndPruneIntoFromInst(Function *NewFunc, const Function *OldFunc,
TypeMapper, Materializer);
}
- // Do the same for DPValues, touching all the instructions in the cloned
- // range of blocks.
+ // Do the same for DbgVariableRecords, touching all the instructions in the
+ // cloned range of blocks.
Function::iterator Begin = cast<BasicBlock>(VMap[StartingBB])->getIterator();
for (BasicBlock &BB : make_range(Begin, NewFunc->end())) {
for (Instruction &I : BB) {
- RemapDPValueRange(I.getModule(), I.getDbgRecordRange(), VMap,
- ModuleLevelChanges ? RF_None : RF_NoModuleLevelChanges,
- TypeMapper, Materializer);
+ RemapDbgVariableRecordRange(I.getModule(), I.getDbgRecordRange(), VMap,
+ ModuleLevelChanges ? RF_None
+ : RF_NoModuleLevelChanges,
+ TypeMapper, Materializer);
}
}
@@ -990,8 +991,9 @@ 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.getDbgRecordRange(), VMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecordRange(
+ 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 0fac5fc02e3f02..b4659217d51faf 100644
--- a/llvm/lib/Transforms/Utils/CodeExtractor.cpp
+++ b/llvm/lib/Transforms/Utils/CodeExtractor.cpp
@@ -1508,14 +1508,14 @@ void CodeExtractor::calculateNewCallTerminatorWeights(
static void eraseDebugIntrinsicsWithNonLocalRefs(Function &F) {
for (Instruction &I : instructions(F)) {
SmallVector<DbgVariableIntrinsic *, 4> DbgUsers;
- SmallVector<DPValue *, 4> DPValues;
- findDbgUsers(DbgUsers, &I, &DPValues);
+ SmallVector<DbgVariableRecord *, 4> DbgVariableRecords;
+ findDbgUsers(DbgUsers, &I, &DbgVariableRecords);
for (DbgVariableIntrinsic *DVI : DbgUsers)
if (DVI->getFunction() != &F)
DVI->eraseFromParent();
- for (DPValue *DPV : DPValues)
- if (DPV->getFunction() != &F)
- DPV->eraseFromParent();
+ for (DbgVariableRecord *DVR : DbgVariableRecords)
+ if (DVR->getFunction() != &F)
+ DVR->eraseFromParent();
}
}
@@ -1569,7 +1569,7 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
// point to a variable in the wrong scope.
SmallDenseMap<DINode *, DINode *> RemappedMetadata;
SmallVector<Instruction *, 4> DebugIntrinsicsToDelete;
- SmallVector<DPValue *, 4> DPVsToDelete;
+ SmallVector<DbgVariableRecord *, 4> DVRsToDelete;
DenseMap<const MDNode *, MDNode *> Cache;
auto GetUpdatedDIVariable = [&](DILocalVariable *OldVar) {
@@ -1608,19 +1608,19 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
continue;
}
- DPValue &DPV = cast<DPValue>(DR);
+ DbgVariableRecord &DVR = cast<DbgVariableRecord>(DR);
// Apply the two updates that dbg.values get: invalid operands, and
// variable metadata fixup.
- if (any_of(DPV.location_ops(), IsInvalidLocation)) {
- DPVsToDelete.push_back(&DPV);
+ if (any_of(DVR.location_ops(), IsInvalidLocation)) {
+ DVRsToDelete.push_back(&DVR);
continue;
}
- if (DPV.isDbgAssign() && IsInvalidLocation(DPV.getAddress())) {
- DPVsToDelete.push_back(&DPV);
+ if (DVR.isDbgAssign() && IsInvalidLocation(DVR.getAddress())) {
+ DVRsToDelete.push_back(&DVR);
continue;
}
- if (!DPV.getDebugLoc().getInlinedAt())
- DPV.setVariable(GetUpdatedDIVariable(DPV.getVariable()));
+ if (!DVR.getDebugLoc().getInlinedAt())
+ DVR.setVariable(GetUpdatedDIVariable(DVR.getVariable()));
}
};
@@ -1658,8 +1658,8 @@ static void fixupDebugInfoPostExtraction(Function &OldFunc, Function &NewFunc,
for (auto *DII : DebugIntrinsicsToDelete)
DII->eraseFromParent();
- for (auto *DPV : DPVsToDelete)
- DPV->getMarker()->MarkedInstr->dropOneDbgRecord(DPV);
+ for (auto *DVR : DVRsToDelete)
+ DVR->getMarker()->MarkedInstr->dropOneDbgRecord(DVR);
DIB.finalizeSubprogram(NewSP);
// Fix up the scope information attached to the line locations in the new
diff --git a/llvm/lib/Transforms/Utils/InlineFunction.cpp b/llvm/lib/Transforms/Utils/InlineFunction.cpp
index 33d32720a33317..833dcbec228b88 100644
--- a/llvm/lib/Transforms/Utils/InlineFunction.cpp
+++ b/llvm/lib/Transforms/Utils/InlineFunction.cpp
@@ -1710,17 +1710,17 @@ static void fixupLineNumbers(Function *Fn, Function::iterator FI,
};
// Helper-util for updating debug-info records attached to instructions.
- auto UpdateDPV = [&](DbgRecord *DPV) {
- assert(DPV->getDebugLoc() && "Debug Value must have debug loc");
+ auto UpdateDVR = [&](DbgRecord *DVR) {
+ assert(DVR->getDebugLoc() && "Debug Value must have debug loc");
if (NoInlineLineTables) {
- DPV->setDebugLoc(TheCallDL);
+ DVR->setDebugLoc(TheCallDL);
return;
}
- DebugLoc DL = DPV->getDebugLoc();
+ DebugLoc DL = DVR->getDebugLoc();
DebugLoc IDL =
inlineDebugLoc(DL, InlinedAtNode,
- DPV->getMarker()->getParent()->getContext(), IANodes);
- DPV->setDebugLoc(IDL);
+ DVR->getMarker()->getParent()->getContext(), IANodes);
+ DVR->setDebugLoc(IDL);
};
// Iterate over all instructions, updating metadata and debug-info records.
@@ -1728,8 +1728,8 @@ 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->getDbgRecordRange()) {
- UpdateDPV(&DPV);
+ for (DbgRecord &DVR : BI->getDbgRecordRange()) {
+ UpdateDVR(&DVR);
}
}
@@ -1797,7 +1797,7 @@ static at::StorageToVarsMap collectEscapedLocals(const DataLayout &DL,
EscapedLocals[Base].insert(at::VarRecord(DbgAssign));
};
for_each(at::getAssignmentMarkers(Base), CollectAssignsForStorage);
- for_each(at::getDPVAssignmentMarkers(Base), CollectAssignsForStorage);
+ for_each(at::getDVRAssignmentMarkers(Base), CollectAssignsForStorage);
}
return EscapedLocals;
}
@@ -1829,9 +1829,9 @@ 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 : filterDbgVars(I.getDbgRecordRange())) {
- if (DPV.isDbgAssign())
- DPV.setAssignId(GetNewID(DPV.getAssignID()));
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ if (DVR.isDbgAssign())
+ DVR.setAssignId(GetNewID(DVR.getAssignID()));
}
if (auto *ID = I.getMetadata(LLVMContext::MD_DIAssignID))
I.setMetadata(LLVMContext::MD_DIAssignID, GetNewID(ID));
diff --git a/llvm/lib/Transforms/Utils/LCSSA.cpp b/llvm/lib/Transforms/Utils/LCSSA.cpp
index 5e0c312fe149e7..ab1edf47d8db0a 100644
--- a/llvm/lib/Transforms/Utils/LCSSA.cpp
+++ b/llvm/lib/Transforms/Utils/LCSSA.cpp
@@ -242,8 +242,8 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
}
SmallVector<DbgValueInst *, 4> DbgValues;
- SmallVector<DPValue *, 4> DPValues;
- llvm::findDbgValues(DbgValues, I, &DPValues);
+ SmallVector<DbgVariableRecord *, 4> DbgVariableRecords;
+ llvm::findDbgValues(DbgValues, I, &DbgVariableRecords);
// Update pre-existing debug value uses that reside outside the loop.
for (auto *DVI : DbgValues) {
@@ -261,8 +261,8 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
// RemoveDIs: copy-paste of block above, using non-instruction debug-info
// records.
- for (DPValue *DPV : DPValues) {
- BasicBlock *UserBB = DPV->getMarker()->getParent();
+ for (DbgVariableRecord *DVR : DbgVariableRecords) {
+ BasicBlock *UserBB = DVR->getMarker()->getParent();
if (InstBB == UserBB || L->contains(UserBB))
continue;
// We currently only handle debug values residing in blocks that were
@@ -271,7 +271,7 @@ bool llvm::formLCSSAForInstructions(SmallVectorImpl<Instruction *> &Worklist,
Value *V = AddedPHIs.size() == 1 ? AddedPHIs[0]
: SSAUpdate.FindValueForBlock(UserBB);
if (V)
- DPV->replaceVariableLocationOp(I, V);
+ DVR->replaceVariableLocationOp(I, V);
}
// SSAUpdater might have inserted phi-nodes inside other loops. We'll need
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 422319eb185134..05ddcf84d310ae 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -609,12 +609,12 @@ void llvm::RecursivelyDeleteTriviallyDeadInstructions(
bool llvm::replaceDbgUsesWithUndef(Instruction *I) {
SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
- SmallVector<DPValue *, 1> DPUsers;
+ SmallVector<DbgVariableRecord *, 1> DPUsers;
findDbgUsers(DbgUsers, I, &DPUsers);
for (auto *DII : DbgUsers)
DII->setKillLocation();
- for (auto *DPV : DPUsers)
- DPV->setKillLocation();
+ for (auto *DVR : DPUsers)
+ DVR->setKillLocation();
return !DbgUsers.empty() || !DPUsers.empty();
}
@@ -1570,16 +1570,16 @@ static bool PhiHasDebugValue(DILocalVariable *DIVar,
// is removed by LowerDbgDeclare(), we need to make sure that we are
// not inserting the same dbg.value intrinsic over and over.
SmallVector<DbgValueInst *, 1> DbgValues;
- SmallVector<DPValue *, 1> DPValues;
- findDbgValues(DbgValues, APN, &DPValues);
+ SmallVector<DbgVariableRecord *, 1> DbgVariableRecords;
+ findDbgValues(DbgValues, APN, &DbgVariableRecords);
for (auto *DVI : DbgValues) {
assert(is_contained(DVI->getValues(), APN));
if ((DVI->getVariable() == DIVar) && (DVI->getExpression() == DIExpr))
return true;
}
- for (auto *DPV : DPValues) {
- assert(is_contained(DPV->location_ops(), APN));
- if ((DPV->getVariable() == DIVar) && (DPV->getExpression() == DIExpr))
+ for (auto *DVR : DbgVariableRecords) {
+ assert(is_contained(DVR->location_ops(), APN));
+ if ((DVR->getVariable() == DIVar) && (DVR->getExpression() == DIExpr))
return true;
}
return false;
@@ -1617,23 +1617,23 @@ static bool valueCoversEntireFragment(Type *ValTy, DbgVariableIntrinsic *DII) {
// Could not determine size of variable. Conservatively return false.
return false;
}
-// RemoveDIs: duplicate implementation of the above, using DPValues, the
-// replacement for dbg.values.
-static bool valueCoversEntireFragment(Type *ValTy, DPValue *DPV) {
- const DataLayout &DL = DPV->getModule()->getDataLayout();
+// RemoveDIs: duplicate implementation of the above, using DbgVariableRecords,
+// the replacement for dbg.values.
+static bool valueCoversEntireFragment(Type *ValTy, DbgVariableRecord *DVR) {
+ const DataLayout &DL = DVR->getModule()->getDataLayout();
TypeSize ValueSize = DL.getTypeAllocSizeInBits(ValTy);
- if (std::optional<uint64_t> FragmentSize = DPV->getFragmentSizeInBits())
+ if (std::optional<uint64_t> FragmentSize = DVR->getFragmentSizeInBits())
return TypeSize::isKnownGE(ValueSize, TypeSize::getFixed(*FragmentSize));
// We can't always calculate the size of the DI variable (e.g. if it is a
// VLA). Try to use the size of the alloca that the dbg intrinsic describes
// intead.
- if (DPV->isAddressOfVariable()) {
- // DPV should have exactly 1 location when it is an address.
- assert(DPV->getNumVariableLocationOps() == 1 &&
+ if (DVR->isAddressOfVariable()) {
+ // DVR should have exactly 1 location when it is an address.
+ assert(DVR->getNumVariableLocationOps() == 1 &&
"address of variable must have exactly 1 location operand.");
if (auto *AI =
- dyn_cast_or_null<AllocaInst>(DPV->getVariableLocationOp(0))) {
+ dyn_cast_or_null<AllocaInst>(DVR->getVariableLocationOp(0))) {
if (std::optional<TypeSize> FragmentSize = AI->getAllocationSizeInBits(DL)) {
return TypeSize::isKnownGE(ValueSize, *FragmentSize);
}
@@ -1643,38 +1643,38 @@ static bool valueCoversEntireFragment(Type *ValTy, DPValue *DPV) {
return false;
}
-static void insertDbgValueOrDPValue(DIBuilder &Builder, Value *DV,
- DILocalVariable *DIVar,
- DIExpression *DIExpr,
- const DebugLoc &NewLoc,
- BasicBlock::iterator Instr) {
+static void insertDbgValueOrDbgVariableRecord(DIBuilder &Builder, Value *DV,
+ DILocalVariable *DIVar,
+ DIExpression *DIExpr,
+ const DebugLoc &NewLoc,
+ BasicBlock::iterator Instr) {
if (!UseNewDbgInfoFormat) {
auto DbgVal = Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, NewLoc,
(Instruction *)nullptr);
DbgVal.get<Instruction *>()->insertBefore(Instr);
} else {
// RemoveDIs: if we're using the new debug-info format, allocate a
- // DPValue directly instead of a dbg.value intrinsic.
+ // DbgVariableRecord directly instead of a dbg.value intrinsic.
ValueAsMetadata *DVAM = ValueAsMetadata::get(DV);
- DPValue *DV = new DPValue(DVAM, DIVar, DIExpr, NewLoc.get());
+ DbgVariableRecord *DV =
+ new DbgVariableRecord(DVAM, DIVar, DIExpr, NewLoc.get());
Instr->getParent()->insertDbgRecordBefore(DV, Instr);
}
}
-static void insertDbgValueOrDPValueAfter(DIBuilder &Builder, Value *DV,
- DILocalVariable *DIVar,
- DIExpression *DIExpr,
- const DebugLoc &NewLoc,
- BasicBlock::iterator Instr) {
+static void insertDbgValueOrDbgVariableRecordAfter(
+ DIBuilder &Builder, Value *DV, DILocalVariable *DIVar, DIExpression *DIExpr,
+ const DebugLoc &NewLoc, BasicBlock::iterator Instr) {
if (!UseNewDbgInfoFormat) {
auto DbgVal = Builder.insertDbgValueIntrinsic(DV, DIVar, DIExpr, NewLoc,
(Instruction *)nullptr);
DbgVal.get<Instruction *>()->insertAfter(&*Instr);
} else {
// RemoveDIs: if we're using the new debug-info format, allocate a
- // DPValue directly instead of a dbg.value intrinsic.
+ // DbgVariableRecord directly instead of a dbg.value intrinsic.
ValueAsMetadata *DVAM = ValueAsMetadata::get(DV);
- DPValue *DV = new DPValue(DVAM, DIVar, DIExpr, NewLoc.get());
+ DbgVariableRecord *DV =
+ new DbgVariableRecord(DVAM, DIVar, DIExpr, NewLoc.get());
Instr->getParent()->insertDbgRecordAfter(DV, &*Instr);
}
}
@@ -1707,8 +1707,8 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII,
DIExpr->isDeref() || (!DIExpr->startsWithDeref() &&
valueCoversEntireFragment(DV->getType(), DII));
if (CanConvert) {
- insertDbgValueOrDPValue(Builder, DV, DIVar, DIExpr, NewLoc,
- SI->getIterator());
+ insertDbgValueOrDbgVariableRecord(Builder, DV, DIVar, DIExpr, NewLoc,
+ SI->getIterator());
return;
}
@@ -1720,8 +1720,8 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII,
// know which part) we insert an dbg.value intrinsic to indicate that we
// know nothing about the variable's content.
DV = UndefValue::get(DV->getType());
- insertDbgValueOrDPValue(Builder, DV, DIVar, DIExpr, NewLoc,
- SI->getIterator());
+ insertDbgValueOrDbgVariableRecord(Builder, DV, DIVar, DIExpr, NewLoc,
+ SI->getIterator());
}
/// Inserts a llvm.dbg.value intrinsic before a load of an alloca'd value
@@ -1747,19 +1747,19 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII,
// future if multi-location support is added to the IR, it might be
// preferable to keep tracking both the loaded value and the original
// address in case the alloca can not be elided.
- insertDbgValueOrDPValueAfter(Builder, LI, DIVar, DIExpr, NewLoc,
- LI->getIterator());
+ insertDbgValueOrDbgVariableRecordAfter(Builder, LI, DIVar, DIExpr, NewLoc,
+ LI->getIterator());
}
-void llvm::ConvertDebugDeclareToDebugValue(DPValue *DPV, StoreInst *SI,
- DIBuilder &Builder) {
- assert(DPV->isAddressOfVariable() || DPV->isDbgAssign());
- auto *DIVar = DPV->getVariable();
+void llvm::ConvertDebugDeclareToDebugValue(DbgVariableRecord *DVR,
+ StoreInst *SI, DIBuilder &Builder) {
+ assert(DVR->isAddressOfVariable() || DVR->isDbgAssign());
+ auto *DIVar = DVR->getVariable();
assert(DIVar && "Missing variable");
- auto *DIExpr = DPV->getExpression();
+ auto *DIExpr = DVR->getExpression();
Value *DV = SI->getValueOperand();
- DebugLoc NewLoc = getDebugValueLoc(DPV);
+ DebugLoc NewLoc = getDebugValueLoc(DVR);
// If the alloca describes the variable itself, i.e. the expression in the
// dbg.declare doesn't start with a dereference, we can perform the
@@ -1775,16 +1775,16 @@ void llvm::ConvertDebugDeclareToDebugValue(DPValue *DPV, StoreInst *SI,
// deref expression.
bool CanConvert =
DIExpr->isDeref() || (!DIExpr->startsWithDeref() &&
- valueCoversEntireFragment(DV->getType(), DPV));
+ valueCoversEntireFragment(DV->getType(), DVR));
if (CanConvert) {
- insertDbgValueOrDPValue(Builder, DV, DIVar, DIExpr, NewLoc,
- SI->getIterator());
+ insertDbgValueOrDbgVariableRecord(Builder, DV, DIVar, DIExpr, NewLoc,
+ SI->getIterator());
return;
}
// FIXME: If storing to a part of the variable described by the dbg.declare,
// then we want to insert a dbg.value for the corresponding fragment.
- LLVM_DEBUG(dbgs() << "Failed to convert dbg.declare to dbg.value: " << *DPV
+ LLVM_DEBUG(dbgs() << "Failed to convert dbg.declare to dbg.value: " << *DVR
<< '\n');
assert(UseNewDbgInfoFormat);
@@ -1793,8 +1793,9 @@ void llvm::ConvertDebugDeclareToDebugValue(DPValue *DPV, StoreInst *SI,
// know nothing about the variable's content.
DV = UndefValue::get(DV->getType());
ValueAsMetadata *DVAM = ValueAsMetadata::get(DV);
- DPValue *NewDPV = new DPValue(DVAM, DIVar, DIExpr, NewLoc.get());
- SI->getParent()->insertDbgRecordBefore(NewDPV, SI->getIterator());
+ DbgVariableRecord *NewDVR =
+ new DbgVariableRecord(DVAM, DIVar, DIExpr, NewLoc.get());
+ SI->getParent()->insertDbgRecordBefore(NewDVR, SI->getIterator());
}
/// Inserts a llvm.dbg.value intrinsic after a phi that has an associated
@@ -1826,26 +1827,27 @@ void llvm::ConvertDebugDeclareToDebugValue(DbgVariableIntrinsic *DII,
// insertion point.
// FIXME: Insert dbg.value markers in the successors when appropriate.
if (InsertionPt != BB->end()) {
- insertDbgValueOrDPValue(Builder, APN, DIVar, DIExpr, NewLoc, InsertionPt);
+ insertDbgValueOrDbgVariableRecord(Builder, APN, DIVar, DIExpr, NewLoc,
+ InsertionPt);
}
}
-void llvm::ConvertDebugDeclareToDebugValue(DPValue *DPV, LoadInst *LI,
+void llvm::ConvertDebugDeclareToDebugValue(DbgVariableRecord *DVR, LoadInst *LI,
DIBuilder &Builder) {
- auto *DIVar = DPV->getVariable();
- auto *DIExpr = DPV->getExpression();
+ auto *DIVar = DVR->getVariable();
+ auto *DIExpr = DVR->getExpression();
assert(DIVar && "Missing variable");
- if (!valueCoversEntireFragment(LI->getType(), DPV)) {
+ if (!valueCoversEntireFragment(LI->getType(), DVR)) {
// FIXME: If only referring to a part of the variable described by the
- // dbg.declare, then we want to insert a DPValue for the corresponding
- // fragment.
- LLVM_DEBUG(dbgs() << "Failed to convert dbg.declare to DPValue: " << *DPV
- << '\n');
+ // dbg.declare, then we want to insert a DbgVariableRecord for the
+ // corresponding fragment.
+ LLVM_DEBUG(dbgs() << "Failed to convert dbg.declare to DbgVariableRecord: "
+ << *DVR << '\n');
return;
}
- DebugLoc NewLoc = getDebugValueLoc(DPV);
+ DebugLoc NewLoc = getDebugValueLoc(DVR);
// We are now tracking the loaded value instead of the address. In the
// future if multi-location support is added to the IR, it might be
@@ -1853,9 +1855,10 @@ void llvm::ConvertDebugDeclareToDebugValue(DPValue *DPV, LoadInst *LI,
// address in case the alloca can not be elided.
assert(UseNewDbgInfoFormat);
- // Create a DPValue directly and insert.
+ // Create a DbgVariableRecord directly and insert.
ValueAsMetadata *LIVAM = ValueAsMetadata::get(LI);
- DPValue *DV = new DPValue(LIVAM, DIVar, DIExpr, NewLoc.get());
+ DbgVariableRecord *DV =
+ new DbgVariableRecord(LIVAM, DIVar, DIExpr, NewLoc.get());
LI->getParent()->insertDbgRecordAfter(DV, LI);
}
@@ -1869,34 +1872,35 @@ static bool isArray(AllocaInst *AI) {
static bool isStructure(AllocaInst *AI) {
return AI->getAllocatedType() && AI->getAllocatedType()->isStructTy();
}
-void llvm::ConvertDebugDeclareToDebugValue(DPValue *DPV, PHINode *APN,
+void llvm::ConvertDebugDeclareToDebugValue(DbgVariableRecord *DVR, PHINode *APN,
DIBuilder &Builder) {
- auto *DIVar = DPV->getVariable();
- auto *DIExpr = DPV->getExpression();
+ auto *DIVar = DVR->getVariable();
+ auto *DIExpr = DVR->getExpression();
assert(DIVar && "Missing variable");
if (PhiHasDebugValue(DIVar, DIExpr, APN))
return;
- if (!valueCoversEntireFragment(APN->getType(), DPV)) {
+ if (!valueCoversEntireFragment(APN->getType(), DVR)) {
// FIXME: If only referring to a part of the variable described by the
- // dbg.declare, then we want to insert a DPValue for the corresponding
- // fragment.
- LLVM_DEBUG(dbgs() << "Failed to convert dbg.declare to DPValue: " << *DPV
- << '\n');
+ // dbg.declare, then we want to insert a DbgVariableRecord for the
+ // corresponding fragment.
+ LLVM_DEBUG(dbgs() << "Failed to convert dbg.declare to DbgVariableRecord: "
+ << *DVR << '\n');
return;
}
BasicBlock *BB = APN->getParent();
auto InsertionPt = BB->getFirstInsertionPt();
- DebugLoc NewLoc = getDebugValueLoc(DPV);
+ DebugLoc NewLoc = getDebugValueLoc(DVR);
// The block may be a catchswitch block, which does not have a valid
// insertion point.
- // FIXME: Insert DPValue markers in the successors when appropriate.
+ // FIXME: Insert DbgVariableRecord markers in the successors when appropriate.
if (InsertionPt != BB->end()) {
- insertDbgValueOrDPValue(Builder, APN, DIVar, DIExpr, NewLoc, InsertionPt);
+ insertDbgValueOrDbgVariableRecord(Builder, APN, DIVar, DIExpr, NewLoc,
+ InsertionPt);
}
}
@@ -1906,19 +1910,19 @@ bool llvm::LowerDbgDeclare(Function &F) {
bool Changed = false;
DIBuilder DIB(*F.getParent(), /*AllowUnresolved*/ false);
SmallVector<DbgDeclareInst *, 4> Dbgs;
- SmallVector<DPValue *> DPVs;
+ SmallVector<DbgVariableRecord *> DVRs;
for (auto &FI : F) {
for (Instruction &BI : FI) {
if (auto *DDI = dyn_cast<DbgDeclareInst>(&BI))
Dbgs.push_back(DDI);
- for (DPValue &DPV : filterDbgVars(BI.getDbgRecordRange())) {
- if (DPV.getType() == DPValue::LocationType::Declare)
- DPVs.push_back(&DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(BI.getDbgRecordRange())) {
+ if (DVR.getType() == DbgVariableRecord::LocationType::Declare)
+ DVRs.push_back(&DVR);
}
}
}
- if (Dbgs.empty() && DPVs.empty())
+ if (Dbgs.empty() && DVRs.empty())
return Changed;
auto LowerOne = [&](auto *DDI) {
@@ -1962,8 +1966,9 @@ bool llvm::LowerDbgDeclare(Function &F) {
DebugLoc NewLoc = getDebugValueLoc(DDI);
auto *DerefExpr =
DIExpression::append(DDI->getExpression(), dwarf::DW_OP_deref);
- insertDbgValueOrDPValue(DIB, AI, DDI->getVariable(), DerefExpr,
- NewLoc, CI->getIterator());
+ insertDbgValueOrDbgVariableRecord(DIB, AI, DDI->getVariable(),
+ DerefExpr, NewLoc,
+ CI->getIterator());
}
} else if (BitCastInst *BI = dyn_cast<BitCastInst>(U)) {
if (BI->getType()->isPointerTy())
@@ -1976,7 +1981,7 @@ bool llvm::LowerDbgDeclare(Function &F) {
};
for_each(Dbgs, LowerOne);
- for_each(DPVs, LowerOne);
+ for_each(DVRs, LowerOne);
if (Changed)
for (BasicBlock &BB : F)
@@ -1986,35 +1991,39 @@ bool llvm::LowerDbgDeclare(Function &F) {
}
// RemoveDIs: re-implementation of insertDebugValuesForPHIs, but which pulls the
-// debug-info out of the block's DPValues rather than dbg.value intrinsics.
-static void insertDPValuesForPHIs(BasicBlock *BB,
- SmallVectorImpl<PHINode *> &InsertedPHIs) {
- assert(BB && "No BasicBlock to clone DPValue(s) from.");
+// debug-info out of the block's DbgVariableRecords rather than dbg.value
+// intrinsics.
+static void
+insertDbgVariableRecordsForPHIs(BasicBlock *BB,
+ SmallVectorImpl<PHINode *> &InsertedPHIs) {
+ assert(BB && "No BasicBlock to clone DbgVariableRecord(s) from.");
if (InsertedPHIs.size() == 0)
return;
- // Map existing PHI nodes to their DPValues.
- DenseMap<Value *, DPValue *> DbgValueMap;
+ // Map existing PHI nodes to their DbgVariableRecords.
+ DenseMap<Value *, DbgVariableRecord *> DbgValueMap;
for (auto &I : *BB) {
- for (DPValue &DPV : filterDbgVars(I.getDbgRecordRange())) {
- for (Value *V : DPV.location_ops())
+ for (DbgVariableRecord &DVR : filterDbgVars(I.getDbgRecordRange())) {
+ for (Value *V : DVR.location_ops())
if (auto *Loc = dyn_cast_or_null<PHINode>(V))
- DbgValueMap.insert({Loc, &DPV});
+ DbgValueMap.insert({Loc, &DVR});
}
}
if (DbgValueMap.size() == 0)
return;
- // Map a pair of the destination BB and old DPValue to the new DPValue,
- // so that if a DPValue is being rewritten to use more than one of the
- // inserted PHIs in the same destination BB, we can update the same DPValue
- // with all the new PHIs instead of creating one copy for each.
- MapVector<std::pair<BasicBlock *, DPValue *>, DPValue *> NewDbgValueMap;
+ // Map a pair of the destination BB and old DbgVariableRecord to the new
+ // DbgVariableRecord, so that if a DbgVariableRecord is being rewritten to use
+ // more than one of the inserted PHIs in the same destination BB, we can
+ // update the same DbgVariableRecord with all the new PHIs instead of creating
+ // one copy for each.
+ MapVector<std::pair<BasicBlock *, DbgVariableRecord *>, DbgVariableRecord *>
+ NewDbgValueMap;
// Then iterate through the new PHIs and look to see if they use one of the
- // previously mapped PHIs. If so, create a new DPValue that will propagate
- // the info through the new PHI. If we use more than one new PHI in a single
- // destination BB with the same old dbg.value, merge the updates so that we
- // get a single new DPValue with all the new PHIs.
+ // previously mapped PHIs. If so, create a new DbgVariableRecord that will
+ // propagate the info through the new PHI. If we use more than one new PHI in
+ // a single destination BB with the same old dbg.value, merge the updates so
+ // that we get a single new DbgVariableRecord with all the new PHIs.
for (auto PHI : InsertedPHIs) {
BasicBlock *Parent = PHI->getParent();
// Avoid inserting a debug-info record into an EH block.
@@ -2023,13 +2032,13 @@ static void insertDPValuesForPHIs(BasicBlock *BB,
for (auto VI : PHI->operand_values()) {
auto V = DbgValueMap.find(VI);
if (V != DbgValueMap.end()) {
- DPValue *DbgII = cast<DPValue>(V->second);
+ DbgVariableRecord *DbgII = cast<DbgVariableRecord>(V->second);
auto NewDI = NewDbgValueMap.find({Parent, DbgII});
if (NewDI == NewDbgValueMap.end()) {
- DPValue *NewDbgII = DbgII->clone();
+ DbgVariableRecord *NewDbgII = DbgII->clone();
NewDI = NewDbgValueMap.insert({{Parent, DbgII}, NewDbgII}).first;
}
- DPValue *NewDbgII = NewDI->second;
+ DbgVariableRecord *NewDbgII = NewDI->second;
// If PHI contains VI as an operand more than once, we may
// replaced it in NewDbgII; confirm that it is present.
if (is_contained(NewDbgII->location_ops(), VI))
@@ -2037,10 +2046,10 @@ static void insertDPValuesForPHIs(BasicBlock *BB,
}
}
}
- // Insert the new DPValues into their destination blocks.
+ // Insert the new DbgVariableRecords into their destination blocks.
for (auto DI : NewDbgValueMap) {
BasicBlock *Parent = DI.first.first;
- DPValue *NewDbgII = DI.second;
+ DbgVariableRecord *NewDbgII = DI.second;
auto InsertionPt = Parent->getFirstInsertionPt();
assert(InsertionPt != Parent->end() && "Ill-formed basic block");
@@ -2055,7 +2064,7 @@ void llvm::insertDebugValuesForPHIs(BasicBlock *BB,
if (InsertedPHIs.size() == 0)
return;
- insertDPValuesForPHIs(BB, InsertedPHIs);
+ insertDbgVariableRecordsForPHIs(BB, InsertedPHIs);
// Map existing PHI nodes to their dbg.values.
ValueToValueMapTy DbgValueMap;
@@ -2117,7 +2126,7 @@ bool llvm::replaceDbgDeclare(Value *Address, Value *NewAddress,
DIBuilder &Builder, uint8_t DIExprFlags,
int Offset) {
TinyPtrVector<DbgDeclareInst *> DbgDeclares = findDbgDeclares(Address);
- TinyPtrVector<DPValue *> DPVDeclares = findDPVDeclares(Address);
+ TinyPtrVector<DbgVariableRecord *> DVRDeclares = findDVRDeclares(Address);
auto ReplaceOne = [&](auto *DII) {
assert(DII->getVariable() && "Missing variable");
@@ -2128,21 +2137,22 @@ bool llvm::replaceDbgDeclare(Value *Address, Value *NewAddress,
};
for_each(DbgDeclares, ReplaceOne);
- for_each(DPVDeclares, ReplaceOne);
+ for_each(DVRDeclares, ReplaceOne);
- return !DbgDeclares.empty() || !DPVDeclares.empty();
+ return !DbgDeclares.empty() || !DVRDeclares.empty();
}
static void updateOneDbgValueForAlloca(const DebugLoc &Loc,
DILocalVariable *DIVar,
DIExpression *DIExpr, Value *NewAddress,
- DbgValueInst *DVI, DPValue *DPV,
+ DbgValueInst *DVI,
+ DbgVariableRecord *DVR,
DIBuilder &Builder, int Offset) {
assert(DIVar && "Missing variable");
- // This is an alloca-based dbg.value/DPValue. The first thing it should do
- // with the alloca pointer is dereference it. Otherwise we don't know how to
- // handle it and give up.
+ // This is an alloca-based dbg.value/DbgVariableRecord. The first thing it
+ // should do with the alloca pointer is dereference it. Otherwise we don't
+ // know how to handle it and give up.
if (!DIExpr || DIExpr->getNumElements() < 1 ||
DIExpr->getElement(0) != dwarf::DW_OP_deref)
return;
@@ -2155,16 +2165,16 @@ static void updateOneDbgValueForAlloca(const DebugLoc &Loc,
DVI->setExpression(DIExpr);
DVI->replaceVariableLocationOp(0u, NewAddress);
} else {
- assert(DPV);
- DPV->setExpression(DIExpr);
- DPV->replaceVariableLocationOp(0u, NewAddress);
+ assert(DVR);
+ DVR->setExpression(DIExpr);
+ DVR->replaceVariableLocationOp(0u, NewAddress);
}
}
void llvm::replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
DIBuilder &Builder, int Offset) {
SmallVector<DbgValueInst *, 1> DbgUsers;
- SmallVector<DPValue *, 1> DPUsers;
+ SmallVector<DbgVariableRecord *, 1> DPUsers;
findDbgValues(DbgUsers, AI, &DPUsers);
// Attempt to replace dbg.values that use this alloca.
@@ -2173,18 +2183,18 @@ void llvm::replaceDbgValueForAlloca(AllocaInst *AI, Value *NewAllocaAddress,
DVI->getExpression(), NewAllocaAddress, DVI,
nullptr, Builder, Offset);
- // Replace any DPValues that use this alloca.
- for (DPValue *DPV : DPUsers)
- updateOneDbgValueForAlloca(DPV->getDebugLoc(), DPV->getVariable(),
- DPV->getExpression(), NewAllocaAddress, nullptr,
- DPV, Builder, Offset);
+ // Replace any DbgVariableRecords that use this alloca.
+ for (DbgVariableRecord *DVR : DPUsers)
+ updateOneDbgValueForAlloca(DVR->getDebugLoc(), DVR->getVariable(),
+ DVR->getExpression(), NewAllocaAddress, nullptr,
+ DVR, Builder, Offset);
}
/// Where possible to salvage debug information for \p I do so.
/// If not possible mark undef.
void llvm::salvageDebugInfo(Instruction &I) {
SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
- SmallVector<DPValue *, 1> DPUsers;
+ SmallVector<DbgVariableRecord *, 1> DPUsers;
findDbgUsers(DbgUsers, &I, &DPUsers);
salvageDebugInfoForDbgValues(I, DbgUsers, DPUsers);
}
@@ -2224,7 +2234,7 @@ template <typename T> static void salvageDbgAssignAddress(T *Assign) {
void llvm::salvageDebugInfoForDbgValues(
Instruction &I, ArrayRef<DbgVariableIntrinsic *> DbgUsers,
- ArrayRef<DPValue *> DPUsers) {
+ ArrayRef<DbgVariableRecord *> DPUsers) {
// These are arbitrary chosen limits on the maximum number of values and the
// maximum size of a debug expression we can salvage up to, used for
// performance reasons.
@@ -2290,67 +2300,68 @@ void llvm::salvageDebugInfoForDbgValues(
LLVM_DEBUG(dbgs() << "SALVAGE: " << *DII << '\n');
Salvaged = true;
}
- // Duplicate of above block for DPValues.
- for (auto *DPV : DPUsers) {
- if (DPV->isDbgAssign()) {
- if (DPV->getAddress() == &I) {
- salvageDbgAssignAddress(DPV);
+ // Duplicate of above block for DbgVariableRecords.
+ for (auto *DVR : DPUsers) {
+ if (DVR->isDbgAssign()) {
+ if (DVR->getAddress() == &I) {
+ salvageDbgAssignAddress(DVR);
Salvaged = true;
}
- if (DPV->getValue() != &I)
+ if (DVR->getValue() != &I)
continue;
}
// Do not add DW_OP_stack_value for DbgDeclare and DbgAddr, because they
// are implicitly pointing out the value as a DWARF memory location
// description.
- bool StackValue = DPV->getType() != DPValue::LocationType::Declare;
- auto DPVLocation = DPV->location_ops();
+ bool StackValue =
+ DVR->getType() != DbgVariableRecord::LocationType::Declare;
+ auto DVRLocation = DVR->location_ops();
assert(
- is_contained(DPVLocation, &I) &&
+ is_contained(DVRLocation, &I) &&
"DbgVariableIntrinsic must use salvaged instruction as its location");
SmallVector<Value *, 4> AdditionalValues;
- // 'I' may appear more than once in DPV's location ops, and each use of 'I'
+ // 'I' may appear more than once in DVR's location ops, and each use of 'I'
// must be updated in the DIExpression and potentially have additional
// values added; thus we call salvageDebugInfoImpl for each 'I' instance in
- // DPVLocation.
+ // DVRLocation.
Value *Op0 = nullptr;
- DIExpression *SalvagedExpr = DPV->getExpression();
- auto LocItr = find(DPVLocation, &I);
- while (SalvagedExpr && LocItr != DPVLocation.end()) {
+ DIExpression *SalvagedExpr = DVR->getExpression();
+ auto LocItr = find(DVRLocation, &I);
+ while (SalvagedExpr && LocItr != DVRLocation.end()) {
SmallVector<uint64_t, 16> Ops;
- unsigned LocNo = std::distance(DPVLocation.begin(), LocItr);
+ unsigned LocNo = std::distance(DVRLocation.begin(), LocItr);
uint64_t CurrentLocOps = SalvagedExpr->getNumLocationOperands();
Op0 = salvageDebugInfoImpl(I, CurrentLocOps, Ops, AdditionalValues);
if (!Op0)
break;
SalvagedExpr =
DIExpression::appendOpsToArg(SalvagedExpr, Ops, LocNo, StackValue);
- LocItr = std::find(++LocItr, DPVLocation.end(), &I);
+ LocItr = std::find(++LocItr, DVRLocation.end(), &I);
}
// salvageDebugInfoImpl should fail on examining the first element of
// DbgUsers, or none of them.
if (!Op0)
break;
- DPV->replaceVariableLocationOp(&I, Op0);
+ DVR->replaceVariableLocationOp(&I, Op0);
bool IsValidSalvageExpr =
SalvagedExpr->getNumElements() <= MaxExpressionSize;
if (AdditionalValues.empty() && IsValidSalvageExpr) {
- DPV->setExpression(SalvagedExpr);
- } else if (DPV->getType() != DPValue::LocationType::Declare &&
+ DVR->setExpression(SalvagedExpr);
+ } else if (DVR->getType() != DbgVariableRecord::LocationType::Declare &&
IsValidSalvageExpr &&
- DPV->getNumVariableLocationOps() + AdditionalValues.size() <=
+ DVR->getNumVariableLocationOps() + AdditionalValues.size() <=
MaxDebugArgs) {
- DPV->addVariableLocationOps(AdditionalValues, SalvagedExpr);
+ DVR->addVariableLocationOps(AdditionalValues, SalvagedExpr);
} else {
// Do not salvage using DIArgList for dbg.addr/dbg.declare, as it is
// currently only valid for stack value expressions.
// Also do not salvage if the resulting DIArgList would contain an
// unreasonably large number of values.
- DPV->setKillLocation();
+ DVR->setKillLocation();
}
- LLVM_DEBUG(dbgs() << "SALVAGE: " << DPV << '\n');
+ LLVM_DEBUG(dbgs() << "SALVAGE: " << DVR << '\n');
Salvaged = true;
}
@@ -2360,8 +2371,8 @@ void llvm::salvageDebugInfoForDbgValues(
for (auto *DII : DbgUsers)
DII->setKillLocation();
- for (auto *DPV : DPUsers)
- DPV->setKillLocation();
+ for (auto *DVR : DPUsers)
+ DVR->setKillLocation();
}
Value *getSalvageOpsForGEP(GetElementPtrInst *GEP, const DataLayout &DL,
@@ -2577,10 +2588,10 @@ using DbgValReplacement = std::optional<DIExpression *>;
static bool rewriteDebugUsers(
Instruction &From, Value &To, Instruction &DomPoint, DominatorTree &DT,
function_ref<DbgValReplacement(DbgVariableIntrinsic &DII)> RewriteExpr,
- function_ref<DbgValReplacement(DPValue &DPV)> RewriteDPVExpr) {
+ function_ref<DbgValReplacement(DbgVariableRecord &DVR)> RewriteDVRExpr) {
// Find debug users of From.
SmallVector<DbgVariableIntrinsic *, 1> Users;
- SmallVector<DPValue *, 1> DPUsers;
+ SmallVector<DbgVariableRecord *, 1> DPUsers;
findDbgUsers(Users, &From, &DPUsers);
if (Users.empty() && DPUsers.empty())
return false;
@@ -2589,7 +2600,7 @@ static bool rewriteDebugUsers(
bool Changed = false;
SmallPtrSet<DbgVariableIntrinsic *, 1> UndefOrSalvage;
- SmallPtrSet<DPValue *, 1> UndefOrSalvageDPV;
+ SmallPtrSet<DbgVariableRecord *, 1> UndefOrSalvageDVR;
if (isa<Instruction>(&To)) {
bool DomPointAfterFrom = From.getNextNonDebugInstruction() == &DomPoint;
@@ -2608,22 +2619,22 @@ static bool rewriteDebugUsers(
}
}
- // DPValue implementation of the above.
- for (auto *DPV : DPUsers) {
- Instruction *MarkedInstr = DPV->getMarker()->MarkedInstr;
+ // DbgVariableRecord implementation of the above.
+ for (auto *DVR : DPUsers) {
+ Instruction *MarkedInstr = DVR->getMarker()->MarkedInstr;
Instruction *NextNonDebug = MarkedInstr;
// The next instruction might still be a dbg.declare, skip over it.
if (isa<DbgVariableIntrinsic>(NextNonDebug))
NextNonDebug = NextNonDebug->getNextNonDebugInstruction();
if (DomPointAfterFrom && NextNonDebug == &DomPoint) {
- LLVM_DEBUG(dbgs() << "MOVE: " << *DPV << '\n');
- DPV->removeFromParent();
+ LLVM_DEBUG(dbgs() << "MOVE: " << *DVR << '\n');
+ DVR->removeFromParent();
// Ensure there's a marker.
- DomPoint.getParent()->insertDbgRecordAfter(DPV, &DomPoint);
+ DomPoint.getParent()->insertDbgRecordAfter(DVR, &DomPoint);
Changed = true;
} else if (!DT.dominates(&DomPoint, MarkedInstr)) {
- UndefOrSalvageDPV.insert(DPV);
+ UndefOrSalvageDVR.insert(DVR);
}
}
}
@@ -2642,21 +2653,21 @@ static bool rewriteDebugUsers(
LLVM_DEBUG(dbgs() << "REWRITE: " << *DII << '\n');
Changed = true;
}
- for (auto *DPV : DPUsers) {
- if (UndefOrSalvageDPV.count(DPV))
+ for (auto *DVR : DPUsers) {
+ if (UndefOrSalvageDVR.count(DVR))
continue;
- DbgValReplacement DVR = RewriteDPVExpr(*DPV);
+ DbgValReplacement DVR = RewriteDVRExpr(*DVR);
if (!DVR)
continue;
- DPV->replaceVariableLocationOp(&From, &To);
- DPV->setExpression(*DVR);
- LLVM_DEBUG(dbgs() << "REWRITE: " << DPV << '\n');
+ DVR->replaceVariableLocationOp(&From, &To);
+ DVR->setExpression(*DVR);
+ LLVM_DEBUG(dbgs() << "REWRITE: " << DVR << '\n');
Changed = true;
}
- if (!UndefOrSalvage.empty() || !UndefOrSalvageDPV.empty()) {
+ if (!UndefOrSalvage.empty() || !UndefOrSalvageDVR.empty()) {
// Try to salvage the remaining debug users.
salvageDebugInfo(From);
Changed = true;
@@ -2704,15 +2715,15 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
auto Identity = [&](DbgVariableIntrinsic &DII) -> DbgValReplacement {
return DII.getExpression();
};
- auto IdentityDPV = [&](DPValue &DPV) -> DbgValReplacement {
- return DPV.getExpression();
+ auto IdentityDVR = [&](DbgVariableRecord &DVR) -> DbgValReplacement {
+ return DVR.getExpression();
};
// Handle no-op conversions.
Module &M = *From.getModule();
const DataLayout &DL = M.getDataLayout();
if (isBitCastSemanticsPreserving(DL, FromTy, ToTy))
- return rewriteDebugUsers(From, To, DomPoint, DT, Identity, IdentityDPV);
+ return rewriteDebugUsers(From, To, DomPoint, DT, Identity, IdentityDVR);
// Handle integer-to-integer widening and narrowing.
// FIXME: Use DW_OP_convert when it's available everywhere.
@@ -2724,7 +2735,7 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
// When the width of the result grows, assume that a debugger will only
// access the low `FromBits` bits when inspecting the source variable.
if (FromBits < ToBits)
- return rewriteDebugUsers(From, To, DomPoint, DT, Identity, IdentityDPV);
+ return rewriteDebugUsers(From, To, DomPoint, DT, Identity, IdentityDVR);
// The width of the result has shrunk. Use sign/zero extension to describe
// the source variable's high bits.
@@ -2740,10 +2751,10 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
return DIExpression::appendExt(DII.getExpression(), ToBits, FromBits,
Signed);
};
- // RemoveDIs: duplicate implementation working on DPValues rather than on
- // dbg.value intrinsics.
- auto SignOrZeroExtDPV = [&](DPValue &DPV) -> DbgValReplacement {
- DILocalVariable *Var = DPV.getVariable();
+ // RemoveDIs: duplicate implementation working on DbgVariableRecords rather
+ // than on dbg.value intrinsics.
+ auto SignOrZeroExtDVR = [&](DbgVariableRecord &DVR) -> DbgValReplacement {
+ DILocalVariable *Var = DVR.getVariable();
// Without knowing signedness, sign/zero extension isn't possible.
auto Signedness = Var->getSignedness();
@@ -2751,11 +2762,11 @@ bool llvm::replaceAllDbgUsesWith(Instruction &From, Value &To,
return std::nullopt;
bool Signed = *Signedness == DIBasicType::Signedness::Signed;
- return DIExpression::appendExt(DPV.getExpression(), ToBits, FromBits,
+ return DIExpression::appendExt(DVR.getExpression(), ToBits, FromBits,
Signed);
};
return rewriteDebugUsers(From, To, DomPoint, DT, SignOrZeroExt,
- SignOrZeroExtDPV);
+ SignOrZeroExtDVR);
}
// TODO: Floating-point conversions, vectors.
@@ -2795,8 +2806,8 @@ llvm::removeAllNonTerminatorAndEHPadInstructions(BasicBlock *BB) {
if (!Inst->use_empty() && !Inst->getType()->isTokenTy())
Inst->replaceAllUsesWith(PoisonValue::get(Inst->getType()));
if (Inst->isEHPad() || Inst->getType()->isTokenTy()) {
- // EHPads can't have DPValues attached to them, but it might be possible
- // for things with token type.
+ // EHPads can't have DbgVariableRecords attached to them, but it might be
+ // possible for things with token type.
Inst->dropDbgRecords();
EndInst = Inst;
continue;
@@ -3544,12 +3555,12 @@ void llvm::copyRangeMetadata(const DataLayout &DL, const LoadInst &OldLI,
void llvm::dropDebugUsers(Instruction &I) {
SmallVector<DbgVariableIntrinsic *, 1> DbgUsers;
- SmallVector<DPValue *, 1> DPUsers;
+ SmallVector<DbgVariableRecord *, 1> DPUsers;
findDbgUsers(DbgUsers, &I, &DPUsers);
for (auto *DII : DbgUsers)
DII->eraseFromParent();
- for (auto *DPV : DPUsers)
- DPV->eraseFromParent();
+ for (auto *DVR : DPUsers)
+ DVR->eraseFromParent();
}
void llvm::hoistAllInstructionsInto(BasicBlock *DomBlock, Instruction *InsertPt,
diff --git a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
index 980ecf06c055c4..4470c5af870ae2 100644
--- a/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopRotationUtils.cpp
@@ -159,8 +159,8 @@ static void RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader,
// Replace MetadataAsValue(ValueAsMetadata(OrigHeaderVal)) uses in debug
// intrinsics.
SmallVector<DbgValueInst *, 1> DbgValues;
- SmallVector<DPValue *, 1> DPValues;
- llvm::findDbgValues(DbgValues, OrigHeaderVal, &DPValues);
+ SmallVector<DbgVariableRecord *, 1> DbgVariableRecords;
+ llvm::findDbgValues(DbgValues, OrigHeaderVal, &DbgVariableRecords);
for (auto &DbgValue : DbgValues) {
// The original users in the OrigHeader are already using the original
// definitions.
@@ -183,11 +183,11 @@ static void RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader,
}
// RemoveDIs: duplicate implementation for non-instruction debug-info
- // storage in DPValues.
- for (DPValue *DPV : DPValues) {
+ // storage in DbgVariableRecords.
+ for (DbgVariableRecord *DVR : DbgVariableRecords) {
// The original users in the OrigHeader are already using the original
// definitions.
- BasicBlock *UserBB = DPV->getMarker()->getParent();
+ BasicBlock *UserBB = DVR->getMarker()->getParent();
if (UserBB == OrigHeader)
continue;
@@ -202,7 +202,7 @@ static void RewriteUsesOfClonedInstructions(BasicBlock *OrigHeader,
NewVal = SSA.GetValueInMiddleOfBlock(UserBB);
else
NewVal = UndefValue::get(OrigHeaderVal->getType());
- DPV->replaceVariableLocationOp(OrigHeaderVal, NewVal);
+ DVR->replaceVariableLocationOp(OrigHeaderVal, NewVal);
}
}
}
@@ -552,20 +552,22 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
for (Instruction &I : llvm::drop_begin(llvm::reverse(*OrigPreheader))) {
if (auto *DII = dyn_cast<DbgVariableIntrinsic>(&I)) {
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 : filterDbgVars(DII->getDbgRecordRange()))
- DbgIntrinsics.insert(makeHash(&DPV));
+ // Until RemoveDIs supports dbg.declares in DbgVariableRecord format,
+ // we'll need to collect DbgVariableRecords attached to any other debug
+ // intrinsics.
+ for (const DbgVariableRecord &DVR :
+ filterDbgVars(DII->getDbgRecordRange()))
+ DbgIntrinsics.insert(makeHash(&DVR));
} else {
break;
}
}
- // Build DPValue hashes for DPValues attached to the terminator, which isn't
- // considered in the loop above.
- for (const DPValue &DPV :
+ // Build DbgVariableRecord hashes for DbgVariableRecords attached to the
+ // terminator, which isn't considered in the loop above.
+ for (const DbgVariableRecord &DVR :
filterDbgVars(OrigPreheader->getTerminator()->getDbgRecordRange()))
- DbgIntrinsics.insert(makeHash(&DPV));
+ DbgIntrinsics.insert(makeHash(&DVR));
// Remember the local noalias scope declarations in the header. After the
// rotation, they must be duplicated and the scope must be cloned. This
@@ -627,13 +629,14 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
!NextDbgInsts.empty()) {
auto DbgValueRange =
LoopEntryBranch->cloneDebugInfoFrom(Inst, NextDbgInsts.begin());
- RemapDPValueRange(M, DbgValueRange, ValueMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecordRange(M, DbgValueRange, ValueMap,
+ RF_NoModuleLevelChanges |
+ RF_IgnoreMissingLocals);
// Erase anything we've seen before.
- for (DPValue &DPV :
+ for (DbgVariableRecord &DVR :
make_early_inc_range(filterDbgVars(DbgValueRange)))
- if (DbgIntrinsics.count(makeHash(&DPV)))
- DPV.eraseFromParent();
+ if (DbgIntrinsics.count(makeHash(&DVR)))
+ DVR.eraseFromParent();
}
NextDbgInsts = I->getDbgRecordRange();
@@ -653,13 +656,15 @@ bool LoopRotate::rotateLoop(Loop *L, bool SimplifiedLatch) {
if (LoopEntryBranch->getParent()->IsNewDbgInfoFormat &&
!NextDbgInsts.empty()) {
auto Range = C->cloneDebugInfoFrom(Inst, NextDbgInsts.begin());
- RemapDPValueRange(M, Range, ValueMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecordRange(M, Range, ValueMap,
+ RF_NoModuleLevelChanges |
+ RF_IgnoreMissingLocals);
NextDbgInsts = DPMarker::getEmptyDbgRecordRange();
// Erase anything we've seen before.
- for (DPValue &DPV : make_early_inc_range(filterDbgVars(Range)))
- if (DbgIntrinsics.count(makeHash(&DPV)))
- DPV.eraseFromParent();
+ for (DbgVariableRecord &DVR :
+ make_early_inc_range(filterDbgVars(Range)))
+ if (DbgIntrinsics.count(makeHash(&DVR)))
+ DVR.eraseFromParent();
}
// Eagerly remap the operands of the instruction.
diff --git a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
index ecd76b7c1fbfb2..2d5b5f967ffbc0 100644
--- a/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUnrollRuntime.cpp
@@ -917,8 +917,9 @@ bool llvm::UnrollRuntimeLoopRemainder(
for (Instruction &I : *BB) {
RemapInstruction(&I, VMap,
RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
- RemapDPValueRange(M, I.getDbgRecordRange(), VMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecordRange(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 c815a7b0b2932f..9d816c5220532c 100644
--- a/llvm/lib/Transforms/Utils/LoopUtils.cpp
+++ b/llvm/lib/Transforms/Utils/LoopUtils.cpp
@@ -605,7 +605,7 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
// Use a map to unique and a vector to guarantee deterministic ordering.
llvm::SmallDenseSet<DebugVariable, 4> DeadDebugSet;
llvm::SmallVector<DbgVariableIntrinsic *, 4> DeadDebugInst;
- llvm::SmallVector<DPValue *, 4> DeadDPValues;
+ llvm::SmallVector<DbgVariableRecord *, 4> DeadDbgVariableRecords;
if (ExitBlock) {
// Given LCSSA form is satisfied, we should not have users of instructions
@@ -631,17 +631,17 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
U.set(Poison);
}
- // RemoveDIs: do the same as below for DPValues.
+ // RemoveDIs: do the same as below for DbgVariableRecords.
if (Block->IsNewDbgInfoFormat) {
- for (DPValue &DPV : llvm::make_early_inc_range(
+ for (DbgVariableRecord &DVR : llvm::make_early_inc_range(
filterDbgVars(I.getDbgRecordRange()))) {
- DebugVariable Key(DPV.getVariable(), DPV.getExpression(),
- DPV.getDebugLoc().get());
+ DebugVariable Key(DVR.getVariable(), DVR.getExpression(),
+ DVR.getDebugLoc().get());
if (!DeadDebugSet.insert(Key).second)
continue;
- // Unlinks the DPV from it's container, for later insertion.
- DPV.removeFromParent();
- DeadDPValues.push_back(&DPV);
+ // Unlinks the DVR from it's container, for later insertion.
+ DVR.removeFromParent();
+ DeadDbgVariableRecords.push_back(&DVR);
}
}
@@ -673,11 +673,11 @@ void llvm::deleteDeadLoop(Loop *L, DominatorTree *DT, ScalarEvolution *SE,
DVI->moveBefore(*ExitBlock, InsertDbgValueBefore);
// Due to the "head" bit in BasicBlock::iterator, we're going to insert
- // each DPValue right at the start of the block, wheras dbg.values would be
- // repeatedly inserted before the first instruction. To replicate this
- // behaviour, do it backwards.
- for (DPValue *DPV : llvm::reverse(DeadDPValues))
- ExitBlock->insertDbgRecordBefore(DPV, InsertDbgValueBefore);
+ // each DbgVariableRecord right at the start of the block, wheras dbg.values
+ // would be repeatedly inserted before the first instruction. To replicate
+ // this behaviour, do it backwards.
+ for (DbgVariableRecord *DVR : llvm::reverse(DeadDbgVariableRecords))
+ ExitBlock->insertDbgRecordBefore(DVR, InsertDbgValueBefore);
}
// Remove the block from the reference counting scheme, so that we can
diff --git a/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp b/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
index d671a9373bf026..8f55d7bbd3182a 100644
--- a/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
+++ b/llvm/lib/Transforms/Utils/MemoryOpRemark.cpp
@@ -332,7 +332,7 @@ void MemoryOpRemark::visitVariable(const Value *V,
}
};
for_each(findDbgDeclares(const_cast<Value *>(V)), FindDI);
- for_each(findDPVDeclares(const_cast<Value *>(V)), FindDI);
+ for_each(findDVRDeclares(const_cast<Value *>(V)), FindDI);
if (FoundDI) {
assert(!Result.empty());
diff --git a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
index e1f14b903fb8e5..b227f0f25b4dc1 100644
--- a/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
+++ b/llvm/lib/Transforms/Utils/MemoryTaggingSupport.cpp
@@ -110,21 +110,21 @@ Instruction *getUntagLocationIfFunctionExit(Instruction &Inst) {
void StackInfoBuilder::visit(Instruction &Inst) {
// Visit non-intrinsic debug-info records attached to Inst.
- for (DPValue &DPV : filterDbgVars(Inst.getDbgRecordRange())) {
+ for (DbgVariableRecord &DVR : filterDbgVars(Inst.getDbgRecordRange())) {
auto AddIfInteresting = [&](Value *V) {
if (auto *AI = dyn_cast_or_null<AllocaInst>(V)) {
if (!isInterestingAlloca(*AI))
return;
AllocaInfo &AInfo = Info.AllocasToInstrument[AI];
- auto &DPVVec = AInfo.DbgVariableRecords;
- if (DPVVec.empty() || DPVVec.back() != &DPV)
- DPVVec.push_back(&DPV);
+ auto &DVRVec = AInfo.DbgVariableRecords;
+ if (DVRVec.empty() || DVRVec.back() != &DVR)
+ DVRVec.push_back(&DVR);
}
};
- for_each(DPV.location_ops(), AddIfInteresting);
- if (DPV.isDbgAssign())
- AddIfInteresting(DPV.getAddress());
+ for_each(DVR.location_ops(), AddIfInteresting);
+ if (DVR.isDbgAssign())
+ AddIfInteresting(DVR.getAddress());
}
if (CallInst *CI = dyn_cast<CallInst>(&Inst)) {
diff --git a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
index b462803bad38c3..adcf161b313b2b 100644
--- a/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
+++ b/llvm/lib/Transforms/Utils/PromoteMemoryToRegister.cpp
@@ -104,11 +104,13 @@ namespace {
static void createDebugValue(DIBuilder &DIB, Value *NewValue,
DILocalVariable *Variable,
DIExpression *Expression, const DILocation *DI,
- DPValue *InsertBefore) {
- // FIXME: Merge these two functions now that DIBuilder supports DPValues.
- // We neeed the API to accept DPValues as an insert point for that to work.
+ DbgVariableRecord *InsertBefore) {
+ // FIXME: Merge these two functions now that DIBuilder supports
+ // DbgVariableRecords. We neeed the API to accept DbgVariableRecords as an
+ // insert point for that to work.
(void)DIB;
- DPValue::createDPValue(NewValue, Variable, Expression, DI, *InsertBefore);
+ DbgVariableRecord::createDbgVariableRecord(NewValue, Variable, Expression, DI,
+ *InsertBefore);
}
static void createDebugValue(DIBuilder &DIB, Value *NewValue,
DILocalVariable *Variable,
@@ -123,7 +125,7 @@ class AssignmentTrackingInfo {
/// fragment. (i.e. not be a comprehensive set if there are multiple
/// dbg.assigns for one variable fragment).
SmallVector<DbgVariableIntrinsic *> DbgAssigns;
- SmallVector<DPValue *> DPVAssigns;
+ SmallVector<DbgVariableRecord *> DVRAssigns;
public:
void init(AllocaInst *AI) {
@@ -132,21 +134,21 @@ class AssignmentTrackingInfo {
if (Vars.insert(DebugVariable(DAI)).second)
DbgAssigns.push_back(DAI);
}
- for (DPValue *DPV : at::getDPVAssignmentMarkers(AI)) {
- if (Vars.insert(DebugVariable(DPV)).second)
- DPVAssigns.push_back(DPV);
+ for (DbgVariableRecord *DVR : at::getDVRAssignmentMarkers(AI)) {
+ if (Vars.insert(DebugVariable(DVR)).second)
+ DVRAssigns.push_back(DVR);
}
}
/// Update assignment tracking debug info given for the to-be-deleted store
/// \p ToDelete that stores to this alloca.
- void
- updateForDeletedStore(StoreInst *ToDelete, DIBuilder &DIB,
- SmallSet<DbgAssignIntrinsic *, 8> *DbgAssignsToDelete,
- SmallSet<DPValue *, 8> *DPVAssignsToDelete) const {
+ void updateForDeletedStore(
+ StoreInst *ToDelete, DIBuilder &DIB,
+ SmallSet<DbgAssignIntrinsic *, 8> *DbgAssignsToDelete,
+ SmallSet<DbgVariableRecord *, 8> *DVRAssignsToDelete) const {
// There's nothing to do if the alloca doesn't have any variables using
// assignment tracking.
- if (DbgAssigns.empty() && DPVAssigns.empty())
+ if (DbgAssigns.empty() && DVRAssigns.empty())
return;
// Insert a dbg.value where the linked dbg.assign is and remember to delete
@@ -165,8 +167,8 @@ class AssignmentTrackingInfo {
};
for (auto *Assign : at::getAssignmentMarkers(ToDelete))
InsertValueForAssign(Assign, DbgAssignsToDelete);
- for (auto *Assign : at::getDPVAssignmentMarkers(ToDelete))
- InsertValueForAssign(Assign, DPVAssignsToDelete);
+ for (auto *Assign : at::getDVRAssignmentMarkers(ToDelete))
+ InsertValueForAssign(Assign, DVRAssignsToDelete);
// It's possible for variables using assignment tracking to have no
// dbg.assign linked to this store. These are variables in DbgAssigns that
@@ -182,7 +184,7 @@ class AssignmentTrackingInfo {
ConvertDebugDeclareToDebugValue(Assign, ToDelete, DIB);
};
for_each(DbgAssigns, ConvertUnlinkedAssignToValue);
- for_each(DPVAssigns, ConvertUnlinkedAssignToValue);
+ for_each(DVRAssigns, ConvertUnlinkedAssignToValue);
}
/// Update assignment tracking debug info given for the newly inserted PHI \p
@@ -193,20 +195,20 @@ class AssignmentTrackingInfo {
// debug-phi.
for (auto *DAI : DbgAssigns)
ConvertDebugDeclareToDebugValue(DAI, NewPhi, DIB);
- for (auto *DPV : DPVAssigns)
- ConvertDebugDeclareToDebugValue(DPV, NewPhi, DIB);
+ for (auto *DVR : DVRAssigns)
+ ConvertDebugDeclareToDebugValue(DVR, NewPhi, DIB);
}
void clear() {
DbgAssigns.clear();
- DPVAssigns.clear();
+ DVRAssigns.clear();
}
- bool empty() { return DbgAssigns.empty() && DPVAssigns.empty(); }
+ bool empty() { return DbgAssigns.empty() && DVRAssigns.empty(); }
};
struct AllocaInfo {
using DbgUserVec = SmallVector<DbgVariableIntrinsic *, 1>;
- using DPUserVec = SmallVector<DPValue *, 1>;
+ using DPUserVec = SmallVector<DbgVariableRecord *, 1>;
SmallVector<BasicBlock *, 32> DefiningBlocks;
SmallVector<BasicBlock *, 32> UsingBlocks;
@@ -262,7 +264,7 @@ struct AllocaInfo {
}
}
DbgUserVec AllDbgUsers;
- SmallVector<DPValue *> AllDPUsers;
+ SmallVector<DbgVariableRecord *> AllDPUsers;
findDbgUsers(AllDbgUsers, AI, &AllDPUsers);
std::copy_if(AllDbgUsers.begin(), AllDbgUsers.end(),
std::back_inserter(DbgUsers), [](DbgVariableIntrinsic *DII) {
@@ -270,7 +272,7 @@ struct AllocaInfo {
});
std::copy_if(AllDPUsers.begin(), AllDPUsers.end(),
std::back_inserter(DPUsers),
- [](DPValue *DPV) { return !DPV->isDbgAssign(); });
+ [](DbgVariableRecord *DVR) { return !DVR->isDbgAssign(); });
AssignmentTracking.init(AI);
}
};
@@ -378,7 +380,7 @@ struct PromoteMem2Reg {
/// A set of dbg.assigns to delete because they've been demoted to
/// dbg.values. Call cleanUpDbgAssigns to delete them.
SmallSet<DbgAssignIntrinsic *, 8> DbgAssignsToDelete;
- SmallSet<DPValue *, 8> DPVAssignsToDelete;
+ SmallSet<DbgVariableRecord *, 8> DVRAssignsToDelete;
/// The set of basic blocks the renamer has already visited.
SmallPtrSet<BasicBlock *, 16> Visited;
@@ -428,9 +430,9 @@ struct PromoteMem2Reg {
for (auto *DAI : DbgAssignsToDelete)
DAI->eraseFromParent();
DbgAssignsToDelete.clear();
- for (auto *DPV : DPVAssignsToDelete)
- DPV->eraseFromParent();
- DPVAssignsToDelete.clear();
+ for (auto *DVR : DVRAssignsToDelete)
+ DVR->eraseFromParent();
+ DVRAssignsToDelete.clear();
}
};
@@ -508,7 +510,7 @@ rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info, LargeBlockInfo &LBI,
const DataLayout &DL, DominatorTree &DT,
AssumptionCache *AC,
SmallSet<DbgAssignIntrinsic *, 8> *DbgAssignsToDelete,
- SmallSet<DPValue *, 8> *DPVAssignsToDelete) {
+ SmallSet<DbgVariableRecord *, 8> *DVRAssignsToDelete) {
StoreInst *OnlyStore = Info.OnlyStore;
bool StoringGlobalVal = !isa<Instruction>(OnlyStore->getOperand(0));
BasicBlock *StoreBB = OnlyStore->getParent();
@@ -569,7 +571,7 @@ rewriteSingleStoreAlloca(AllocaInst *AI, AllocaInfo &Info, LargeBlockInfo &LBI,
DIBuilder DIB(*AI->getModule(), /*AllowUnresolved*/ false);
// Update assignment tracking info for the store we're going to delete.
Info.AssignmentTracking.updateForDeletedStore(
- Info.OnlyStore, DIB, DbgAssignsToDelete, DPVAssignsToDelete);
+ Info.OnlyStore, DIB, DbgAssignsToDelete, DVRAssignsToDelete);
// Record debuginfo for the store and remove the declaration's
// debuginfo.
@@ -618,7 +620,7 @@ promoteSingleBlockAlloca(AllocaInst *AI, const AllocaInfo &Info,
LargeBlockInfo &LBI, const DataLayout &DL,
DominatorTree &DT, AssumptionCache *AC,
SmallSet<DbgAssignIntrinsic *, 8> *DbgAssignsToDelete,
- SmallSet<DPValue *, 8> *DPVAssignsToDelete) {
+ SmallSet<DbgVariableRecord *, 8> *DVRAssignsToDelete) {
// The trickiest case to handle is when we have large blocks. Because of this,
// this code is optimized assuming that large blocks happen. This does not
// significantly pessimize the small block case. This uses LargeBlockInfo to
@@ -683,7 +685,7 @@ promoteSingleBlockAlloca(AllocaInst *AI, const AllocaInfo &Info,
StoreInst *SI = cast<StoreInst>(AI->user_back());
// Update assignment tracking info for the store we're going to delete.
Info.AssignmentTracking.updateForDeletedStore(SI, DIB, DbgAssignsToDelete,
- DPVAssignsToDelete);
+ DVRAssignsToDelete);
// Record debuginfo for the store before removing it.
auto DbgUpdateForStore = [&](auto &Container) {
for (auto *DbgItem : Container) {
@@ -755,7 +757,7 @@ void PromoteMem2Reg::run() {
// it that are directly dominated by the definition with the value stored.
if (Info.DefiningBlocks.size() == 1) {
if (rewriteSingleStoreAlloca(AI, Info, LBI, SQ.DL, DT, AC,
- &DbgAssignsToDelete, &DPVAssignsToDelete)) {
+ &DbgAssignsToDelete, &DVRAssignsToDelete)) {
// The alloca has been processed, move on.
RemoveFromAllocasList(AllocaNum);
++NumSingleStore;
@@ -767,7 +769,7 @@ void PromoteMem2Reg::run() {
// linear sweep over the block to eliminate it.
if (Info.OnlyUsedInOneBlock &&
promoteSingleBlockAlloca(AI, Info, LBI, SQ.DL, DT, AC,
- &DbgAssignsToDelete, &DPVAssignsToDelete)) {
+ &DbgAssignsToDelete, &DVRAssignsToDelete)) {
// The alloca has been processed, move on.
RemoveFromAllocasList(AllocaNum);
continue;
@@ -1174,7 +1176,7 @@ void PromoteMem2Reg::RenamePass(BasicBlock *BB, BasicBlock *Pred,
// Record debuginfo for the store before removing it.
IncomingLocs[AllocaNo] = SI->getDebugLoc();
AllocaATInfo[AllocaNo].updateForDeletedStore(SI, DIB, &DbgAssignsToDelete,
- &DPVAssignsToDelete);
+ &DVRAssignsToDelete);
auto ConvertDbgDeclares = [&](auto &Container) {
for (auto *DbgItem : Container)
if (DbgItem->isAddressOfVariable())
diff --git a/llvm/lib/Transforms/Utils/SSAUpdater.cpp b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
index fc21fb552137d7..38df20c949c2ec 100644
--- a/llvm/lib/Transforms/Utils/SSAUpdater.cpp
+++ b/llvm/lib/Transforms/Utils/SSAUpdater.cpp
@@ -199,17 +199,17 @@ void SSAUpdater::RewriteUse(Use &U) {
void SSAUpdater::UpdateDebugValues(Instruction *I) {
SmallVector<DbgValueInst *, 4> DbgValues;
- SmallVector<DPValue *, 4> DPValues;
- llvm::findDbgValues(DbgValues, I, &DPValues);
+ SmallVector<DbgVariableRecord *, 4> DbgVariableRecords;
+ llvm::findDbgValues(DbgValues, I, &DbgVariableRecords);
for (auto &DbgValue : DbgValues) {
if (DbgValue->getParent() == I->getParent())
continue;
UpdateDebugValue(I, DbgValue);
}
- for (auto &DPV : DPValues) {
- if (DPV->getParent() == I->getParent())
+ for (auto &DVR : DbgVariableRecords) {
+ if (DVR->getParent() == I->getParent())
continue;
- UpdateDebugValue(I, DPV);
+ UpdateDebugValue(I, DVR);
}
}
@@ -220,10 +220,10 @@ void SSAUpdater::UpdateDebugValues(Instruction *I,
}
}
-void SSAUpdater::UpdateDebugValues(Instruction *I,
- SmallVectorImpl<DPValue *> &DPValues) {
- for (auto &DPV : DPValues) {
- UpdateDebugValue(I, DPV);
+void SSAUpdater::UpdateDebugValues(
+ Instruction *I, SmallVectorImpl<DbgVariableRecord *> &DbgVariableRecords) {
+ for (auto &DVR : DbgVariableRecords) {
+ UpdateDebugValue(I, DVR);
}
}
@@ -236,13 +236,13 @@ void SSAUpdater::UpdateDebugValue(Instruction *I, DbgValueInst *DbgValue) {
DbgValue->setKillLocation();
}
-void SSAUpdater::UpdateDebugValue(Instruction *I, DPValue *DPV) {
- BasicBlock *UserBB = DPV->getParent();
+void SSAUpdater::UpdateDebugValue(Instruction *I, DbgVariableRecord *DVR) {
+ BasicBlock *UserBB = DVR->getParent();
if (HasValueForBlock(UserBB)) {
Value *NewVal = GetValueAtEndOfBlock(UserBB);
- DPV->replaceVariableLocationOp(I, NewVal);
+ DVR->replaceVariableLocationOp(I, NewVal);
} else
- DPV->setKillLocation();
+ DVR->setKillLocation();
}
void SSAUpdater::RewriteUseAfterInsertions(Use &U) {
diff --git a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
index 292ad78a1852bc..55bbffb18879fb 100644
--- a/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
+++ b/llvm/lib/Transforms/Utils/SimplifyCFG.cpp
@@ -1126,8 +1126,9 @@ static void CloneInstructionsIntoPredecessorBlockAndUpdateSSAUses(
NewBonusInst->insertInto(PredBlock, PTI->getIterator());
auto Range = NewBonusInst->cloneDebugInfoFrom(&BonusInst);
- RemapDPValueRange(NewBonusInst->getModule(), Range, VMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecordRange(NewBonusInst->getModule(), Range, VMap,
+ RF_NoModuleLevelChanges |
+ RF_IgnoreMissingLocals);
if (isa<DbgInfoIntrinsic>(BonusInst))
continue;
@@ -1526,15 +1527,15 @@ static bool shouldHoistCommonInstructions(Instruction *I1, Instruction *I2,
return true;
}
-/// Hoists DPValues from \p I1 and \p OtherInstrs that are identical in
-/// lock-step to \p TI. This matches how dbg.* intrinsics are hoisting in
+/// Hoists DbgVariableRecords from \p I1 and \p OtherInstrs that are identical
+/// in lock-step to \p TI. This matches how dbg.* intrinsics are hoisting in
/// hoistCommonCodeFromSuccessors. e.g. The input:
-/// I1 DPVs: { x, z },
-/// OtherInsts: { I2 DPVs: { x, y, z } }
-/// would result in hoisting only DPValue x.
-static void
-hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1,
- SmallVectorImpl<Instruction *> &OtherInsts) {
+/// I1 DVRs: { x, z },
+/// OtherInsts: { I2 DVRs: { x, y, z } }
+/// would result in hoisting only DbgVariableRecord x.
+static void hoistLockstepIdenticalDbgVariableRecords(
+ Instruction *TI, Instruction *I1,
+ SmallVectorImpl<Instruction *> &OtherInsts) {
if (!I1->hasDbgRecords())
return;
using CurrentAndEndIt =
@@ -1570,12 +1571,12 @@ hoistLockstepIdenticalDPValues(Instruction *TI, Instruction *I1,
// This replicates the dbg.* intrinsic behaviour in
// hoistCommonCodeFromSuccessors.
while (none_of(Itrs, atEnd)) {
- bool HoistDPVs = allIdentical(Itrs);
+ bool HoistDVRs = allIdentical(Itrs);
for (CurrentAndEndIt &Pair : Itrs) {
// Increment Current iterator now as we may be about to move the
// DbgRecord.
DbgRecord &DR = *Pair.first++;
- if (HoistDPVs) {
+ if (HoistDVRs) {
DR.removeFromParent();
TI->getParent()->insertDbgRecordBefore(&DR, TI->getIterator());
}
@@ -1691,7 +1692,7 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(BasicBlock *BB,
// at the beginning of the loop, we can hoist the terminator instruction.
// If any instructions remain in the block, we cannot hoist terminators.
if (NumSkipped || !AllInstsAreIdentical) {
- hoistLockstepIdenticalDPValues(TI, I1, OtherInsts);
+ hoistLockstepIdenticalDbgVariableRecords(TI, I1, OtherInsts);
return Changed;
}
@@ -1721,9 +1722,9 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(BasicBlock *BB,
// The debug location is an integral part of a debug info intrinsic
// and can't be separated from it or replaced. Instead of attempting
// to merge locations, simply hoist both copies of the intrinsic.
- hoistLockstepIdenticalDPValues(TI, I1, OtherInsts);
- // We've just hoisted DPValues; move I1 after them (before TI) and
- // leave any that were not hoisted behind (by calling moveBefore
+ hoistLockstepIdenticalDbgVariableRecords(TI, I1, OtherInsts);
+ // We've just hoisted DbgVariableRecords; move I1 after them (before TI)
+ // and leave any that were not hoisted behind (by calling moveBefore
// rather than moveBeforePreserving).
I1->moveBefore(TI);
for (auto &SuccIter : OtherSuccIterRange) {
@@ -1735,9 +1736,9 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(BasicBlock *BB,
// For a normal instruction, we just move one to right before the
// branch, then replace all uses of the other with the first. Finally,
// we remove the now redundant second instruction.
- hoistLockstepIdenticalDPValues(TI, I1, OtherInsts);
- // We've just hoisted DPValues; move I1 after them (before TI) and
- // leave any that were not hoisted behind (by calling moveBefore
+ hoistLockstepIdenticalDbgVariableRecords(TI, I1, OtherInsts);
+ // We've just hoisted DbgVariableRecords; move I1 after them (before TI)
+ // and leave any that were not hoisted behind (by calling moveBefore
// rather than moveBeforePreserving).
I1->moveBefore(TI);
for (auto &SuccIter : OtherSuccIterRange) {
@@ -1759,7 +1760,7 @@ bool SimplifyCFGOpt::hoistCommonCodeFromSuccessors(BasicBlock *BB,
NumHoistCommonInstrs += SuccIterPairs.size();
} else {
if (NumSkipped >= HoistCommonSkipLimit) {
- hoistLockstepIdenticalDPValues(TI, I1, OtherInsts);
+ hoistLockstepIdenticalDbgVariableRecords(TI, I1, OtherInsts);
return Changed;
}
// We are about to skip over a pair of non-identical instructions. Record
@@ -1822,9 +1823,9 @@ bool SimplifyCFGOpt::hoistSuccIdenticalTerminatorToSwitchOrIf(
}
}
- // Hoist DPValues attached to the terminator to match dbg.* intrinsic hoisting
- // behaviour in hoistCommonCodeFromSuccessors.
- hoistLockstepIdenticalDPValues(TI, I1, OtherSuccTIs);
+ // Hoist DbgVariableRecords attached to the terminator to match dbg.*
+ // intrinsic hoisting behaviour in hoistCommonCodeFromSuccessors.
+ hoistLockstepIdenticalDbgVariableRecords(TI, I1, OtherSuccTIs);
// Clone the terminator and hoist it into the pred, without any debug info.
Instruction *NT = I1->clone();
NT->insertInto(TIParent, TI->getIterator());
@@ -3179,7 +3180,7 @@ bool SimplifyCFGOpt::SpeculativelyExecuteBB(BranchInst *BI,
DbgAssign->replaceVariableLocationOp(OrigV, S);
};
for_each(at::getAssignmentMarkers(SpeculatedStore), replaceVariable);
- for_each(at::getDPVAssignmentMarkers(SpeculatedStore), replaceVariable);
+ for_each(at::getDVRAssignmentMarkers(SpeculatedStore), replaceVariable);
}
// Metadata can be dependent on the condition we are hoisting above.
@@ -3204,13 +3205,15 @@ bool SimplifyCFGOpt::SpeculativelyExecuteBB(BranchInst *BI,
}
// Hoist the instructions.
- // In "RemoveDIs" non-instr debug-info mode, drop DPValues attached to these
- // instructions, in the same way that dbg.value intrinsics are dropped at the
- // end of this block.
+ // In "RemoveDIs" non-instr debug-info mode, drop DbgVariableRecords attached
+ // to these 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.getDbgRecordRange()))
- // Drop all records except assign-kind DPValues (dbg.assign equivalent).
- if (DPValue *DPV = dyn_cast<DPValue>(&DR); !DPV || !DPV->isDbgAssign())
+ // Drop all records except assign-kind DbgVariableRecords (dbg.assign
+ // equivalent).
+ if (DbgVariableRecord *DVR = dyn_cast<DbgVariableRecord>(&DR);
+ !DVR || !DVR->isDbgAssign())
It.dropOneDbgRecord(&DR);
BB->splice(BI->getIterator(), ThenBB, ThenBB->begin(),
std::prev(ThenBB->end()));
@@ -3385,7 +3388,7 @@ FoldCondBranchOnValueKnownInPredecessorImpl(BranchInst *BI, DomTreeUpdater *DTU,
TranslateMap[Cond] = CB;
// RemoveDIs: track instructions that we optimise away while folding, so
- // that we can copy DPValues from them later.
+ // that we can copy DbgVariableRecords from them later.
BasicBlock::iterator SrcDbgCursor = BB->begin();
for (BasicBlock::iterator BBI = BB->begin(); &*BBI != BI; ++BBI) {
if (PHINode *PN = dyn_cast<PHINode>(BBI)) {
@@ -3849,10 +3852,10 @@ static bool performBranchToCommonDestFolding(BranchInst *BI, BranchInst *PBI,
if (PredBlock->IsNewDbgInfoFormat) {
PredBlock->getTerminator()->cloneDebugInfoFrom(BB->getTerminator());
- for (DPValue &DPV :
+ for (DbgVariableRecord &DVR :
filterDbgVars(PredBlock->getTerminator()->getDbgRecordRange())) {
- RemapDPValue(M, &DPV, VMap,
- RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
+ RemapDbgVariableRecord(M, &DVR, VMap,
+ RF_NoModuleLevelChanges | RF_IgnoreMissingLocals);
}
}
diff --git a/llvm/lib/Transforms/Utils/ValueMapper.cpp b/llvm/lib/Transforms/Utils/ValueMapper.cpp
index d0377421145cbc..8c24599c8ce37d 100644
--- a/llvm/lib/Transforms/Utils/ValueMapper.cpp
+++ b/llvm/lib/Transforms/Utils/ValueMapper.cpp
@@ -146,7 +146,7 @@ class Mapper {
Value *mapValue(const Value *V);
void remapInstruction(Instruction *I);
void remapFunction(Function &F);
- void remapDbgRecord(DbgRecord &DPV);
+ void remapDbgRecord(DbgRecord &DVR);
Constant *mapConstant(const Constant *C) {
return cast_or_null<Constant>(mapValue(C));
@@ -543,7 +543,7 @@ void Mapper::remapDbgRecord(DbgRecord &DR) {
return;
}
- DPValue &V = cast<DPValue>(DR);
+ DbgVariableRecord &V = cast<DbgVariableRecord>(DR);
// Remap variables and DILocations.
auto *MappedVar = mapMetadata(V.getVariable());
auto *MappedDILoc = mapMetadata(V.getDebugLoc());
@@ -1233,14 +1233,14 @@ void ValueMapper::remapInstruction(Instruction &I) {
FlushingMapper(pImpl)->remapInstruction(&I);
}
-void ValueMapper::remapDPValue(Module *M, DPValue &V) {
+void ValueMapper::remapDbgVariableRecord(Module *M, DbgVariableRecord &V) {
FlushingMapper(pImpl)->remapDbgRecord(V);
}
-void ValueMapper::remapDPValueRange(
+void ValueMapper::remapDbgVariableRecordRange(
Module *M, iterator_range<DbgRecord::self_iterator> Range) {
- for (DPValue &DPV : filterDbgVars(Range)) {
- remapDPValue(M, DPV);
+ for (DbgVariableRecord &DVR : filterDbgVars(Range)) {
+ remapDbgVariableRecord(M, DVR);
}
}
diff --git a/llvm/test/DebugInfo/dpvalue-print-nocrash.ll b/llvm/test/DebugInfo/dpvalue-print-nocrash.ll
index 0a618c6780d1d8..d8cb542285c89b 100755
--- a/llvm/test/DebugInfo/dpvalue-print-nocrash.ll
+++ b/llvm/test/DebugInfo/dpvalue-print-nocrash.ll
@@ -1,4 +1,4 @@
-;; Tests that we can debug-print DPValues that have no markers attached.
+;; Tests that we can debug-print DbgVariableRecords that have no markers attached.
; RUN: opt -passes="instcombine" -debug %s -o /dev/null 2>&1 | FileCheck %s
; REQUIRES: asserts
diff --git a/llvm/test/Transforms/LoopRotate/dbgvalue.ll b/llvm/test/Transforms/LoopRotate/dbgvalue.ll
index 92cc886bc81c10..9ecc31e1bd2d3b 100644
--- a/llvm/test/Transforms/LoopRotate/dbgvalue.ll
+++ b/llvm/test/Transforms/LoopRotate/dbgvalue.ll
@@ -220,7 +220,7 @@ for.end:
; Test that dbg.value intrinsincs adjacent to the `icmp slt i32 0, 0` get
; rotated as expected. The icmp is loop-invariant and so gets hoisted to the
-; preheader via a different code path. This is more difficult for DPValue
+; preheader via a different code path. This is more difficult for DbgVariableRecord
; debug-info records to handle, because they have to get detached and moved
; somewhere else during rotation.
define void @invariant_hoist() !dbg !70 {
diff --git a/llvm/test/tools/llvm-reduce/remove-dp-values.ll b/llvm/test/tools/llvm-reduce/remove-dp-values.ll
index 40ff9f32e960d0..d137b279f4ea01 100644
--- a/llvm/test/tools/llvm-reduce/remove-dp-values.ll
+++ b/llvm/test/tools/llvm-reduce/remove-dp-values.ll
@@ -1,7 +1,7 @@
; RUN: llvm-reduce --abort-on-invalid-reduction --test FileCheck --test-arg --check-prefixes=CHECK-INTERESTINGNESS --test-arg %s --test-arg --input-file %s -o %t --try-experimental-debuginfo-iterators
; RUN: FileCheck --check-prefixes=CHECK-FINAL --input-file=%t %s --implicit-check-not=dbg.value
-; Test that we can, in RemoveDIs mode / DPValues mode (where variable location
+; Test that we can, in RemoveDIs mode / DbgVariableRecords mode (where variable location
; information isn't an instruction), remove one variable location assignment
; but not another.
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
index 2f3d4cac9fa015..25de659109c9f0 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.cpp
@@ -7,13 +7,13 @@
//===----------------------------------------------------------------------===//
//
// This file implements a function which calls the Generic Delta pass in order
-// to reduce uninteresting DPValues from defined functions.
+// to reduce uninteresting DbgVariableRecords from defined functions.
//
-// DPValues store variable-location debug-info and are attached to instructions.
-// This information used to be represented by intrinsics such as dbg.value, and
-// would naturally get reduced by llvm-reduce like any other instruction. As
-// DPValues get stored elsewhere, they need to be enumerated and eliminated like
-// any other data structure in LLVM.
+// DbgVariableRecords store variable-location debug-info and are attached to
+// instructions. This information used to be represented by intrinsics such as
+// dbg.value, and would naturally get reduced by llvm-reduce like any other
+// instruction. As DbgVariableRecords get stored elsewhere, they need to be
+// enumerated and eliminated like any other data structure in LLVM.
//
//===----------------------------------------------------------------------===//
diff --git a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.h b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.h
index 6a8f62155ec3e2..07a1e04fceaeec 100644
--- a/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.h
+++ b/llvm/tools/llvm-reduce/deltas/ReduceDbgRecords.h
@@ -7,7 +7,7 @@
//===----------------------------------------------------------------------===//
//
// This file implements a function which calls the Generic Delta pass in order
-// to reduce uninteresting DPValues from defined functions.
+// to reduce uninteresting DbgVariableRecords from defined functions.
//
//===----------------------------------------------------------------------===//
diff --git a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
index bfc64cb84143d3..92658b7b6895f5 100644
--- a/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
+++ b/llvm/unittests/IR/BasicBlockDbgInfoTest.cpp
@@ -41,7 +41,7 @@ namespace {
// position that it already resides at. This is fine -- but gets complicated
// with dbg.value intrinsics. By moving an instruction, we can end up changing
// nothing but the location of debug-info intrinsics. That has to be modelled
-// by DPValues, the dbg.value replacement.
+// by DbgVariableRecords, the dbg.value replacement.
TEST(BasicBlockDbgInfoTest, InsertAfterSelf) {
LLVMContext C;
UseNewDbgInfoFormat = true;
@@ -90,10 +90,10 @@ TEST(BasicBlockDbgInfoTest, InsertAfterSelf) {
// %b = add
// %c = add
// dbg.value
- // Check that this is replicated by DPValues.
+ // Check that this is replicated by DbgVariableRecords.
Inst2->moveAfter(Inst1);
- // Inst1 should only have one DPValue on it.
+ // Inst1 should only have one DbgVariableRecord on it.
EXPECT_TRUE(Inst1->hasDbgRecords());
auto Range1 = Inst1->getDbgRecordRange();
EXPECT_EQ(std::distance(Range1.begin(), Range1.end()), 1u);
@@ -158,44 +158,44 @@ TEST(BasicBlockDbgInfoTest, MarkerOperations) {
EXPECT_EQ(BB.getNextMarker(Instr1), Marker2);
EXPECT_EQ(BB.getNextMarker(Instr2), EndMarker); // Is nullptr.
- // There should be two DPValues,
+ // There should be two DbgVariableRecords,
EXPECT_EQ(Marker1->StoredDbgRecords.size(), 1u);
EXPECT_EQ(Marker2->StoredDbgRecords.size(), 1u);
// Unlink them and try to re-insert them through the basic block.
- DbgRecord *DPV1 = &*Marker1->StoredDbgRecords.begin();
- DbgRecord *DPV2 = &*Marker2->StoredDbgRecords.begin();
- DPV1->removeFromParent();
- DPV2->removeFromParent();
+ DbgRecord *DVR1 = &*Marker1->StoredDbgRecords.begin();
+ DbgRecord *DVR2 = &*Marker2->StoredDbgRecords.begin();
+ DVR1->removeFromParent();
+ DVR2->removeFromParent();
EXPECT_TRUE(Marker1->StoredDbgRecords.empty());
EXPECT_TRUE(Marker2->StoredDbgRecords.empty());
// This should appear in Marker1.
- BB.insertDbgRecordBefore(DPV1, BB.begin());
+ BB.insertDbgRecordBefore(DVR1, BB.begin());
EXPECT_EQ(Marker1->StoredDbgRecords.size(), 1u);
- EXPECT_EQ(DPV1, &*Marker1->StoredDbgRecords.begin());
+ EXPECT_EQ(DVR1, &*Marker1->StoredDbgRecords.begin());
// This should attach to Marker2.
- BB.insertDbgRecordAfter(DPV2, &*BB.begin());
+ BB.insertDbgRecordAfter(DVR2, &*BB.begin());
EXPECT_EQ(Marker2->StoredDbgRecords.size(), 1u);
- EXPECT_EQ(DPV2, &*Marker2->StoredDbgRecords.begin());
+ EXPECT_EQ(DVR2, &*Marker2->StoredDbgRecords.begin());
- // Now, how about removing instructions? That should cause any DPValues to
- // "fall down".
+ // Now, how about removing instructions? That should cause any
+ // DbgVariableRecords to "fall down".
Instr1->removeFromParent();
Marker1 = nullptr;
- // DPValues should now be in Marker2.
+ // DbgVariableRecords should now be in Marker2.
EXPECT_EQ(BB.size(), 1u);
EXPECT_EQ(Marker2->StoredDbgRecords.size(), 2u);
// They should also be in the correct order.
- SmallVector<DbgRecord *, 2> DPVs;
- 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.
+ SmallVector<DbgRecord *, 2> DVRs;
+ for (DbgRecord &DVR : Marker2->getDbgRecordRange())
+ DVRs.push_back(&DVR);
+ EXPECT_EQ(DVRs[0], DVR1);
+ EXPECT_EQ(DVRs[1], DVR2);
+
+ // If we remove the end instruction, the DbgVariableRecords should fall down
+ // into the trailing marker.
EXPECT_EQ(BB.getTrailingDbgRecords(), nullptr);
Instr2->removeFromParent();
EXPECT_TRUE(BB.empty());
@@ -204,35 +204,35 @@ TEST(BasicBlockDbgInfoTest, MarkerOperations) {
EXPECT_EQ(EndMarker->StoredDbgRecords.size(), 2u);
// Again, these should arrive in the correct order.
- DPVs.clear();
- for (DbgRecord &DPV : EndMarker->getDbgRecordRange())
- DPVs.push_back(&DPV);
- EXPECT_EQ(DPVs[0], DPV1);
- EXPECT_EQ(DPVs[1], DPV2);
+ DVRs.clear();
+ for (DbgRecord &DVR : EndMarker->getDbgRecordRange())
+ DVRs.push_back(&DVR);
+ EXPECT_EQ(DVRs[0], DVR1);
+ EXPECT_EQ(DVRs[1], DVR2);
// Inserting a normal instruction at the beginning: shouldn't dislodge the
- // DPValues. It's intended to not go at the start.
+ // DbgVariableRecords. It's intended to not go at the start.
Instr1->insertBefore(BB, BB.begin());
EXPECT_EQ(EndMarker->StoredDbgRecords.size(), 2u);
Instr1->removeFromParent();
- // Inserting at end(): should dislodge the DPValues, if they were dbg.values
- // then they would sit "above" the new instruction.
+ // Inserting at end(): should dislodge the DbgVariableRecords, if they were
+ // dbg.values then they would sit "above" the new instruction.
Instr1->insertBefore(BB, BB.end());
EXPECT_EQ(Instr1->DbgMarker->StoredDbgRecords.size(), 2u);
// We should de-allocate the trailing marker when something is inserted
// at end().
EXPECT_EQ(BB.getTrailingDbgRecords(), nullptr);
- // Remove Instr1: now the DPValues will fall down again,
+ // Remove Instr1: now the DbgVariableRecords will fall down again,
Instr1->removeFromParent();
EndMarker = BB.getTrailingDbgRecords();
EXPECT_EQ(EndMarker->StoredDbgRecords.size(), 2u);
// Inserting a terminator, however it's intended, should dislodge the
- // trailing DPValues, as it's the clear intention of the caller that this be
- // the final instr in the block, and DPValues aren't allowed to live off the
- // end forever.
+ // trailing DbgVariableRecords, as it's the clear intention of the caller that
+ // this be the final instr in the block, and DbgVariableRecords aren't allowed
+ // to live off the end forever.
Instr2->insertBefore(BB, BB.begin());
EXPECT_EQ(Instr2->DbgMarker->StoredDbgRecords.size(), 2u);
EXPECT_EQ(BB.getTrailingDbgRecords(), nullptr);
@@ -300,29 +300,30 @@ TEST(BasicBlockDbgInfoTest, HeadBitOperations) {
ASSERT_TRUE(CInst->DbgMarker);
EXPECT_FALSE(CInst->DbgMarker->StoredDbgRecords.empty());
- // If we move "c" to the start of the block, just normally, then the DPValues
- // should fall down to "d".
+ // If we move "c" to the start of the block, just normally, then the
+ // DbgVariableRecords should fall down to "d".
CInst->moveBefore(BB, BeginIt2);
EXPECT_TRUE(!CInst->DbgMarker || CInst->DbgMarker->StoredDbgRecords.empty());
ASSERT_TRUE(DInst->DbgMarker);
EXPECT_FALSE(DInst->DbgMarker->StoredDbgRecords.empty());
// Wheras if we move D to the start of the block with moveBeforePreserving,
- // the DPValues should move with it.
+ // the DbgVariableRecords should move with it.
DInst->moveBeforePreserving(BB, BB.begin());
EXPECT_FALSE(DInst->DbgMarker->StoredDbgRecords.empty());
EXPECT_EQ(&*BB.begin(), DInst);
- // Similarly, moveAfterPreserving "D" to "C" should move DPValues with "D".
+ // Similarly, moveAfterPreserving "D" to "C" should move DbgVariableRecords
+ // with "D".
DInst->moveAfterPreserving(CInst);
EXPECT_FALSE(DInst->DbgMarker->StoredDbgRecords.empty());
// (move back to the start...)
DInst->moveBeforePreserving(BB, BB.begin());
- // Current order of insts: "D -> C -> B -> Ret". DPValues on "D".
+ // Current order of insts: "D -> C -> B -> Ret". DbgVariableRecords on "D".
// If we move "C" to the beginning of the block, it should go before the
- // DPValues. They'll stay on "D".
+ // DbgVariableRecords. They'll stay on "D".
CInst->moveBefore(BB, BB.begin());
EXPECT_TRUE(!CInst->DbgMarker || CInst->DbgMarker->StoredDbgRecords.empty());
EXPECT_FALSE(DInst->DbgMarker->StoredDbgRecords.empty());
@@ -333,14 +334,14 @@ TEST(BasicBlockDbgInfoTest, HeadBitOperations) {
CInst->moveBefore(BInst);
EXPECT_EQ(&*BB.begin(), DInst);
- // Current order of insts: "D -> C -> B -> Ret". DPValues on "D".
+ // Current order of insts: "D -> C -> B -> Ret". DbgVariableRecords on "D".
// Now move CInst to the position of DInst, but using getIterator instead of
// BasicBlock::begin. This signals that we want the "C" instruction to be
- // immediately before "D", with any DPValues on "D" now moving to "C".
- // It's the equivalent of moving an instruction to the position between a
+ // immediately before "D", with any DbgVariableRecords on "D" now moving to
+ // "C". It's the equivalent of moving an instruction to the position between a
// run of dbg.values and the next instruction.
CInst->moveBefore(BB, DInst->getIterator());
- // CInst gains the DPValues.
+ // CInst gains the DbgVariableRecords.
EXPECT_TRUE(!DInst->DbgMarker || DInst->DbgMarker->StoredDbgRecords.empty());
EXPECT_FALSE(CInst->DbgMarker->StoredDbgRecords.empty());
EXPECT_EQ(&*BB.begin(), CInst);
@@ -378,8 +379,8 @@ TEST(BasicBlockDbgInfoTest, InstrDbgAccess) {
!11 = !DILocation(line: 1, column: 1, scope: !6)
)");
- // Check that DPValues can be accessed from Instructions without digging
- // into the depths of DPMarkers.
+ // Check that DbgVariableRecords can be accessed from Instructions without
+ // digging into the depths of DPMarkers.
BasicBlock &BB = M->getFunction("f")->getEntryBlock();
// Convert the module to "new" form debug-info.
M->convertToNewDbgValues();
@@ -391,25 +392,25 @@ TEST(BasicBlockDbgInfoTest, InstrDbgAccess) {
ASSERT_FALSE(BInst->DbgMarker);
ASSERT_TRUE(CInst->DbgMarker);
ASSERT_EQ(CInst->DbgMarker->StoredDbgRecords.size(), 1u);
- DbgRecord *DPV1 = &*CInst->DbgMarker->StoredDbgRecords.begin();
- ASSERT_TRUE(DPV1);
+ DbgRecord *DVR1 = &*CInst->DbgMarker->StoredDbgRecords.begin();
+ ASSERT_TRUE(DVR1);
EXPECT_FALSE(BInst->hasDbgRecords());
- // Clone DPValues from one inst to another. Other arguments to clone are
- // tested in DPMarker test.
+ // Clone DbgVariableRecords from one inst to another. Other arguments to clone
+ // are tested in DPMarker test.
auto Range1 = BInst->cloneDebugInfoFrom(CInst);
EXPECT_EQ(BInst->DbgMarker->StoredDbgRecords.size(), 1u);
- DbgRecord *DPV2 = &*BInst->DbgMarker->StoredDbgRecords.begin();
+ DbgRecord *DVR2 = &*BInst->DbgMarker->StoredDbgRecords.begin();
EXPECT_EQ(std::distance(Range1.begin(), Range1.end()), 1u);
- EXPECT_EQ(&*Range1.begin(), DPV2);
- EXPECT_NE(DPV1, DPV2);
+ EXPECT_EQ(&*Range1.begin(), DVR2);
+ EXPECT_NE(DVR1, DVR2);
// We should be able to get a range over exactly the same information.
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,
+ // We should be able to query if there are DbgVariableRecords,
EXPECT_TRUE(BInst->hasDbgRecords());
EXPECT_TRUE(CInst->hasDbgRecords());
EXPECT_FALSE(DInst->hasDbgRecords());
@@ -419,8 +420,8 @@ TEST(BasicBlockDbgInfoTest, InstrDbgAccess) {
EXPECT_FALSE(BInst->hasDbgRecords());
EXPECT_EQ(BInst->DbgMarker->StoredDbgRecords.size(), 0u);
- // And we should be able to drop individual DPValues.
- CInst->dropOneDbgRecord(DPV1);
+ // And we should be able to drop individual DbgVariableRecords.
+ CInst->dropOneDbgRecord(DVR1);
EXPECT_FALSE(CInst->hasDbgRecords());
EXPECT_EQ(CInst->DbgMarker->StoredDbgRecords.size(), 0u);
@@ -514,7 +515,7 @@ class DbgSpliceTest : public ::testing::Test {
BasicBlock *BBEntry, *BBExit;
BasicBlock::iterator Dest, First, Last;
Instruction *BInst, *Branch, *CInst;
- DPValue *DPVA, *DPVB, *DPVConst;
+ DbgVariableRecord *DVRA, *DVRB, *DVRConst;
void SetUp() override {
UseNewDbgInfoFormat = true;
@@ -531,18 +532,21 @@ class DbgSpliceTest : public ::testing::Test {
Branch = &*Last;
CInst = &*Dest;
- DPVA = cast<DPValue>(&*BInst->DbgMarker->StoredDbgRecords.begin());
- DPVB = cast<DPValue>(&*Branch->DbgMarker->StoredDbgRecords.begin());
- DPVConst = cast<DPValue>(&*CInst->DbgMarker->StoredDbgRecords.begin());
+ DVRA =
+ cast<DbgVariableRecord>(&*BInst->DbgMarker->StoredDbgRecords.begin());
+ DVRB =
+ cast<DbgVariableRecord>(&*Branch->DbgMarker->StoredDbgRecords.begin());
+ DVRConst =
+ cast<DbgVariableRecord>(&*CInst->DbgMarker->StoredDbgRecords.begin());
}
void TearDown() override { UseNewDbgInfoFormat = false; }
- bool InstContainsDPValue(Instruction *I, DPValue *DPV) {
+ bool InstContainsDbgVariableRecord(Instruction *I, DbgVariableRecord *DVR) {
for (DbgRecord &D : I->getDbgRecordRange()) {
- if (&D == DPV) {
+ if (&D == DVR) {
// Confirm too that the links between the records are correct.
- EXPECT_EQ(DPV->Marker, I->DbgMarker);
+ EXPECT_EQ(DVR->Marker, I->DbgMarker);
EXPECT_EQ(I->DbgMarker->MarkedInstr, I);
return true;
}
@@ -550,7 +554,8 @@ class DbgSpliceTest : public ::testing::Test {
return false;
}
- bool CheckDPVOrder(Instruction *I, SmallVector<DPValue *> CheckVals) {
+ bool CheckDVROrder(Instruction *I,
+ SmallVector<DbgVariableRecord *> CheckVals) {
SmallVector<DbgRecord *> Vals;
for (DbgRecord &D : I->getDbgRecordRange())
Vals.push_back(&D);
@@ -578,15 +583,15 @@ TEST_F(DbgSpliceTest, DbgSpliceTest0) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from First, not including leading dbg.value, to Last, including the
@@ -595,15 +600,14 @@ Dest %c = add i16 %b, 1, !dbg !11
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0, !dbg !11
}
@@ -613,14 +617,14 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(CInst->getParent(), BBExit);
EXPECT_EQ(Branch->getParent(), BBEntry);
- // DPVB: should be on Dest, in exit block.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVB));
+ // DVRB: should be on Dest, in exit block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRB));
- // DPVA, should have "fallen" onto the branch, remained in entry block.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVA));
+ // DVRA, should have "fallen" onto the branch, remained in entry block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRA));
- // DPVConst should be on the moved %b instruction.
- EXPECT_TRUE(InstContainsDPValue(BInst, DPVConst));
+ // DVRConst should be on the moved %b instruction.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(BInst, DVRConst));
}
TEST_F(DbgSpliceTest, DbgSpliceTest1) {
@@ -631,15 +635,15 @@ TEST_F(DbgSpliceTest, DbgSpliceTest1) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from First, not including leading dbg.value, to Last, including the
@@ -648,15 +652,15 @@ Dest %c = add i16 %b, 1, !dbg !11
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 Last br label %exit, !dbg !11
BBExit exit:
First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata
+!DIExpression()), !dbg !11 DVRConst call void @llvm.dbg.value(metadata i16 0,
+metadata !9, metadata !DIExpression()), !dbg !11 Dest %c = add i16 %b, 1,
+!dbg !11 ret i16 0, !dbg !11
}
@@ -666,17 +670,17 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(CInst->getParent(), BBExit);
EXPECT_EQ(Branch->getParent(), BBEntry);
- // DPVB: should be on CInst, in exit block.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVB));
+ // DVRB: should be on CInst, in exit block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRB));
- // DPVA, should have "fallen" onto the branch, remained in entry block.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVA));
+ // DVRA, should have "fallen" onto the branch, remained in entry block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRA));
- // DPVConst should be behind / after the moved instructions, remain on CInst.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVConst));
+ // DVRConst should be behind / after the moved instructions, remain on CInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRConst));
- // Order of DPVB and DPVConst should be thus:
- EXPECT_TRUE(CheckDPVOrder(CInst, {DPVB, DPVConst}));
+ // Order of DVRB and DVRConst should be thus:
+ EXPECT_TRUE(CheckDVROrder(CInst, {DVRB, DVRConst}));
}
TEST_F(DbgSpliceTest, DbgSpliceTest2) {
@@ -687,15 +691,15 @@ TEST_F(DbgSpliceTest, DbgSpliceTest2) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from head of First, which includes the leading dbg.value, to Last,
@@ -707,12 +711,12 @@ BBEntry entry:
Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 DVRA call void @llvm.dbg.value(metadata i16 %a,
+metadata !9, metadata !DIExpression()), !dbg !11 First %b = add i16 %a, 1,
+!dbg !11 DVRB call void @llvm.dbg.value(metadata i16 %b, metadata !9,
+metadata !DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret
+i16 0, !dbg !11
}
@@ -721,18 +725,18 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(BInst->getParent(), BBExit);
EXPECT_EQ(CInst->getParent(), BBExit);
- // DPVB: should be on CInst, in exit block.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVB));
+ // DVRB: should be on CInst, in exit block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRB));
- // DPVA, should have transferred with the spliced instructions, remains on
+ // DVRA, should have transferred with the spliced instructions, remains on
// the "b" inst.
- EXPECT_TRUE(InstContainsDPValue(BInst, DPVA));
+ EXPECT_TRUE(InstContainsDbgVariableRecord(BInst, DVRA));
- // DPVConst should be ahead of the moved instructions, ahead of BInst.
- EXPECT_TRUE(InstContainsDPValue(BInst, DPVConst));
+ // DVRConst should be ahead of the moved instructions, ahead of BInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(BInst, DVRConst));
- // Order of DPVA and DPVConst should be thus:
- EXPECT_TRUE(CheckDPVOrder(BInst, {DPVConst, DPVA}));
+ // Order of DVRA and DVRConst should be thus:
+ EXPECT_TRUE(CheckDVROrder(BInst, {DVRConst, DVRA}));
}
TEST_F(DbgSpliceTest, DbgSpliceTest3) {
@@ -743,15 +747,15 @@ TEST_F(DbgSpliceTest, DbgSpliceTest3) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from head of First, which includes the leading dbg.value, to Last,
@@ -763,12 +767,12 @@ BBEntry entry:
Last br label %exit, !dbg !11
BBExit exit:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9,
+metadata !DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret
+i16 0, !dbg !11
}
*/
@@ -776,18 +780,18 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(BInst->getParent(), BBExit);
EXPECT_EQ(CInst->getParent(), BBExit);
- // DPVB: should be on CInst, in exit block.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVB));
+ // DVRB: should be on CInst, in exit block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRB));
- // DPVA, should have transferred with the spliced instructions, remains on
+ // DVRA, should have transferred with the spliced instructions, remains on
// the "b" inst.
- EXPECT_TRUE(InstContainsDPValue(BInst, DPVA));
+ EXPECT_TRUE(InstContainsDbgVariableRecord(BInst, DVRA));
- // DPVConst should be behind the moved instructions, ahead of CInst.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVConst));
+ // DVRConst should be behind the moved instructions, ahead of CInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRConst));
- // Order of DPVB and DPVConst should be thus:
- EXPECT_TRUE(CheckDPVOrder(CInst, {DPVB, DPVConst}));
+ // Order of DVRB and DVRConst should be thus:
+ EXPECT_TRUE(CheckDVROrder(CInst, {DVRB, DVRConst}));
}
TEST_F(DbgSpliceTest, DbgSpliceTest4) {
@@ -798,15 +802,15 @@ TEST_F(DbgSpliceTest, DbgSpliceTest4) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from First, not including the leading dbg.value, to Last, but NOT
@@ -815,15 +819,15 @@ Dest %c = add i16 %b, 1, !dbg !11
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 DVRB call void @llvm.dbg.value(metadata i16 %b,
+metadata !9, metadata !DIExpression()), !dbg !11 Last br label %exit, !dbg
+!11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 Dest %c =
+add i16 %b, 1, !dbg !11 ret i16 0, !dbg !11
}
*/
@@ -832,17 +836,17 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(CInst->getParent(), BBExit);
EXPECT_EQ(Branch->getParent(), BBEntry);
- // DPVB: should be on Branch as before, remain in entry block.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVB));
+ // DVRB: should be on Branch as before, remain in entry block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRB));
- // DPVA, should have remained in entry block, falls onto Branch inst.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVA));
+ // DVRA, should have remained in entry block, falls onto Branch inst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRA));
- // DPVConst should be ahead of the moved instructions, BInst.
- EXPECT_TRUE(InstContainsDPValue(BInst, DPVConst));
+ // DVRConst should be ahead of the moved instructions, BInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(BInst, DVRConst));
- // Order of DPVA and DPVA should be thus:
- EXPECT_TRUE(CheckDPVOrder(Branch, {DPVA, DPVB}));
+ // Order of DVRA and DVRA should be thus:
+ EXPECT_TRUE(CheckDVROrder(Branch, {DVRA, DVRB}));
}
TEST_F(DbgSpliceTest, DbgSpliceTest5) {
@@ -853,15 +857,15 @@ TEST_F(DbgSpliceTest, DbgSpliceTest5) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from First, not including the leading dbg.value, to Last, but NOT
@@ -870,15 +874,16 @@ Dest %c = add i16 %b, 1, !dbg !11
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 DVRB call void @llvm.dbg.value(metadata i16 %b,
+metadata !9, metadata !DIExpression()), !dbg !11 Last br label %exit, !dbg
+!11
BBExit exit:
First %b = add i16 %a, 1, !dbg !11
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
*/
@@ -887,17 +892,17 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(CInst->getParent(), BBExit);
EXPECT_EQ(Branch->getParent(), BBEntry);
- // DPVB: should be on Branch as before, remain in entry block.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVB));
+ // DVRB: should be on Branch as before, remain in entry block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRB));
- // DPVA, should have remained in entry block, falls onto Branch inst.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVA));
+ // DVRA, should have remained in entry block, falls onto Branch inst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRA));
- // DPVConst should be behind of the moved instructions, on CInst.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVConst));
+ // DVRConst should be behind of the moved instructions, on CInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRConst));
- // Order of DPVA and DPVB should be thus:
- EXPECT_TRUE(CheckDPVOrder(Branch, {DPVA, DPVB}));
+ // Order of DVRA and DVRB should be thus:
+ EXPECT_TRUE(CheckDVROrder(Branch, {DVRA, DVRB}));
}
TEST_F(DbgSpliceTest, DbgSpliceTest6) {
@@ -908,15 +913,15 @@ TEST_F(DbgSpliceTest, DbgSpliceTest6) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from First, including the leading dbg.value, to Last, but NOT
@@ -925,15 +930,14 @@ Dest %c = add i16 %b, 1, !dbg !11
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata
+!DIExpression()), !dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 DVRA call void @llvm.dbg.value(metadata i16 %a,
+metadata !9, metadata !DIExpression()), !dbg !11 First %b = add i16 %a, 1,
+!dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0, !dbg !11
}
*/
@@ -942,17 +946,17 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(CInst->getParent(), BBExit);
EXPECT_EQ(Branch->getParent(), BBEntry);
- // DPVB: should be on Branch as before, remain in entry block.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVB));
+ // DVRB: should be on Branch as before, remain in entry block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRB));
- // DPVA, should have transferred to BBExit, on B inst.
- EXPECT_TRUE(InstContainsDPValue(BInst, DPVA));
+ // DVRA, should have transferred to BBExit, on B inst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(BInst, DVRA));
- // DPVConst should be ahead of the moved instructions, on BInst.
- EXPECT_TRUE(InstContainsDPValue(BInst, DPVConst));
+ // DVRConst should be ahead of the moved instructions, on BInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(BInst, DVRConst));
- // Order of DPVA and DPVConst should be thus:
- EXPECT_TRUE(CheckDPVOrder(BInst, {DPVConst, DPVA}));
+ // Order of DVRA and DVRConst should be thus:
+ EXPECT_TRUE(CheckDVROrder(BInst, {DVRConst, DVRA}));
}
TEST_F(DbgSpliceTest, DbgSpliceTest7) {
@@ -963,15 +967,15 @@ TEST_F(DbgSpliceTest, DbgSpliceTest7) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from First, including the leading dbg.value, to Last, but NOT
@@ -980,15 +984,14 @@ Dest %c = add i16 %b, 1, !dbg !11
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata
+!DIExpression()), !dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRConst call
+void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()),
+!dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0, !dbg !11
}
*/
@@ -997,21 +1000,21 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(CInst->getParent(), BBExit);
EXPECT_EQ(Branch->getParent(), BBEntry);
- // DPVB: should be on Branch as before, remain in entry block.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVB));
+ // DVRB: should be on Branch as before, remain in entry block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRB));
- // DPVA, should have transferred to BBExit, on B inst.
- EXPECT_TRUE(InstContainsDPValue(BInst, DPVA));
+ // DVRA, should have transferred to BBExit, on B inst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(BInst, DVRA));
- // DPVConst should be after of the moved instructions, on CInst.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVConst));
+ // DVRConst should be after of the moved instructions, on CInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRConst));
}
// But wait, there's more! What if you splice a range that is empty, but
// implicitly contains debug-info? In the dbg.value design for debug-info,
-// this would be an explicit range, but in DPValue debug-info, it isn't.
-// Check that if we try to do that, with differing head-bit values, that
-// DPValues are transferred.
+// this would be an explicit range, but in DbgVariableRecord debug-info, it
+// isn't. Check that if we try to do that, with differing head-bit values, that
+// DbgVariableRecords are transferred.
// Test with empty transfers to Dest, with head bit set and not set.
TEST_F(DbgSpliceTest, DbgSpliceEmpty0) {
@@ -1021,31 +1024,31 @@ TEST_F(DbgSpliceTest, DbgSpliceEmpty0) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from BBEntry.getFirstInsertionPt to First -- this implicitly is a
- splice of DPVA, but the iterators are pointing at the same instruction. The
+ splice of DVRA, but the iterators are pointing at the same instruction. The
only difference is the setting of the head bit. Becomes;
define i16 @f(i16 %a) !dbg !6 {
First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata
+!DIExpression()), !dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 DVRA call void @llvm.dbg.value(metadata i16 %a,
+metadata !9, metadata !DIExpression()), !dbg !11 Dest %c = add i16 %b, 1,
+!dbg !11 ret i16 0, !dbg !11
}
*/
@@ -1054,17 +1057,17 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(CInst->getParent(), BBExit);
EXPECT_EQ(Branch->getParent(), BBEntry);
- // DPVB: should be on Branch as before, remain in entry block.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVB));
+ // DVRB: should be on Branch as before, remain in entry block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRB));
- // DPVA, should have transferred to BBExit, on C inst.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVA));
+ // DVRA, should have transferred to BBExit, on C inst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRA));
- // DPVConst should be ahead of the moved DPValue, on CInst.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVConst));
+ // DVRConst should be ahead of the moved DbgVariableRecord, on CInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRConst));
- // Order of DPVA and DPVConst should be thus:
- EXPECT_TRUE(CheckDPVOrder(CInst, {DPVConst, DPVA}));
+ // Order of DVRA and DVRConst should be thus:
+ EXPECT_TRUE(CheckDVROrder(CInst, {DVRConst, DVRA}));
}
TEST_F(DbgSpliceTest, DbgSpliceEmpty1) {
@@ -1074,32 +1077,32 @@ TEST_F(DbgSpliceTest, DbgSpliceEmpty1) {
/*
define i16 @f(i16 %a) !dbg !6 {
BBEntry entry:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 First %b = add i16 %a, 1, !dbg !11 DVRB call
+void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()),
+!dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata
+!DIExpression()), !dbg !11 Dest %c = add i16 %b, 1, !dbg !11 ret i16 0,
+!dbg !11
}
Splice from BBEntry.getFirstInsertionPt to First -- this implicitly is a
- splice of DPVA, but the iterators are pointing at the same instruction. The
+ splice of DVRA, but the iterators are pointing at the same instruction. The
only difference is the setting of the head bit. Insert at head of Dest,
- i.e. before DPVConst. Becomes;
+ i.e. before DVRConst. Becomes;
define i16 @f(i16 %a) !dbg !6 {
First %b = add i16 %a, 1, !dbg !11
-DPVB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata !DIExpression()), !dbg !11
-Last br label %exit, !dbg !11
+DVRB call void @llvm.dbg.value(metadata i16 %b, metadata !9, metadata
+!DIExpression()), !dbg !11 Last br label %exit, !dbg !11
BBExit exit:
-DPVA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata !DIExpression()), !dbg !11
-DPVConst call void @llvm.dbg.value(metadata i16 0, metadata !9, metadata !DIExpression()), !dbg !11
-Dest %c = add i16 %b, 1, !dbg !11
- ret i16 0, !dbg !11
+DVRA call void @llvm.dbg.value(metadata i16 %a, metadata !9, metadata
+!DIExpression()), !dbg !11 DVRConst call void @llvm.dbg.value(metadata i16 0,
+metadata !9, metadata !DIExpression()), !dbg !11 Dest %c = add i16 %b, 1,
+!dbg !11 ret i16 0, !dbg !11
}
*/
@@ -1108,21 +1111,21 @@ Dest %c = add i16 %b, 1, !dbg !11
EXPECT_EQ(CInst->getParent(), BBExit);
EXPECT_EQ(Branch->getParent(), BBEntry);
- // DPVB: should be on Branch as before, remain in entry block.
- EXPECT_TRUE(InstContainsDPValue(Branch, DPVB));
+ // DVRB: should be on Branch as before, remain in entry block.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(Branch, DVRB));
- // DPVA, should have transferred to BBExit, on C inst.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVA));
+ // DVRA, should have transferred to BBExit, on C inst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRA));
- // DPVConst should be ahead of the moved DPValue, on CInst.
- EXPECT_TRUE(InstContainsDPValue(CInst, DPVConst));
+ // DVRConst should be ahead of the moved DbgVariableRecord, on CInst.
+ EXPECT_TRUE(InstContainsDbgVariableRecord(CInst, DVRConst));
- // Order of DPVA and DPVConst should be thus:
- EXPECT_TRUE(CheckDPVOrder(CInst, {DPVA, DPVConst}));
+ // Order of DVRA and DVRConst should be thus:
+ EXPECT_TRUE(CheckDVROrder(CInst, {DVRA, DVRConst}));
}
-// If we splice new instructions into a block with trailing DPValues, then
-// the trailing DPValues should get flushed back out.
+// If we splice new instructions into a block with trailing DbgVariableRecords,
+// then the trailing DbgVariableRecords should get flushed back out.
TEST(BasicBlockDbgInfoTest, DbgSpliceTrailing) {
LLVMContext C;
UseNewDbgInfoFormat = true;
@@ -1159,7 +1162,7 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceTrailing) {
BasicBlock &Exit = *Entry.getNextNode();
M->convertToNewDbgValues();
- // Begin by forcing entry block to have dangling DPValue.
+ // Begin by forcing entry block to have dangling DbgVariableRecord.
Entry.getTerminator()->eraseFromParent();
ASSERT_NE(Entry.getTrailingDbgRecords(), nullptr);
EXPECT_TRUE(Entry.empty());
@@ -1167,8 +1170,8 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceTrailing) {
// Now transfer the entire contents of the exit block into the entry.
Entry.splice(Entry.end(), &Exit, Exit.begin(), Exit.end());
- // The trailing DPValue should have been placed at the front of what's been
- // spliced in.
+ // The trailing DbgVariableRecord should have been placed at the front of
+ // what's been spliced in.
Instruction *BInst = &*Entry.begin();
ASSERT_TRUE(BInst->DbgMarker);
EXPECT_EQ(BInst->DbgMarker->StoredDbgRecords.size(), 1u);
@@ -1176,10 +1179,10 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceTrailing) {
UseNewDbgInfoFormat = false;
}
-// When we remove instructions from the program, adjacent DPValues coalesce
-// together into one DPMarker. In "old" dbg.value mode you could re-insert
-// the removed instruction back into the middle of a sequence of dbg.values.
-// Test that this can be replicated correctly by DPValues
+// When we remove instructions from the program, adjacent DbgVariableRecords
+// coalesce together into one DPMarker. In "old" dbg.value mode you could
+// re-insert the removed instruction back into the middle of a sequence of
+// dbg.values. Test that this can be replicated correctly by DbgVariableRecords
TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsert) {
LLVMContext C;
UseNewDbgInfoFormat = true;
@@ -1221,7 +1224,7 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsert) {
Instruction *RetInst = AddInst->getNextNode();
ASSERT_TRUE(isa<ReturnInst>(RetInst));
- // add and sub should both have one DPValue on add and ret.
+ // add and sub should both have one DbgVariableRecord on add and ret.
EXPECT_FALSE(SubInst->hasDbgRecords());
EXPECT_TRUE(AddInst->hasDbgRecords());
EXPECT_TRUE(RetInst->hasDbgRecords());
@@ -1232,20 +1235,21 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsert) {
// The Supported (TM) code sequence for removing then reinserting insts
// after another instruction:
- std::optional<DPValue::self_iterator> Pos =
+ std::optional<DbgVariableRecord::self_iterator> Pos =
AddInst->getDbgReinsertionPosition();
AddInst->removeFromParent();
// We should have a re-insertion position.
ASSERT_TRUE(Pos);
- // Both DPValues should now be attached to the ret inst.
+ // Both DbgVariableRecords should now be attached to the ret inst.
auto R3 = RetInst->getDbgRecordRange();
EXPECT_EQ(std::distance(R3.begin(), R3.end()), 2u);
// Re-insert and re-insert.
AddInst->insertAfter(SubInst);
Entry.reinsertInstInDbgRecords(AddInst, Pos);
- // We should be back into a position of having one DPValue on add and ret.
+ // We should be back into a position of having one DbgVariableRecord on add
+ // and ret.
EXPECT_FALSE(SubInst->hasDbgRecords());
EXPECT_TRUE(AddInst->hasDbgRecords());
EXPECT_TRUE(RetInst->hasDbgRecords());
@@ -1257,9 +1261,9 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsert) {
UseNewDbgInfoFormat = false;
}
-// Test instruction removal and re-insertion, this time with one DPValue that
-// should hop up one instruction.
-TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsertForOneDPValue) {
+// Test instruction removal and re-insertion, this time with one
+// DbgVariableRecord that should hop up one instruction.
+TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsertForOneDbgVariableRecord) {
LLVMContext C;
UseNewDbgInfoFormat = true;
@@ -1299,7 +1303,7 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsertForOneDPValue) {
Instruction *RetInst = AddInst->getNextNode();
ASSERT_TRUE(isa<ReturnInst>(RetInst));
- // There should be one DPValue.
+ // There should be one DbgVariableRecord.
EXPECT_FALSE(SubInst->hasDbgRecords());
EXPECT_TRUE(AddInst->hasDbgRecords());
EXPECT_FALSE(RetInst->hasDbgRecords());
@@ -1307,13 +1311,13 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsertForOneDPValue) {
EXPECT_EQ(std::distance(R1.begin(), R1.end()), 1u);
// The Supported (TM) code sequence for removing then reinserting insts:
- std::optional<DPValue::self_iterator> Pos =
+ std::optional<DbgVariableRecord::self_iterator> Pos =
AddInst->getDbgReinsertionPosition();
AddInst->removeFromParent();
- // No re-insertion position as there were no DPValues on the ret.
+ // No re-insertion position as there were no DbgVariableRecords on the ret.
ASSERT_FALSE(Pos);
- // The single DPValue should now be attached to the ret inst.
+ // The single DbgVariableRecord should now be attached to the ret inst.
EXPECT_TRUE(RetInst->hasDbgRecords());
auto R2 = RetInst->getDbgRecordRange();
EXPECT_EQ(std::distance(R2.begin(), R2.end()), 1u);
@@ -1321,7 +1325,8 @@ TEST(BasicBlockDbgInfoTest, RemoveInstAndReinsertForOneDPValue) {
// Re-insert and re-insert.
AddInst->insertAfter(SubInst);
Entry.reinsertInstInDbgRecords(AddInst, Pos);
- // We should be back into a position of having one DPValue on the AddInst.
+ // We should be back into a position of having one DbgVariableRecord on the
+ // AddInst.
EXPECT_FALSE(SubInst->hasDbgRecords());
EXPECT_TRUE(AddInst->hasDbgRecords());
EXPECT_FALSE(RetInst->hasDbgRecords());
@@ -1374,7 +1379,7 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty1) {
BasicBlock &Exit = *Entry.getNextNode();
M->convertToNewDbgValues();
- // Begin by forcing entry block to have dangling DPValue.
+ // Begin by forcing entry block to have dangling DbgVariableRecord.
Entry.getTerminator()->eraseFromParent();
ASSERT_NE(Entry.getTrailingDbgRecords(), nullptr);
EXPECT_TRUE(Entry.empty());
@@ -1388,16 +1393,16 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty1) {
Instruction *BInst = &*Entry.begin();
ASSERT_TRUE(BInst->hasDbgRecords());
EXPECT_EQ(BInst->DbgMarker->StoredDbgRecords.size(), 2u);
- SmallVector<DPValue *, 2> DPValues;
- for (DbgRecord &DPV : BInst->getDbgRecordRange())
- DPValues.push_back(cast<DPValue>(&DPV));
+ SmallVector<DbgVariableRecord *, 2> DbgVariableRecords;
+ for (DbgRecord &DVR : BInst->getDbgRecordRange())
+ DbgVariableRecords.push_back(cast<DbgVariableRecord>(&DVR));
- EXPECT_EQ(DPValues[0]->getVariableLocationOp(0), F.getArg(0));
- Value *SecondDPVValue = DPValues[1]->getVariableLocationOp(0);
- ASSERT_TRUE(isa<ConstantInt>(SecondDPVValue));
- EXPECT_EQ(cast<ConstantInt>(SecondDPVValue)->getZExtValue(), 0ull);
+ EXPECT_EQ(DbgVariableRecords[0]->getVariableLocationOp(0), F.getArg(0));
+ Value *SecondDVRValue = DbgVariableRecords[1]->getVariableLocationOp(0);
+ ASSERT_TRUE(isa<ConstantInt>(SecondDVRValue));
+ EXPECT_EQ(cast<ConstantInt>(SecondDVRValue)->getZExtValue(), 0ull);
- // No trailing DPValues in the entry block now.
+ // No trailing DbgVariableRecords in the entry block now.
EXPECT_EQ(Entry.getTrailingDbgRecords(), nullptr);
UseNewDbgInfoFormat = false;
@@ -1444,31 +1449,31 @@ TEST(BasicBlockDbgInfoTest, DbgSpliceToEmpty2) {
BasicBlock &Exit = *Entry.getNextNode();
M->convertToNewDbgValues();
- // Begin by forcing entry block to have dangling DPValue.
+ // Begin by forcing entry block to have dangling DbgVariableRecord.
Entry.getTerminator()->eraseFromParent();
ASSERT_NE(Entry.getTrailingDbgRecords(), nullptr);
EXPECT_TRUE(Entry.empty());
// Now transfer into the entry block -- fetching the first instruction with
// begin and then calling getIterator clears the "head" bit, meaning that the
- // range to move will not include any leading DPValues.
+ // range to move will not include any leading DbgVariableRecords.
Entry.splice(Entry.end(), &Exit, Exit.begin()->getIterator(), Exit.end());
// We should now have one dbg.values on the first instruction, %a.
Instruction *BInst = &*Entry.begin();
ASSERT_TRUE(BInst->hasDbgRecords());
EXPECT_EQ(BInst->DbgMarker->StoredDbgRecords.size(), 1u);
- SmallVector<DPValue *, 2> DPValues;
- for (DbgRecord &DPV : BInst->getDbgRecordRange())
- DPValues.push_back(cast<DPValue>(&DPV));
+ SmallVector<DbgVariableRecord *, 2> DbgVariableRecords;
+ for (DbgRecord &DVR : BInst->getDbgRecordRange())
+ DbgVariableRecords.push_back(cast<DbgVariableRecord>(&DVR));
- EXPECT_EQ(DPValues[0]->getVariableLocationOp(0), F.getArg(0));
- // No trailing DPValues in the entry block now.
+ EXPECT_EQ(DbgVariableRecords[0]->getVariableLocationOp(0), F.getArg(0));
+ // No trailing DbgVariableRecords in the entry block now.
EXPECT_EQ(Entry.getTrailingDbgRecords(), nullptr);
// We should have nothing left in the exit block...
EXPECT_TRUE(Exit.empty());
- // ... except for some dangling DPValues.
+ // ... except for some dangling DbgVariableRecords.
EXPECT_NE(Exit.getTrailingDbgRecords(), nullptr);
EXPECT_FALSE(Exit.getTrailingDbgRecords()->empty());
Exit.getTrailingDbgRecords()->eraseFromParent();
diff --git a/llvm/unittests/IR/DebugInfoTest.cpp b/llvm/unittests/IR/DebugInfoTest.cpp
index 55944b8949888b..3672f2bccfecd7 100644
--- a/llvm/unittests/IR/DebugInfoTest.cpp
+++ b/llvm/unittests/IR/DebugInfoTest.cpp
@@ -234,8 +234,8 @@ TEST(DbgVariableIntrinsic, EmptyMDIsKillLocation) {
EXPECT_TRUE(DbgDeclare->isKillLocation());
}
-// Duplicate of above test, but in DPValue representation.
-TEST(MetadataTest, DeleteInstUsedByDPValue) {
+// Duplicate of above test, but in DbgVariableRecord representation.
+TEST(MetadataTest, DeleteInstUsedByDbgVariableRecord) {
LLVMContext C;
std::unique_ptr<Module> M = parseIR(C, R"(
define i16 @f(i16 %a) !dbg !6 {
@@ -267,26 +267,26 @@ TEST(MetadataTest, DeleteInstUsedByDPValue) {
Instruction &I = *M->getFunction("f")->getEntryBlock().getFirstNonPHI();
M->convertToNewDbgValues();
- // Find the DPValues using %b.
+ // Find the DbgVariableRecords using %b.
SmallVector<DbgValueInst *, 2> DVIs;
- SmallVector<DPValue *, 2> DPVs;
- findDbgValues(DVIs, &I, &DPVs);
- ASSERT_EQ(DPVs.size(), 2u);
+ SmallVector<DbgVariableRecord *, 2> DVRs;
+ findDbgValues(DVIs, &I, &DVRs);
+ ASSERT_EQ(DVRs.size(), 2u);
- // Delete %b. The DPValue should now point to undef.
+ // Delete %b. The DbgVariableRecord should now point to undef.
I.eraseFromParent();
- EXPECT_EQ(DPVs[0]->getNumVariableLocationOps(), 1u);
- EXPECT_TRUE(isa<UndefValue>(DPVs[0]->getVariableLocationOp(0)));
- EXPECT_TRUE(DPVs[0]->isKillLocation());
- EXPECT_EQ(DPVs[1]->getNumVariableLocationOps(), 2u);
- EXPECT_TRUE(isa<UndefValue>(DPVs[1]->getVariableLocationOp(1)));
- EXPECT_TRUE(DPVs[1]->isKillLocation());
+ EXPECT_EQ(DVRs[0]->getNumVariableLocationOps(), 1u);
+ EXPECT_TRUE(isa<UndefValue>(DVRs[0]->getVariableLocationOp(0)));
+ EXPECT_TRUE(DVRs[0]->isKillLocation());
+ EXPECT_EQ(DVRs[1]->getNumVariableLocationOps(), 2u);
+ EXPECT_TRUE(isa<UndefValue>(DVRs[1]->getVariableLocationOp(1)));
+ EXPECT_TRUE(DVRs[1]->isKillLocation());
UseNewDbgInfoFormat = OldDbgValueMode;
}
// Ensure that the order of dbg.value intrinsics returned by findDbgValues, and
-// their corresponding DPValue representation, are consistent.
-TEST(MetadataTest, OrderingOfDPValues) {
+// their corresponding DbgVariableRecord representation, are consistent.
+TEST(MetadataTest, OrderingOfDbgVariableRecords) {
LLVMContext C;
std::unique_ptr<Module> M = parseIR(C, R"(
define i16 @f(i16 %a) !dbg !6 {
@@ -319,10 +319,10 @@ TEST(MetadataTest, OrderingOfDPValues) {
Instruction &I = *M->getFunction("f")->getEntryBlock().getFirstNonPHI();
SmallVector<DbgValueInst *, 2> DVIs;
- SmallVector<DPValue *, 2> DPVs;
- findDbgValues(DVIs, &I, &DPVs);
+ SmallVector<DbgVariableRecord *, 2> DVRs;
+ findDbgValues(DVIs, &I, &DVRs);
ASSERT_EQ(DVIs.size(), 2u);
- ASSERT_EQ(DPVs.size(), 0u);
+ ASSERT_EQ(DVRs.size(), 0u);
// The correct order of dbg.values is given by their use-list, which becomes
// the reverse order of creation. Thus the dbg.values should come out as
@@ -332,17 +332,17 @@ TEST(MetadataTest, OrderingOfDPValues) {
DILocalVariable *Var1 = DVIs[1]->getVariable();
EXPECT_TRUE(Var1->getName() == "foo");
- // Now try again, but in DPValue form.
+ // Now try again, but in DbgVariableRecord form.
DVIs.clear();
M->convertToNewDbgValues();
- findDbgValues(DVIs, &I, &DPVs);
+ findDbgValues(DVIs, &I, &DVRs);
ASSERT_EQ(DVIs.size(), 0u);
- ASSERT_EQ(DPVs.size(), 2u);
+ ASSERT_EQ(DVRs.size(), 2u);
- Var0 = DPVs[0]->getVariable();
+ Var0 = DVRs[0]->getVariable();
EXPECT_TRUE(Var0->getName() == "bar");
- Var1 = DPVs[1]->getVariable();
+ Var1 = DVRs[1]->getVariable();
EXPECT_TRUE(Var1->getName() == "foo");
M->convertFromNewDbgValues();
@@ -861,9 +861,9 @@ TEST(AssignmentTrackingTest, InstrMethods) {
}
}
-// Test some very straight-forward operations on DPValues -- these are
+// Test some very straight-forward operations on DbgVariableRecords -- these are
// dbg.values that have been converted to a non-instruction format.
-TEST(MetadataTest, ConvertDbgToDPValue) {
+TEST(MetadataTest, ConvertDbgToDbgVariableRecord) {
LLVMContext C;
std::unique_ptr<Module> M = parseIR(C, R"(
define i16 @f(i16 %a) !dbg !6 {
@@ -900,7 +900,7 @@ TEST(MetadataTest, ConvertDbgToDPValue) {
const DIExpression *Expr = nullptr;
const DILocation *Loc = nullptr;
const Metadata *MLoc = nullptr;
- DPValue *DPV1 = nullptr;
+ DbgVariableRecord *DVR1 = nullptr;
{
DbgValueInst *DPI = dyn_cast<DbgValueInst>(&I);
ASSERT_TRUE(DPI);
@@ -909,17 +909,18 @@ TEST(MetadataTest, ConvertDbgToDPValue) {
Loc = DPI->getDebugLoc().get();
MLoc = DPI->getRawLocation();
- // Test the creation of a DPValue and it's conversion back to a dbg.value.
- DPV1 = new DPValue(DPI);
- EXPECT_EQ(DPV1->getVariable(), Var);
- EXPECT_EQ(DPV1->getExpression(), Expr);
- EXPECT_EQ(DPV1->getDebugLoc().get(), Loc);
- EXPECT_EQ(DPV1->getRawLocation(), MLoc);
+ // Test the creation of a DbgVariableRecord and it's conversion back to a
+ // dbg.value.
+ DVR1 = new DbgVariableRecord(DPI);
+ EXPECT_EQ(DVR1->getVariable(), Var);
+ EXPECT_EQ(DVR1->getExpression(), Expr);
+ EXPECT_EQ(DVR1->getDebugLoc().get(), Loc);
+ EXPECT_EQ(DVR1->getRawLocation(), MLoc);
// Erase dbg.value,
DPI->eraseFromParent();
- // Re-create from DPV1, inserting at front.
- DPV1->createDebugIntrinsic(&*M,
+ // Re-create from DVR1, inserting at front.
+ DVR1->createDebugIntrinsic(&*M,
&M->getFunction("f")->getEntryBlock().front());
Instruction *NewDPI = &M->getFunction("f")->getEntryBlock().front();
@@ -931,17 +932,17 @@ TEST(MetadataTest, ConvertDbgToDPValue) {
EXPECT_EQ(DPI2->getRawLocation(), MLoc);
}
- // Fetch the second dbg.value, convert it to a DPValue,
+ // Fetch the second dbg.value, convert it to a DbgVariableRecord,
BasicBlock::iterator It = M->getFunction("f")->getEntryBlock().begin();
It = std::next(std::next(It));
DbgValueInst *DPI3 = dyn_cast<DbgValueInst>(It);
ASSERT_TRUE(DPI3);
- DPValue *DPV2 = new DPValue(DPI3);
+ DbgVariableRecord *DVR2 = new DbgVariableRecord(DPI3);
// These dbg.values are supposed to refer to different values.
- EXPECT_NE(DPV1->getRawLocation(), DPV2->getRawLocation());
+ EXPECT_NE(DVR1->getRawLocation(), DVR2->getRawLocation());
- // Try manipulating DPValues and markers in the exit block.
+ // Try manipulating DbgVariableRecords and markers in the exit block.
BasicBlock *ExitBlock = &*std::next(M->getFunction("f")->getEntryBlock().getIterator());
Instruction *FirstInst = &ExitBlock->front();
Instruction *RetInst = &*std::next(FirstInst->getIterator());
@@ -951,45 +952,48 @@ TEST(MetadataTest, ConvertDbgToDPValue) {
ExitBlock->createMarker(FirstInst);
ExitBlock->createMarker(RetInst);
- // Insert DbgRecords into markers, order should come out DPV2, DPV1.
- FirstInst->DbgMarker->insertDbgRecord(DPV1, false);
- FirstInst->DbgMarker->insertDbgRecord(DPV2, true);
+ // Insert DbgRecords into markers, order should come out DVR2, DVR1.
+ FirstInst->DbgMarker->insertDbgRecord(DVR1, false);
+ FirstInst->DbgMarker->insertDbgRecord(DVR2, true);
unsigned int ItCount = 0;
for (DbgRecord &Item : FirstInst->DbgMarker->getDbgRecordRange()) {
- EXPECT_TRUE((&Item == DPV2 && ItCount == 0) ||
- (&Item == DPV1 && ItCount == 1));
+ EXPECT_TRUE((&Item == DVR2 && ItCount == 0) ||
+ (&Item == DVR1 && ItCount == 1));
EXPECT_EQ(Item.getMarker(), FirstInst->DbgMarker);
++ItCount;
}
- // Clone them onto the second marker -- should allocate new DPVs.
+ // Clone them onto the second marker -- should allocate new DVRs.
RetInst->DbgMarker->cloneDebugInfoFrom(FirstInst->DbgMarker, std::nullopt, false);
EXPECT_EQ(RetInst->DbgMarker->StoredDbgRecords.size(), 2u);
ItCount = 0;
// Check these things store the same information; but that they're not the same
// objects.
- for (DPValue &Item : filterDbgVars(RetInst->DbgMarker->getDbgRecordRange())) {
- EXPECT_TRUE((Item.getRawLocation() == DPV2->getRawLocation() && ItCount == 0) ||
- (Item.getRawLocation() == DPV1->getRawLocation() && ItCount == 1));
+ for (DbgVariableRecord &Item :
+ filterDbgVars(RetInst->DbgMarker->getDbgRecordRange())) {
+ EXPECT_TRUE(
+ (Item.getRawLocation() == DVR2->getRawLocation() && ItCount == 0) ||
+ (Item.getRawLocation() == DVR1->getRawLocation() && ItCount == 1));
EXPECT_EQ(Item.getMarker(), RetInst->DbgMarker);
- EXPECT_NE(&Item, DPV1);
- EXPECT_NE(&Item, DPV2);
+ EXPECT_NE(&Item, DVR1);
+ EXPECT_NE(&Item, DVR2);
++ItCount;
}
RetInst->DbgMarker->dropDbgRecords();
EXPECT_EQ(RetInst->DbgMarker->StoredDbgRecords.size(), 0u);
- // Try cloning one single DPValue.
+ // Try cloning one single DbgVariableRecord.
auto DIIt = std::next(FirstInst->DbgMarker->getDbgRecordRange().begin());
RetInst->DbgMarker->cloneDebugInfoFrom(FirstInst->DbgMarker, DIIt, false);
EXPECT_EQ(RetInst->DbgMarker->StoredDbgRecords.size(), 1u);
- // The second DPValue should have been cloned; it should have the same values
- // as DPV1.
- EXPECT_EQ(cast<DPValue>(RetInst->DbgMarker->StoredDbgRecords.begin())
- ->getRawLocation(),
- DPV1->getRawLocation());
+ // The second DbgVariableRecord should have been cloned; it should have the
+ // same values as DVR1.
+ EXPECT_EQ(
+ cast<DbgVariableRecord>(RetInst->DbgMarker->StoredDbgRecords.begin())
+ ->getRawLocation(),
+ DVR1->getRawLocation());
// We should be able to drop individual DbgRecords.
RetInst->DbgMarker->dropOneDbgRecord(
&*RetInst->DbgMarker->StoredDbgRecords.begin());
@@ -998,19 +1002,19 @@ TEST(MetadataTest, ConvertDbgToDPValue) {
// to is disappearing so it needs to be transferred into "this" marker.
RetInst->DbgMarker->absorbDebugValues(*FirstInst->DbgMarker, true);
EXPECT_EQ(RetInst->DbgMarker->StoredDbgRecords.size(), 2u);
- // Should be the DPV1 and DPV2 objects.
+ // Should be the DVR1 and DVR2 objects.
ItCount = 0;
for (DbgRecord &Item : RetInst->DbgMarker->getDbgRecordRange()) {
- EXPECT_TRUE((&Item == DPV2 && ItCount == 0) ||
- (&Item == DPV1 && ItCount == 1));
+ EXPECT_TRUE((&Item == DVR2 && ItCount == 0) ||
+ (&Item == DVR1 && ItCount == 1));
EXPECT_EQ(Item.getMarker(), RetInst->DbgMarker);
++ItCount;
}
- // Finally -- there are two DPValues left over. If we remove evrything in the
- // basic block, then they should sink down into the "TrailingDbgRecords"
- // container for dangling debug-info. Future facilities will restore them
- // back when a terminator is inserted.
+ // Finally -- there are two DbgVariableRecords left over. If we remove
+ // evrything in the basic block, then they should sink down into the
+ // "TrailingDbgRecords" container for dangling debug-info. Future facilities
+ // will restore them back when a terminator is inserted.
FirstInst->DbgMarker->removeMarker();
FirstInst->eraseFromParent();
RetInst->DbgMarker->removeMarker();
@@ -1019,24 +1023,24 @@ TEST(MetadataTest, ConvertDbgToDPValue) {
DPMarker *EndMarker = ExitBlock->getTrailingDbgRecords();
ASSERT_NE(EndMarker, nullptr);
EXPECT_EQ(EndMarker->StoredDbgRecords.size(), 2u);
- // Test again that it's those two DPValues, DPV1 and DPV2.
+ // Test again that it's those two DbgVariableRecords, DVR1 and DVR2.
ItCount = 0;
for (DbgRecord &Item : EndMarker->getDbgRecordRange()) {
- EXPECT_TRUE((&Item == DPV2 && ItCount == 0) ||
- (&Item == DPV1 && ItCount == 1));
+ EXPECT_TRUE((&Item == DVR2 && ItCount == 0) ||
+ (&Item == DVR1 && ItCount == 1));
EXPECT_EQ(Item.getMarker(), EndMarker);
++ItCount;
}
- // Cleanup the trailing DPValue records and marker.
+ // Cleanup the trailing DbgVariableRecord records and marker.
EndMarker->eraseFromParent();
- // The record of those trailing DPValues would dangle and cause an assertion
- // failure if it lived until the end of the LLVMContext.
+ // The record of those trailing DbgVariableRecords would dangle and cause an
+ // assertion failure if it lived until the end of the LLVMContext.
ExitBlock->deleteTrailingDbgRecords();
}
-TEST(MetadataTest, DPValueConversionRoutines) {
+TEST(MetadataTest, DbgVariableRecordConversionRoutines) {
LLVMContext C;
// For the purpose of this test, set and un-set the command line option
@@ -1073,14 +1077,14 @@ TEST(MetadataTest, DPValueConversionRoutines) {
)");
// Check that the conversion routines and utilities between dbg.value
- // debug-info format and DPValues works.
+ // debug-info format and DbgVariableRecords works.
Function *F = M->getFunction("f");
BasicBlock *BB1 = &F->getEntryBlock();
// First instruction should be a dbg.value.
EXPECT_TRUE(isa<DbgValueInst>(BB1->front()));
EXPECT_FALSE(BB1->IsNewDbgInfoFormat);
- // Validating the block for DPValues / DPMarkers shouldn't fail -- there's
- // no data stored right now.
+ // Validating the block for DbgVariableRecords / DPMarkers shouldn't fail --
+ // there's no data stored right now.
bool BrokenDebugInfo = false;
bool Error = verifyModule(*M, &errs(), &BrokenDebugInfo);
EXPECT_FALSE(Error);
@@ -1104,7 +1108,7 @@ TEST(MetadataTest, DPValueConversionRoutines) {
EXPECT_FALSE(isa<DbgValueInst>(I));
// There should be a DPMarker on each of the two instructions in the entry
- // block, each containing one DPValue.
+ // block, each containing one DbgVariableRecord.
EXPECT_EQ(BB1->size(), 2u);
Instruction *FirstInst = &BB1->front();
Instruction *SecondInst = FirstInst->getNextNode();
@@ -1115,21 +1119,21 @@ TEST(MetadataTest, DPValueConversionRoutines) {
EXPECT_EQ(SecondInst, SecondInst->DbgMarker->MarkedInstr);
EXPECT_EQ(FirstInst->DbgMarker->StoredDbgRecords.size(), 1u);
- DPValue *DPV1 =
- cast<DPValue>(&*FirstInst->DbgMarker->getDbgRecordRange().begin());
- EXPECT_EQ(DPV1->getMarker(), FirstInst->DbgMarker);
+ DbgVariableRecord *DVR1 = cast<DbgVariableRecord>(
+ &*FirstInst->DbgMarker->getDbgRecordRange().begin());
+ EXPECT_EQ(DVR1->getMarker(), FirstInst->DbgMarker);
// Should point at %a, an argument.
- EXPECT_TRUE(isa<Argument>(DPV1->getVariableLocationOp(0)));
+ EXPECT_TRUE(isa<Argument>(DVR1->getVariableLocationOp(0)));
EXPECT_EQ(SecondInst->DbgMarker->StoredDbgRecords.size(), 1u);
- DPValue *DPV2 =
- cast<DPValue>(&*SecondInst->DbgMarker->getDbgRecordRange().begin());
- EXPECT_EQ(DPV2->getMarker(), SecondInst->DbgMarker);
+ DbgVariableRecord *DVR2 = cast<DbgVariableRecord>(
+ &*SecondInst->DbgMarker->getDbgRecordRange().begin());
+ EXPECT_EQ(DVR2->getMarker(), SecondInst->DbgMarker);
// Should point at FirstInst.
- EXPECT_EQ(DPV2->getVariableLocationOp(0), FirstInst);
+ EXPECT_EQ(DVR2->getVariableLocationOp(0), FirstInst);
- // There should be no DPValues / DPMarkers in the second block, but it should
- // be marked as being in the new format.
+ // There should be no DbgVariableRecords / DPMarkers in the second block, but
+ // it should be marked as being in the new format.
BasicBlock *BB2 = BB1->getNextNode();
EXPECT_TRUE(BB2->IsNewDbgInfoFormat);
for (auto &Inst : *BB2)
@@ -1143,17 +1147,17 @@ TEST(MetadataTest, DPValueConversionRoutines) {
// But if we were to break something, it should be able to fire. Don't attempt
// to comprehensively test the validator, it's a smoke-test rather than a
// "proper" verification pass.
- DPV1->setMarker(nullptr);
+ DVR1->setMarker(nullptr);
// A marker pointing the wrong way should be an error.
Error = verifyModule(*M, &errs(), &BrokenDebugInfo);
EXPECT_FALSE(Error);
EXPECT_TRUE(BrokenDebugInfo);
- DPV1->setMarker(FirstInst->DbgMarker);
+ DVR1->setMarker(FirstInst->DbgMarker);
- DILocalVariable *DLV1 = DPV1->getVariable();
- DIExpression *Expr1 = DPV1->getExpression();
- DILocalVariable *DLV2 = DPV2->getVariable();
- DIExpression *Expr2 = DPV2->getExpression();
+ DILocalVariable *DLV1 = DVR1->getVariable();
+ DIExpression *Expr1 = DVR1->getExpression();
+ DILocalVariable *DLV2 = DVR2->getVariable();
+ DIExpression *Expr2 = DVR2->getExpression();
// Convert everything back to the "old" format and ensure it's right.
M->convertFromNewDbgValues();
diff --git a/llvm/unittests/IR/IRBuilderTest.cpp b/llvm/unittests/IR/IRBuilderTest.cpp
index 139e8832c97b91..9b99574c2ba44b 100644
--- a/llvm/unittests/IR/IRBuilderTest.cpp
+++ b/llvm/unittests/IR/IRBuilderTest.cpp
@@ -942,7 +942,7 @@ TEST_F(IRBuilderTest, DIBuilder) {
DIB.createAutoVariable(BarSP, "X", File, 2, IntType, true);
DILocalVariable *VarY =
DIB.createAutoVariable(BarSP, "Y", File, 2, IntType, true);
- { /* dbg.value | DPValue::Value */
+ { /* dbg.value | DbgVariableRecord::Value */
ExpectOrder(DIB.insertDbgValueIntrinsic(I, VarX, DIB.createExpression(),
VarLoc, I),
I->getIterator());
@@ -953,7 +953,7 @@ TEST_F(IRBuilderTest, DIBuilder) {
ExpectOrder(VarXValue, I->getIterator());
EXPECT_EQ(BB->getTrailingDbgRecords(), nullptr);
}
- { /* dbg.declare | DPValue::Declare */
+ { /* dbg.declare | DbgVariableRecord::Declare */
ExpectOrder(DIB.insertDeclare(I, VarY, DIB.createExpression(), VarLoc, I),
I->getIterator());
// Check inserting at end of the block works as with labels.
@@ -963,7 +963,7 @@ TEST_F(IRBuilderTest, DIBuilder) {
ExpectOrder(VarYDeclare, I->getIterator());
EXPECT_EQ(BB->getTrailingDbgRecords(), nullptr);
}
- { /* dbg.assign | DPValue::Assign */
+ { /* dbg.assign | DbgVariableRecord::Assign */
I = Builder.CreateAlloca(Builder.getInt32Ty());
I->setMetadata(LLVMContext::MD_DIAssignID, DIAssignID::getDistinct(Ctx));
// DbgAssign interface is slightly different - it always inserts after the
diff --git a/llvm/unittests/IR/ValueTest.cpp b/llvm/unittests/IR/ValueTest.cpp
index 97c8fea3c6dbf4..246c2fc7fe4063 100644
--- a/llvm/unittests/IR/ValueTest.cpp
+++ b/llvm/unittests/IR/ValueTest.cpp
@@ -317,9 +317,9 @@ TEST(ValueTest, replaceUsesOutsideBlock) {
ASSERT_TRUE(Ret->getOperand(0) == cast<Value>(B));
}
-TEST(ValueTest, replaceUsesOutsideBlockDPValue) {
+TEST(ValueTest, replaceUsesOutsideBlockDbgVariableRecord) {
// Check that Value::replaceUsesOutsideBlock(New, BB) replaces uses outside
- // BB, including DPValues.
+ // BB, including DbgVariableRecords.
const auto *IR = R"(
define i32 @f() !dbg !6 {
entry:
@@ -379,14 +379,16 @@ TEST(ValueTest, replaceUsesOutsideBlockDPValue) {
EXPECT_TRUE(Branch->hasDbgRecords());
EXPECT_TRUE(Ret->hasDbgRecords());
- DPValue *DPV1 = cast<DPValue>(&*Branch->getDbgRecordRange().begin());
- DPValue *DPV2 = cast<DPValue>(&*Ret->getDbgRecordRange().begin());
+ DbgVariableRecord *DVR1 =
+ cast<DbgVariableRecord>(&*Branch->getDbgRecordRange().begin());
+ DbgVariableRecord *DVR2 =
+ cast<DbgVariableRecord>(&*Ret->getDbgRecordRange().begin());
A->replaceUsesOutsideBlock(B, Entry);
// These users are in Entry so shouldn't be changed.
- EXPECT_TRUE(DPV1->getVariableLocationOp(0) == cast<Value>(A));
+ EXPECT_TRUE(DVR1->getVariableLocationOp(0) == cast<Value>(A));
// These users are outside Entry so should be changed.
- EXPECT_TRUE(DPV2->getVariableLocationOp(0) == cast<Value>(B));
+ EXPECT_TRUE(DVR2->getVariableLocationOp(0) == cast<Value>(B));
UseNewDbgInfoFormat = OldDbgValueMode;
}
diff --git a/llvm/unittests/Transforms/Utils/LocalTest.cpp b/llvm/unittests/Transforms/Utils/LocalTest.cpp
index 87a2a2ae470051..4258f218794f84 100644
--- a/llvm/unittests/Transforms/Utils/LocalTest.cpp
+++ b/llvm/unittests/Transforms/Utils/LocalTest.cpp
@@ -1279,11 +1279,11 @@ TEST(Local, ExpressionForConstant) {
EXPECT_EQ(Expr, nullptr);
}
-TEST(Local, ReplaceDPValue) {
+TEST(Local, ReplaceDbgVariableRecord) {
LLVMContext C;
- // Test that RAUW also replaces the operands of DPValue objects, i.e.
- // non-instruction stored debugging information.
+ // Test that RAUW also replaces the operands of DbgVariableRecord objects,
+ // i.e. non-instruction stored debugging information.
std::unique_ptr<Module> M = parseIR(C,
R"(
declare void @llvm.dbg.value(metadata, metadata, metadata)
@@ -1323,24 +1323,23 @@ TEST(Local, ReplaceDPValue) {
It = std::next(It);
Instruction *RetInst = &*It;
- // Convert DVI into a DPValue.
+ // Convert DVI into a DbgVariableRecord.
RetInst->DbgMarker = new DPMarker();
RetInst->DbgMarker->MarkedInstr = RetInst;
- DPValue *DPV = new DPValue(DVI);
- RetInst->DbgMarker->insertDbgRecord(DPV, false);
+ DbgVariableRecord *DVR = new DbgVariableRecord(DVI);
+ RetInst->DbgMarker->insertDbgRecord(DVR, false);
// ... and erase the dbg.value.
DVI->eraseFromParent();
- // DPV should originally refer to %bar,
- EXPECT_EQ(DPV->getVariableLocationOp(0), BarInst);
+ // DVR should originally refer to %bar,
+ EXPECT_EQ(DVR->getVariableLocationOp(0), BarInst);
// Now try to replace the computation of %bar with %foo -- this should cause
- // the DPValue's to have it's operand updated beneath it.
+ // the DbgVariableRecord's to have it's operand updated beneath it.
BarInst->replaceAllUsesWith(FooInst);
- // Check DPV now points at %foo.
- EXPECT_EQ(DPV->getVariableLocationOp(0), FooInst);
+ // Check DVR now points at %foo.
+ EXPECT_EQ(DVR->getVariableLocationOp(0), FooInst);
// Teardown.
RetInst->DbgMarker->eraseFromParent();
}
-
>From 735522344ac2d3651902c41161d462d4640c4bc6 Mon Sep 17 00:00:00 2001
From: Stephen Tozer <stephen.tozer at sony.com>
Date: Thu, 14 Mar 2024 12:53:05 +0000
Subject: [PATCH 2/2] Also rename an existing 'DVR' in the same scope as a
'DPV'
---
llvm/lib/Transforms/Utils/Local.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/lib/Transforms/Utils/Local.cpp b/llvm/lib/Transforms/Utils/Local.cpp
index 05ddcf84d310ae..ec8086c08c2ce8 100644
--- a/llvm/lib/Transforms/Utils/Local.cpp
+++ b/llvm/lib/Transforms/Utils/Local.cpp
@@ -2657,13 +2657,13 @@ static bool rewriteDebugUsers(
if (UndefOrSalvageDVR.count(DVR))
continue;
- DbgValReplacement DVR = RewriteDVRExpr(*DVR);
+ DbgValReplacement DVRepl = RewriteDVRExpr(*DVR);
if (!DVR)
continue;
DVR->replaceVariableLocationOp(&From, &To);
- DVR->setExpression(*DVR);
- LLVM_DEBUG(dbgs() << "REWRITE: " << DVR << '\n');
+ DVR->setExpression(*DVRepl);
+ LLVM_DEBUG(dbgs() << "REWRITE: " << DVRepl << '\n');
Changed = true;
}
More information about the llvm-commits
mailing list