[Mlir-commits] [mlir] [mlir] Use llvm::any_of and llvm::all_of (NFC) (PR #146947)

Kazu Hirata llvmlistbot at llvm.org
Thu Jul 3 15:53:48 PDT 2025


================
@@ -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); });
----------------
kazutakahirata wrote:

I'm using `&` to capture `this` because `&` is shorter than `this`.

https://github.com/llvm/llvm-project/pull/146947


More information about the Mlir-commits mailing list