[llvm-branch-commits] [llvm] IR: Remove uselist for constantdata (PR #134692)
Nikita Popov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Sun Apr 13 04:01:16 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;
----------------
nikic wrote:
Can you explain in more detail when this is necessary? It seems odd to me that addToList() should be responsible for nulling out these pointers.
https://github.com/llvm/llvm-project/pull/134692
More information about the llvm-branch-commits
mailing list