[llvm] [Scalar] Use std::none_of (NFC) (PR #143282)

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 7 12:52:12 PDT 2025


================
@@ -786,8 +786,7 @@ class ControlFlowHoister {
       return InitialPreheader;
     }
     BranchInst *BI = It->first;
-    assert(std::find_if(++It, HoistableBranches.end(), HasBBAsSuccessor) ==
-               HoistableBranches.end() &&
+    assert(std::none_of(++It, HoistableBranches.end(), HasBBAsSuccessor) &&
----------------
kazutakahirata wrote:

Yes, that's correct.  However, in this case, `It` isn't used after this point, so it doesn't matter.  That said, it may be clearer to replace `++It` with `std::next(It)` because it's not immediately obvious that `It` isn't used after this point. 

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


More information about the llvm-commits mailing list