[Mlir-commits] [mlir] [mlir] Use llvm::is_contained (NFC) (PR #140986)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 21 19:23:59 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir

@llvm/pr-subscribers-mlir-bufferization

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/140986.diff


3 Files Affected:

- (modified) mlir/include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h (+1-2) 
- (modified) mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp (+1-2) 
- (modified) mlir/test/lib/Analysis/TestTopologicalSort.cpp (+1-1) 


``````````diff
diff --git a/mlir/include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h b/mlir/include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h
index 78109770efab7..cf86b9a23f59e 100644
--- a/mlir/include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h
+++ b/mlir/include/mlir/Dialect/Bufferization/IR/UnstructuredControlFlow.h
@@ -54,8 +54,7 @@ struct OpWithUnstructuredControlFlowBufferizableOpInterfaceExternalModel
       // If the forwarded operand is already on the invocation stack, we ran
       // into a loop and this operand cannot be used to compute the bufferized
       // type.
-      if (llvm::find(invocationStack, opOperand->get()) !=
-          invocationStack.end())
+      if (llvm::is_contained(invocationStack, opOperand->get()))
         continue;
 
       // Compute the bufferized type of the forwarded operand.
diff --git a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
index 10aaf35be2ab7..81d376ef991b6 100644
--- a/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
+++ b/mlir/lib/Dialect/Transform/Interfaces/TransformInterfaces.cpp
@@ -807,8 +807,7 @@ void transform::TransformState::compactOpHandles() {
   for (Value handle : opHandlesToCompact) {
     Mappings &mappings = getMapping(handle, /*allowOutOfScope=*/true);
 #if LLVM_ENABLE_ABI_BREAKING_CHECKS
-    if (llvm::find(mappings.direct[handle], nullptr) !=
-        mappings.direct[handle].end())
+    if (llvm::is_contained(mappings.direct[handle], nullptr))
       // Payload IR is removed from the mapping. This invalidates the respective
       // iterators.
       mappings.incrementTimestamp(handle);
diff --git a/mlir/test/lib/Analysis/TestTopologicalSort.cpp b/mlir/test/lib/Analysis/TestTopologicalSort.cpp
index c7e0206b2a4d7..bd7e60f1ecc33 100644
--- a/mlir/test/lib/Analysis/TestTopologicalSort.cpp
+++ b/mlir/test/lib/Analysis/TestTopologicalSort.cpp
@@ -53,7 +53,7 @@ struct TestTopologicalSortAnalysisPass
         return WalkResult::advance();
       });
 
-      if (llvm::find(selectedOps, nullptr) != selectedOps.end()) {
+      if (llvm::is_contained(selectedOps, nullptr)) {
         root->emitError("invalid test case: some indices are missing among the "
                         "selected ops");
         return WalkResult::skip();

``````````

</details>


https://github.com/llvm/llvm-project/pull/140986


More information about the Mlir-commits mailing list