diff --git a/llvm/lib/Transforms/Scalar/LICM.cpp b/llvm/lib/Transforms/Scalar/LICM.cpp index 7965ed76a81b7..9773ef778b690 100644 --- a/llvm/lib/Transforms/Scalar/LICM.cpp +++ b/llvm/lib/Transforms/Scalar/LICM.cpp @@ -786,8 +786,8 @@ class ControlFlowHoister { return InitialPreheader; } BranchInst *BI = It->first; - assert(std::find_if(++It, HoistableBranches.end(), HasBBAsSuccessor) == - HoistableBranches.end() && + assert(std::none_of(std::next(It), HoistableBranches.end(), + HasBBAsSuccessor) && "BB is expected to be the target of at most one branch"); LLVMContext &C = BB->getContext();