Skip to content

[llvm] Use llvm::is_contained (NFC) #140742

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
Original file line number Diff line number Diff line change
Expand Up @@ -1123,8 +1123,7 @@ template <typename C, typename H> bool ConstructDecompositionT<C, H>::split() {
bool success = true;

auto isImplicit = [this](const ClauseTy *node) {
return llvm::any_of(
implicit, [node](const ClauseTy &clause) { return &clause == node; });
return llvm::is_contained(llvm::make_pointer_range(implicit), node);
};

for (llvm::omp::Directive leaf :
Expand Down
3 changes: 1 addition & 2 deletions llvm/lib/Support/ThreadPool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,7 @@ bool StdThreadPool::workCompletedUnlocked(ThreadPoolTaskGroup *Group) const {
if (Group == nullptr)
return !ActiveThreads && Tasks.empty();
return ActiveGroups.count(Group) == 0 &&
!llvm::any_of(Tasks,
[Group](const auto &T) { return T.second == Group; });
!llvm::is_contained(llvm::make_second_range(Tasks), Group);
}

void StdThreadPool::wait() {
Expand Down
5 changes: 1 addition & 4 deletions llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,7 @@ bool AMDGPURewriteOutArguments::runOnFunction(Function &F) {
Value *ReplVal = Store.second->getValueOperand();

auto &ValVec = Replacements[Store.first];
if (llvm::any_of(ValVec,
[OutArg](const std::pair<Argument *, Value *> &Entry) {
return Entry.first == OutArg;
})) {
if (llvm::is_contained(llvm::make_first_range(ValVec), OutArg)) {
LLVM_DEBUG(dbgs()
<< "Saw multiple out arg stores" << *OutArg << '\n');
// It is possible to see stores to the same argument multiple times,
Expand Down
3 changes: 1 addition & 2 deletions llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,7 @@ class TypeIndexIteratorTest : public testing::Test {
ArrayRef<uint8_t> Loc = RecordData.drop_front(Offset);
ArrayRef<TypeIndex> Indices(
reinterpret_cast<const TypeIndex *>(Loc.data()), Ref.Count);
if (llvm::any_of(Indices,
[TI](const TypeIndex &Other) { return Other == TI; }))
if (llvm::is_contained(Indices, TI))
return true;
}
return false;
Expand Down
Loading