From 8e8bbbd48ee23764cc6030fd259dde6a1107c00c Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Fri, 12 Jan 2024 22:08:29 -0800 Subject: [PATCH] [mlir] Use llvm::is_contained (NFC) --- mlir/lib/Dialect/Bufferization/Transforms/OneShotAnalysis.cpp | 2 +- mlir/lib/Dialect/Linalg/TransformOps/LinalgTransformOps.cpp | 2 +- .../Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.cpp | 2 +- .../Dialect/Linalg/Transforms/ConvertToDestinationStyle.cpp | 2 +- .../Dialect/Vector/Transforms/BufferizableOpInterfaceImpl.cpp | 3 +-- 5 files changed, 5 insertions(+), 6 deletions(-) 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 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(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 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 newReturnValues(maskOp->getNumResults(), Value()); SmallVector 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