Index: llvm/include/llvm/IR/DebugInfoMetadata.h =================================================================== --- llvm/include/llvm/IR/DebugInfoMetadata.h +++ llvm/include/llvm/IR/DebugInfoMetadata.h @@ -3817,6 +3817,18 @@ } }; +/// Identifies a unique instance of a whole variable (discards/ignores fragment +/// information). +class DebugVariableAggregate : public DebugVariable { +public: + DebugVariableAggregate(const DbgVariableIntrinsic *DVI); + DebugVariableAggregate(const DebugVariable &V) + : DebugVariable(V.getVariable(), std::nullopt, V.getInlinedAt()) {} +}; + +template <> +struct DenseMapInfo + : public DenseMapInfo {}; } // end namespace llvm #undef DEFINE_MDNODE_GET_UNPACK_IMPL Index: llvm/lib/IR/DebugInfoMetadata.cpp =================================================================== --- llvm/lib/IR/DebugInfoMetadata.cpp +++ llvm/lib/IR/DebugInfoMetadata.cpp @@ -42,6 +42,10 @@ Fragment(DII->getExpression()->getFragmentInfo()), InlinedAt(DII->getDebugLoc().getInlinedAt()) {} +DebugVariableAggregate::DebugVariableAggregate(const DbgVariableIntrinsic *DVI) + : DebugVariable(DVI->getVariable(), std::nullopt, + DVI->getDebugLoc()->getInlinedAt()) {} + DILocation::DILocation(LLVMContext &C, StorageType Storage, unsigned Line, unsigned Column, ArrayRef MDs, bool ImplicitCode)