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

Kazu Hirata llvmlistbot at llvm.org
Fri Jan 12 22:08:40 PST 2024


Author: Kazu Hirata
Date: 2024-01-12T22:08:29-08:00
New Revision: 8e8bbbd48ee23764cc6030fd259dde6a1107c00c

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

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

Added: 
    

Modified: 
    mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
    mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
    mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
    mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp
    mlir/lib/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
index c48402c3742a77..498db1182317a9 100644
--- a/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
+++ b/mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp
@@ -279,7 +279,7 @@ static bool isReachable(Block *from, Block *to, ArrayRef<Block *> except) {
     worklist.push_back(succ);
   while (!worklist.empty()) {
     Block *next = worklist.pop_back_val();
-    if (llvm::find(except, next) != except.end())
+    if (llvm::is_contained(except, next))
       continue;
     if (next == to)
       return true;

diff  --git a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
index 97d2b4a3be5c56..139566d350fe83 100644
--- a/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
+++ b/mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp
@@ -1759,7 +1759,7 @@ transform::PadOp::apply(transform::TransformRewriter &rewriter,
     if (options.copyBackOp != LinalgPaddingOptions::CopyBackOp::None) {
       for (Value v : replacements) {
         Operation *copyBackOp = v.getDefiningOp();
-        if (llvm::find(copyBackOps, copyBackOp) == copyBackOps.end())
+        if (!llvm::is_contained(copyBackOps, copyBackOp))
           copyBackOps.push_back(copyBackOp);
       }
     }

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
index b232d56d4419f6..58fb2e91b4f637 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -125,7 +125,7 @@ struct LinalgOpInterface
       if (!isa<RankedTensorType, MemRefType>(operand.get().getType()))
         continue;
       // Only consider operands in `opOperands`.
-      if (llvm::find(opOperands, &operand) == opOperands.end())
+      if (!llvm::is_contained(opOperands, &operand))
         continue;
       // TODO: This could be generalized to other indexing maps. (All indexing
       // must be the same.)

diff  --git a/mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp b/mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp
index e6353df590f7e8..d8df5d82e28759 100644
--- a/mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp
+++ b/mlir/lib/Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp
@@ -523,7 +523,7 @@ Value linalg::bufferizeToAllocation(
   // bufferize out-of-place.
   SmallVector<OpOperand *> outOfPlaceOperands, resultUses;
   auto addOutOfPlaceOperand = [&](OpOperand *operand) {
-    if (llvm::find(outOfPlaceOperands, operand) == outOfPlaceOperands.end())
+    if (!llvm::is_contained(outOfPlaceOperands, operand))
       outOfPlaceOperands.push_back(operand);
   };
   for (OpResult result : tensorResults) {

diff  --git a/mlir/lib/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp b/mlir/lib/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp
index d050bf6f5ce141..5782ee1d58cf53 100644
--- a/mlir/lib/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp
+++ b/mlir/lib/Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp
@@ -217,8 +217,7 @@ struct MaskOpInterface
     SmallVector<Value> newReturnValues(maskOp->getNumResults(), Value());
     SmallVector<Value> newYieldedValues;
     for (const auto &it : llvm::enumerate(yieldOp.getOperands())) {
-      if (llvm::find(maskedOp->getOpResults(), it.value()) !=
-          maskedOp->getOpResults().end()) {
+      if (llvm::is_contained(maskedOp->getOpResults(), it.value())) {
         newYieldedValues.push_back(it.value());
       } else {
         // This used to be a tensor result of the masked op, but is now a memref


        


More information about the Mlir-commits mailing list