[Mlir-commits] [mlir] [mlir] Use a range-based for loop (NFC) (PR #139756)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Tue May 13 08:49:33 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir

Author: Kazu Hirata (kazutakahirata)

<details>
<summary>Changes</summary>

WHile I am at it, this patch replaces std::find with
llvm::is_contained.


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


1 Files Affected:

- (modified) mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp (+2-3) 


``````````diff
diff --git a/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp b/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
index 3938c3731c47f..66ea00b23b9d4 100644
--- a/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
+++ b/mlir/lib/Dialect/Tosa/Transforms/TosaProfileCompliance.cpp
@@ -444,9 +444,8 @@ LogicalResult TosaProfileCompliance::checkProfileOrExtension(
   // Ensure the profile inference match the profile knowledge of the
   // specification.
   for (const auto &cands : specRequiredModeSet) {
-    for (size_t i = 0; i < opRequiredMode.size(); i++) {
-      if (std::find(cands.begin(), cands.end(), opRequiredMode[i]) ==
-          cands.end()) {
+    for (const auto &mode : opRequiredMode) {
+      if (!llvm::is_contained(cands, mode)) {
         op->emitOpError() << "illegal: requires ["
                           << llvm::join(stringifyProfile<T>(opRequiredMode),
                                         ", ")

``````````

</details>


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


More information about the Mlir-commits mailing list