Use llvm::is_contained (NFC)
authorKazu Hirata <kazu@google.com>
Sat, 16 Oct 2021 14:52:21 +0000 (07:52 -0700)
committerKazu Hirata <kazu@google.com>
Sat, 16 Oct 2021 14:52:21 +0000 (07:52 -0700)
llvm/include/llvm/Option/Arg.h
mlir/lib/Dialect/Vector/VectorOps.cpp

index 22e2bcf..4be254c 100644 (file)
@@ -118,10 +118,7 @@ public:
   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.
index 343bc3e..ee87e5b 100644 (file)
@@ -2167,7 +2167,7 @@ public:
     }
     // 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