[Mlir-commits] [mlir] [mlir] Use llvm::any_of and llvm::all_of (NFC) (PR #146947)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jul 3 12:33:00 PDT 2025
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir-tosa
Author: Kazu Hirata (kazutakahirata)
<details>
<summary>Changes</summary>
---
Full diff: https://github.com/llvm/llvm-project/pull/146947.diff
1 Files Affected:
- (modified) mlir/include/mlir/Dialect/Tosa/IR/TargetEnv.h (+4-14)
``````````diff
diff --git a/mlir/include/mlir/Dialect/Tosa/IR/TargetEnv.h b/mlir/include/mlir/Dialect/Tosa/IR/TargetEnv.h
index cdbebd581d9f5..9ee5079559d2b 100644
--- a/mlir/include/mlir/Dialect/Tosa/IR/TargetEnv.h
+++ b/mlir/include/mlir/Dialect/Tosa/IR/TargetEnv.h
@@ -43,32 +43,22 @@ class TargetEnv {
bool allows(Profile prof) const { return enabledProfiles.count(prof) != 0; }
bool allowsAnyOf(ArrayRef<Profile> profs) const {
- const auto *chosen = llvm::find_if(
- profs, [this](tosa::Profile prof) { return allows(prof); });
- return chosen != profs.end() ? true : false;
+ return llvm::any_of(profs, [&](Profile prof) { return allows(prof); });
}
bool allowsAllOf(ArrayRef<Profile> profs) const {
- bool is_allowed = true;
- llvm::for_each(profs,
- [&](tosa::Profile prof) { is_allowed &= allows(prof); });
- return is_allowed;
+ return llvm::all_of(profs, [&](Profile prof) { return allows(prof); });
}
// Returns true if the given extension is allowed.
bool allows(Extension ext) const { return enabledExtensions.count(ext) != 0; }
bool allowsAnyOf(ArrayRef<Extension> exts) const {
- const auto *chosen = llvm::find_if(
- exts, [this](tosa::Extension ext) { return allows(ext); });
- return chosen != exts.end() ? true : false;
+ return llvm::any_of(exts, [&](Extension ext) { return allows(ext); });
}
bool allowsAllOf(ArrayRef<Extension> exts) const {
- bool is_allowed = true;
- llvm::for_each(exts,
- [&](tosa::Extension ext) { is_allowed &= allows(ext); });
- return is_allowed;
+ return llvm::all_of(exts, [&](Extension ext) { return allows(ext); });
}
private:
``````````
</details>
https://github.com/llvm/llvm-project/pull/146947
More information about the Mlir-commits
mailing list