Skip to content

Commit ba9c262

Browse files
[mlir] Use llvm::any_of and llvm::all_of (NFC) (#146947)
1 parent 7e04bfb commit ba9c262

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

mlir/include/mlir/Dialect/Tosa/IR/TargetEnv.h

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -43,32 +43,22 @@ class TargetEnv {
4343
bool allows(Profile prof) const { return enabledProfiles.count(prof) != 0; }
4444

4545
bool allowsAnyOf(ArrayRef<Profile> profs) const {
46-
const auto *chosen = llvm::find_if(
47-
profs, [this](tosa::Profile prof) { return allows(prof); });
48-
return chosen != profs.end() ? true : false;
46+
return llvm::any_of(profs, [&](Profile prof) { return allows(prof); });
4947
}
5048

5149
bool allowsAllOf(ArrayRef<Profile> profs) const {
52-
bool is_allowed = true;
53-
llvm::for_each(profs,
54-
[&](tosa::Profile prof) { is_allowed &= allows(prof); });
55-
return is_allowed;
50+
return llvm::all_of(profs, [&](Profile prof) { return allows(prof); });
5651
}
5752

5853
// Returns true if the given extension is allowed.
5954
bool allows(Extension ext) const { return enabledExtensions.count(ext) != 0; }
6055

6156
bool allowsAnyOf(ArrayRef<Extension> exts) const {
62-
const auto *chosen = llvm::find_if(
63-
exts, [this](tosa::Extension ext) { return allows(ext); });
64-
return chosen != exts.end() ? true : false;
57+
return llvm::any_of(exts, [&](Extension ext) { return allows(ext); });
6558
}
6659

6760
bool allowsAllOf(ArrayRef<Extension> exts) const {
68-
bool is_allowed = true;
69-
llvm::for_each(exts,
70-
[&](tosa::Extension ext) { is_allowed &= allows(ext); });
71-
return is_allowed;
61+
return llvm::all_of(exts, [&](Extension ext) { return allows(ext); });
7262
}
7363

7464
private:

0 commit comments

Comments
 (0)