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

Shao-Ce SUN via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 7 23:20:54 PST 2023


================
@@ -121,18 +121,14 @@ 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;
+    for (const auto &U : Users) {
----------------
sunshaoce wrote:

Addressed. Thanks!

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


More information about the llvm-commits mailing list