-
Notifications
You must be signed in to change notification settings - Fork 15k
[mlir] Use llvm::any_of and llvm::all_of (NFC) #146947
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[mlir] Use llvm::any_of and llvm::all_of (NFC) #146947
Conversation
|
@llvm/pr-subscribers-mlir-tosa Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/146947.diff 1 Files Affected:
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:
|
|
@llvm/pr-subscribers-mlir Author: Kazu Hirata (kazutakahirata) ChangesFull diff: https://github.com/llvm/llvm-project/pull/146947.diff 1 Files Affected:
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the cleanup!
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/94/builds/8563 Here is the relevant piece of the build log for the reference |
No description provided.