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 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 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 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 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: