[llvm] [NFC][VPlan] Simplify VPValue::removeUser (PR #74708)

Shao-Ce SUN via llvm-commits llvm-commits at lists.llvm.org
Sun Dec 10 18:22:00 PST 2023


================
@@ -121,18 +121,11 @@ class VPValue {
 
   /// Remove a single \p User from the list of users.
   void removeUser(VPUser &User) {
-    bool Found = false;
     // The same user can be added multiple times, e.g. because the same VPValue
     // is used twice by the same VPUser. Remove a single one.
-    erase_if(Users, [&User, &Found](VPUser *Other) {
-      if (Found)
-        return false;
-      if (Other == &User) {
-        Found = true;
-        return true;
-      }
-      return false;
-    });
+    auto *I = llvm::find(Users, &User);
----------------
sunshaoce wrote:

Addressed. Thanks!

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


More information about the llvm-commits mailing list