[llvm-branch-commits] [llvm] IR: Remove uselist for constantdata (PR #134692)

Matt Arsenault via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sun Apr 13 07:18:06 PDT 2025


================
@@ -889,10 +919,50 @@ inline raw_ostream &operator<<(raw_ostream &OS, const Value &V) {
   return OS;
 }
 
+inline Use::~Use() {
+  if (Val)
+    Val->removeUse(*this);
+}
+
+void Use::addToList(unsigned &Count) {
+  assert(isa<ConstantData>(Val) && "Only ConstantData is ref-counted");
+  ++Count;
+
+  // We don't have a uselist - clear the remnant if we are replacing a
+  // non-constant value.
+  Prev = nullptr;
+  Next = nullptr;
----------------
arsenm wrote:

I meant to revisit this. I think this was only a problem in cases where Use::swap was used between a register and a constant 

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


More information about the llvm-branch-commits mailing list