Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions mlir/include/mlir/Dialect/Tosa/IR/TargetEnv.h
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading