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

Kazu Hirata llvmlistbot at llvm.org
Mon Mar 13 00:43:34 PDT 2023


Author: Kazu Hirata
Date: 2023-03-13T00:43:27-07:00
New Revision: d298b02dbaa75f65b764c77122e52d10bf8c8bda

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

LOG: [mlir] Use llvm::is_contained (NFC)

Added: 
    

Modified: 
    mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp
    mlir/lib/Dialect/Tensor/IR/TensorOps.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp b/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp
index ffe5c2a67e05c..22b8f5e15dde2 100644
--- a/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp
+++ b/mlir/lib/Dialect/GPU/TransformOps/GPUTransformOps.cpp
@@ -204,8 +204,7 @@ DiagnosedSilenceableFailure mlir::transform::gpu::mapForeachToBlocksImpl(
   // Ensure we have 3 block sizes, one for each id.
   Value one;
   for (auto attr : mappingAttributes) {
-    if (std::find(blockMapping.begin(), blockMapping.end(), attr) ==
-        blockMapping.end()) {
+    if (!llvm::is_contained(blockMapping, attr)) {
       blockMapping.push_back(attr);
       one = one ? one : rewriter.create<arith::ConstantIndexOp>(loc, 1);
       numBlocks.push_back(one);
@@ -404,8 +403,7 @@ static DiagnosedSilenceableFailure rewriteOneForallToGpuThreads(
   // Ensure we have 3 block sizes, one for each id.
   Value one;
   for (auto attr : threadMappingAttributes) {
-    if (std::find(threadMapping.begin(), threadMapping.end(), attr) ==
-        threadMapping.end()) {
+    if (!llvm::is_contained(threadMapping, attr)) {
       threadMapping.push_back(attr);
       one = one ? one : rewriter.create<arith::ConstantIndexOp>(loc, 1);
       numThreads.push_back(one);

diff  --git a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
index 5755ddf9fa6b2..e3119ff93e2e9 100644
--- a/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
+++ b/mlir/lib/Dialect/Tensor/IR/TensorOps.cpp
@@ -1233,7 +1233,7 @@ int64_t ExpandShapeOp::getCorrespondingSourceDim(int64_t resultDim) {
   assert(resultDim >= 0 && resultDim < getResultType().getRank() &&
          "invalid resultDim");
   for (const auto &it : llvm::enumerate(getReassociationIndices()))
-    if (llvm::find(it.value(), resultDim) != it.value().end())
+    if (llvm::is_contained(it.value(), resultDim))
       return it.index();
   llvm_unreachable("could not find reassociation group");
 }


        


More information about the Mlir-commits mailing list