Skip to content

Conversation

@kazutakahirata
Copy link
Contributor

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

WHile I am at it, this patch replaces std::find with
llvm::is_contained.
@llvmbot
Copy link
Member

llvmbot commented May 13, 2025

@llvm/pr-subscribers-mlir-tosa

@llvm/pr-subscribers-mlir

Author: Kazu Hirata (kazutakahirata)

Changes

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 --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),
                                         ", ")

@kazutakahirata kazutakahirata merged commit db9e307 into llvm:main May 13, 2025
14 checks passed
@kazutakahirata kazutakahirata deleted the cleanup_001_range_llvm_is_contained_mlir branch May 13, 2025 22:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants