Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

No description provided.

@llvmbot
Copy link
Member

llvmbot commented May 20, 2025

@llvm/pr-subscribers-backend-amdgpu

@llvm/pr-subscribers-flang-openmp

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/140742.diff

4 Files Affected:

  • (modified) llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h (+1-2)
  • (modified) llvm/lib/Support/ThreadPool.cpp (+1-2)
  • (modified) llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp (+1-4)
  • (modified) llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp (+1-2)
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index f702b8dba5a79..cdc80c88b7425 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -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 :
diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp
index 27e0f220ac4ed..c304f0f45360b 100644
--- a/llvm/lib/Support/ThreadPool.cpp
+++ b/llvm/lib/Support/ThreadPool.cpp
@@ -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() {
diff --git a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
index bb68f4a0e70de..e1008439a33a8 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
@@ -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,
diff --git a/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp b/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
index e00240d7427dc..b1f19e9e20891 100644
--- a/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
+++ b/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
@@ -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;

@llvmbot
Copy link
Member

llvmbot commented May 20, 2025

@llvm/pr-subscribers-llvm-support

Author: Kazu Hirata (kazutakahirata)

Changes

Full diff: https://github.com/llvm/llvm-project/pull/140742.diff

4 Files Affected:

  • (modified) llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h (+1-2)
  • (modified) llvm/lib/Support/ThreadPool.cpp (+1-2)
  • (modified) llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp (+1-4)
  • (modified) llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp (+1-2)
diff --git a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
index f702b8dba5a79..cdc80c88b7425 100644
--- a/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
+++ b/llvm/include/llvm/Frontend/OpenMP/ConstructDecompositionT.h
@@ -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 :
diff --git a/llvm/lib/Support/ThreadPool.cpp b/llvm/lib/Support/ThreadPool.cpp
index 27e0f220ac4ed..c304f0f45360b 100644
--- a/llvm/lib/Support/ThreadPool.cpp
+++ b/llvm/lib/Support/ThreadPool.cpp
@@ -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() {
diff --git a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
index bb68f4a0e70de..e1008439a33a8 100644
--- a/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
+++ b/llvm/lib/Target/AMDGPU/AMDGPURewriteOutArguments.cpp
@@ -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,
diff --git a/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp b/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
index e00240d7427dc..b1f19e9e20891 100644
--- a/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
+++ b/llvm/unittests/DebugInfo/CodeView/TypeIndexDiscoveryTest.cpp
@@ -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;

@kazutakahirata kazutakahirata merged commit cbac2a9 into llvm:main May 20, 2025
16 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_range_llvm_is_contained_llvm branch May 20, 2025 21:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants