[clang] 3bca659 - Use llvm::is_contained (NFC)

Kazu Hirata via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 22 17:20:57 PDT 2023


Author: Kazu Hirata
Date: 2023-09-22T17:20:50-07:00
New Revision: 3bca65955668b478bcf2cac49f1731f20da8da9c

URL: https://github.com/llvm/llvm-project/commit/3bca65955668b478bcf2cac49f1731f20da8da9c
DIFF: https://github.com/llvm/llvm-project/commit/3bca65955668b478bcf2cac49f1731f20da8da9c.diff

LOG: Use llvm::is_contained (NFC)

Added: 
    

Modified: 
    clang/lib/Sema/SemaOpenMP.cpp
    mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
    mlir/lib/Dialect/NVGPU/IR/NVGPUDialect.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Sema/SemaOpenMP.cpp b/clang/lib/Sema/SemaOpenMP.cpp
index 46eae3596d2a8fe..d42a21976821a4c 100644
--- a/clang/lib/Sema/SemaOpenMP.cpp
+++ b/clang/lib/Sema/SemaOpenMP.cpp
@@ -1187,9 +1187,7 @@ class DSAStackTy {
     if (!Top)
       return false;
 
-    return llvm::any_of(Top->IteratorVarDecls, [VD](const VarDecl *IteratorVD) {
-      return IteratorVD == VD->getCanonicalDecl();
-    });
+    return llvm::is_contained(Top->IteratorVarDecls, VD->getCanonicalDecl());
   }
   /// get captured field from ImplicitDefaultFirstprivateFDs
   VarDecl *getImplicitFDCapExprDecl(const FieldDecl *FD) const {

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
index 6d8a96a3ad23f3e..d60a1a1cda849c7 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/Vectorization.cpp
@@ -1514,8 +1514,7 @@ vectorizeLinalgOpPrecondition(LinalgOp linalgOp,
                               ArrayRef<int64_t> inputVectorSizes,
                               bool vectorizeNDExtract) {
   // tensor with dimension of 0 cannot be vectorized.
-  if (llvm::any_of(linalgOp.getStaticShape(),
-                   [](int64_t dim) { return dim == 0; }))
+  if (llvm::is_contained(linalgOp.getStaticShape(), 0))
     return failure();
   // Check API contract for input vector sizes.
   if (!inputVectorSizes.empty() &&

diff  --git a/mlir/lib/Dialect/NVGPU/IR/NVGPUDialect.cpp b/mlir/lib/Dialect/NVGPU/IR/NVGPUDialect.cpp
index d96ed69982870b4..dfec17986800417 100644
--- a/mlir/lib/Dialect/NVGPU/IR/NVGPUDialect.cpp
+++ b/mlir/lib/Dialect/NVGPU/IR/NVGPUDialect.cpp
@@ -444,11 +444,11 @@ LogicalResult isAllowedSizeN(int sizeN, Type typeA) {
                                     176, 192, 208, 224, 240, 256};
   if (typeA.isBF16() || typeA.isF16() || typeA.isTF32() ||
       typeA.isFloat8E4M3FN() || typeA.isFloat8E5M2())
-    if (llvm::any_of(allowedN, [&](int n) { return sizeN == n; }))
+    if (llvm::is_contained(allowedN, sizeN))
       return success();
 
   if (typeA.isInteger(8) || typeA.isInteger(1))
-    if (llvm::any_of(allowedNshort, [&](int n) { return sizeN == n; }))
+    if (llvm::is_contained(allowedNshort, sizeN))
       return success();
   return failure();
 }


        


More information about the cfe-commits mailing list