[llvm] d860710 - [NFC][VPlan] Simplify VPValue::removeUser (#74708)
via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 10 18:55:31 PST 2023
Author: Shao-Ce SUN
Date: 2023-12-11T10:55:27+08:00
New Revision: d860710905d77e496b579c8aa6d3f36695cf14cf
URL: https://github.com/llvm/llvm-project/commit/d860710905d77e496b579c8aa6d3f36695cf14cf
DIFF: https://github.com/llvm/llvm-project/commit/d860710905d77e496b579c8aa6d3f36695cf14cf.diff
LOG: [NFC][VPlan] Simplify VPValue::removeUser (#74708)
Replaced explicit loops with find + erase.
Added:
Modified:
llvm/lib/Transforms/Vectorize/VPlanValue.h
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/Vectorize/VPlanValue.h b/llvm/lib/Transforms/Vectorize/VPlanValue.h
index e5ca52755dd22..116acad8e8f3c 100644
--- a/llvm/lib/Transforms/Vectorize/VPlanValue.h
+++ b/llvm/lib/Transforms/Vectorize/VPlanValue.h
@@ -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 = find(Users, &User);
+ if (I != Users.end())
+ Users.erase(I);
}
typedef SmallVectorImpl<VPUser *>::iterator user_iterator;
More information about the llvm-commits
mailing list