[Mlir-commits] [mlir] 939a808 - Use llvm::is_contained (NFC)

Kazu Hirata llvmlistbot at llvm.org
Sat Oct 16 07:52:32 PDT 2021


Author: Kazu Hirata
Date: 2021-10-16T07:52:21-07:00
New Revision: 939a80867004c8b5a64ffc84120c31db634162a0

URL: https://github.com/llvm/llvm-project/commit/939a80867004c8b5a64ffc84120c31db634162a0
DIFF: https://github.com/llvm/llvm-project/commit/939a80867004c8b5a64ffc84120c31db634162a0.diff

LOG: Use llvm::is_contained (NFC)

Added: 
    

Modified: 
    llvm/include/llvm/Option/Arg.h
    mlir/lib/Dialect/Vector/VectorOps.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/Option/Arg.h b/llvm/include/llvm/Option/Arg.h
index 22e2bcf06a6eb..4be254ccdab44 100644
--- a/llvm/include/llvm/Option/Arg.h
+++ b/llvm/include/llvm/Option/Arg.h
@@ -118,10 +118,7 @@ class Arg {
   const SmallVectorImpl<const char *> &getValues() const { return Values; }
 
   bool containsValue(StringRef Value) const {
-    for (unsigned i = 0, e = getNumValues(); i != e; ++i)
-      if (Values[i] == Value)
-        return true;
-    return false;
+    return llvm::is_contained(Values, Value);
   }
 
   /// Append the argument onto the given array as strings.

diff  --git a/mlir/lib/Dialect/Vector/VectorOps.cpp b/mlir/lib/Dialect/Vector/VectorOps.cpp
index 343bc3e3e5100..ee87e5b3eec1f 100644
--- a/mlir/lib/Dialect/Vector/VectorOps.cpp
+++ b/mlir/lib/Dialect/Vector/VectorOps.cpp
@@ -2167,7 +2167,7 @@ class StridedSliceConstantMaskFolder final
     }
     // If any of 'sliceMaskDimSizes' are zero, then set all to zero (masked
     // region is a conjunction of mask dim intervals).
-    if (llvm::any_of(sliceMaskDimSizes, [](int64_t sz) { return sz == 0; }))
+    if (llvm::is_contained(sliceMaskDimSizes, 0))
       sliceMaskDimSizes.assign(maskDimSizes.size(), 0);
 
     // Replace 'extractStridedSliceOp' with ConstantMaskOp with sliced mask


        


More information about the Mlir-commits mailing list