[llvm] [RemoveDIs][DebugInfo] Add DPVAssign variant of DPValue (PR #77912)

Jeremy Morse via llvm-commits llvm-commits at lists.llvm.org
Fri Jan 12 08:47:53 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);
----------------
jmorse wrote:

What's the probability that we could have duplicate metadatas, i.e. multiple entries here? I think it's idiomatic for list-heads to assign themselves with their own address when they're empty, would that show up here as same-value same-address Metadatas?

https://github.com/llvm/llvm-project/pull/77912


More information about the llvm-commits mailing list