[llvm-branch-commits] [llvm] IR: Remove reference counts from ConstantData (PR #137314)

Nikita Popov via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Apr 26 12:58:10 PDT 2025


================
@@ -518,17 +509,8 @@ class Value {
 
   /// This method should only be used by the Use class.
   void addUse(Use &U) {
-    if (hasUseList())
-      U.addToList(Uses.List);
-    else
-      U.addToList(Uses.Count);
-  }
-
-  void removeUse(Use &U) {
-    if (hasUseList())
-      U.removeFromList(Uses.List);
-    else
-      U.removeFromList(Uses.Count);
+    if (UseList || hasUseList())
----------------
nikic wrote:

Why the `UseList ||` here? Isn't `hasUseList()` sufficient? Or is this just an optimization?

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


More information about the llvm-branch-commits mailing list