Skip to content

Commit d860710

Browse files
authored
[NFC][VPlan] Simplify VPValue::removeUser (#74708)
Replaced explicit loops with find + erase.
1 parent 1095105 commit d860710

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

llvm/lib/Transforms/Vectorize/VPlanValue.h

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -121,18 +121,11 @@ class VPValue {
121121

122122
/// Remove a single \p User from the list of users.
123123
void removeUser(VPUser &User) {
124-
bool Found = false;
125124
// The same user can be added multiple times, e.g. because the same VPValue
126125
// is used twice by the same VPUser. Remove a single one.
127-
erase_if(Users, [&User, &Found](VPUser *Other) {
128-
if (Found)
129-
return false;
130-
if (Other == &User) {
131-
Found = true;
132-
return true;
133-
}
134-
return false;
135-
});
126+
auto *I = find(Users, &User);
127+
if (I != Users.end())
128+
Users.erase(I);
136129
}
137130

138131
typedef SmallVectorImpl<VPUser *>::iterator user_iterator;

0 commit comments

Comments
 (0)