[Mlir-commits] [mlir] ba9c262 - [mlir] Use llvm::any_of and llvm::all_of (NFC) (#146947)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Jul 3 16:31:15 PDT 2025
Author: Kazu Hirata
Date: 2025-07-03T16:31:11-07:00
New Revision: ba9c262a97113fb63daf760359f6e190beb8957a
URL: https://github.com/llvm/llvm-project/commit/ba9c262a97113fb63daf760359f6e190beb8957a
DIFF: https://github.com/llvm/llvm-project/commit/ba9c262a97113fb63daf760359f6e190beb8957a.diff
LOG: [mlir] Use llvm::any_of and llvm::all_of (NFC) (#146947)
Added:
Modified:
mlir/include/mlir/Dialect/Tosa/IR/TargetEnv.h
Removed:
################################################################################
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:
More information about the Mlir-commits
mailing list