[llvm] [RemoveDIs][DebugInfo] Add DPVAssign variant of DPValue (PR #77912)
Stephen Tozer via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 15 02:05:31 PST 2024
================
@@ -152,26 +152,47 @@ DPValue *DebugValueUser::getUser() { return static_cast<DPValue *>(this); }
const DPValue *DebugValueUser::getUser() const {
return static_cast<const DPValue *>(this);
}
-void DebugValueUser::handleChangedValue(Metadata *NewMD) {
- getUser()->handleChangedLocation(NewMD);
+
+void DebugValueUser::handleChangedValue(void *Old, Metadata *New) {
+ // NOTE: We could inform the "owner" that a value has changed through
+ // getOwner, if needed.
+ auto OldMD = static_cast<Metadata **>(Old);
+ ptrdiff_t Idx = std::distance(DebugValues.begin(), OldMD);
+ resetDebugValue(Idx, New);
----------------
SLTozer wrote:
`handleChangedValuePointer`? In any case, the metadata RAUW mechanism is based on maintaining a map of addresses of pointers to that metadata, so if two pointers to the same MD exist in DebugValueUser, we would expect this to be called twice. We could iterate over the full user list and reset every identical pointer here, but `ReplaceableMetadataImpl::replaceAllUsesWith()` (which is the only thing that should call through to this) already has reference to all of those pointers, so I think this would just be duplicating work.
https://github.com/llvm/llvm-project/pull/77912
More information about the llvm-commits
mailing list