diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp index e7bdce1bffcc11..5fd41293018102 100644 --- a/clang/lib/AST/Expr.cpp +++ b/clang/lib/AST/Expr.cpp @@ -4831,7 +4831,7 @@ RecoveryExpr::RecoveryExpr(ASTContext &Ctx, QualType T, SourceLocation BeginLoc, OK_Ordinary), BeginLoc(BeginLoc), EndLoc(EndLoc), NumExprs(SubExprs.size()) { assert(!T.isNull()); - assert(llvm::all_of(SubExprs, [](Expr* E) { return E != nullptr; })); + assert(!llvm::is_contained(SubExprs, nullptr)); llvm::copy(SubExprs, getTrailingObjects()); setDependence(computeDependence(this)); diff --git a/llvm/lib/CodeGen/WinEHPrepare.cpp b/llvm/lib/CodeGen/WinEHPrepare.cpp index b835503ee9edbe..a71f6572e76f96 100644 --- a/llvm/lib/CodeGen/WinEHPrepare.cpp +++ b/llvm/lib/CodeGen/WinEHPrepare.cpp @@ -847,10 +847,7 @@ void WinEHPrepare::cloneCommonBlocks(Function &F) { ColorVector &IncomingColors = BlockColors[IncomingBlock]; assert(!IncomingColors.empty() && "Block not colored!"); assert((IncomingColors.size() == 1 || - llvm::all_of(IncomingColors, - [&](BasicBlock *Color) { - return Color != FuncletPadBB; - })) && + !llvm::is_contained(IncomingColors, FuncletPadBB)) && "Cloning should leave this funclet's blocks monochromatic"); EdgeTargetsFunclet = (IncomingColors.front() == FuncletPadBB); } diff --git a/llvm/lib/IR/Instructions.cpp b/llvm/lib/IR/Instructions.cpp index 6a79d2b1e36763..78c13e698d6ca3 100644 --- a/llvm/lib/IR/Instructions.cpp +++ b/llvm/lib/IR/Instructions.cpp @@ -2511,7 +2511,7 @@ static bool isReplicationMaskWithParams(ArrayRef Mask, bool ShuffleVectorInst::isReplicationMask(ArrayRef Mask, int &ReplicationFactor, int &VF) { // undef-less case is trivial. - if (none_of(Mask, [](int MaskElt) { return MaskElt == UndefMaskElem; })) { + if (!llvm::is_contained(Mask, UndefMaskElem)) { ReplicationFactor = Mask.take_while([](int MaskElt) { return MaskElt == 0; }).size(); if (ReplicationFactor == 0 || Mask.size() % ReplicationFactor != 0) diff --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp index 93269da8b81470..73844ca8c088ef 100644 --- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp +++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp @@ -4277,9 +4277,7 @@ bool SIInstrInfo::verifyInstruction(const MachineInstr &MI, if (usesConstantBus(MRI, MO, MI.getDesc().OpInfo[OpIdx])) { if (MO.isReg()) { SGPRUsed = MO.getReg(); - if (llvm::all_of(SGPRsUsed, [SGPRUsed](unsigned SGPR) { - return SGPRUsed != SGPR; - })) { + if (!llvm::is_contained(SGPRsUsed, SGPRUsed)) { ++ConstantBusCount; SGPRsUsed.push_back(SGPRUsed); } diff --git a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp index 70ea68587b8e5e..6c62e84077acef 100644 --- a/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp +++ b/llvm/lib/Transforms/AggressiveInstCombine/TruncInstCombine.cpp @@ -157,7 +157,7 @@ bool TruncInstCombine::buildTruncExpressionGraph() { getRelevantOperands(I, Operands); // Add only operands not in Stack to prevent cycle for (auto *Op : Operands) - if (all_of(Stack, [Op](Value *V) { return Op != V; })) + if (!llvm::is_contained(Stack, Op)) Worklist.push_back(Op); break; } diff --git a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp index d435a7d76d0ded..1fd12b441272be 100644 --- a/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp +++ b/llvm/lib/Transforms/InstCombine/InstCombineVectorOps.cpp @@ -859,8 +859,7 @@ Instruction *InstCombinerImpl::foldAggregateConstructionIntoAggregateReuse( // Do we know values for each element of the aggregate? auto KnowAllElts = [&AggElts]() { - return all_of(AggElts, - [](Optional Elt) { return Elt != NotFound; }); + return !llvm::is_contained(AggElts, NotFound); }; int Depth = 0; diff --git a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp index ca6c15692c635b..8e9b2c0b57dd02 100644 --- a/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp +++ b/llvm/lib/Transforms/Scalar/LoopStrengthReduce.cpp @@ -2413,9 +2413,7 @@ LSRInstance::OptimizeLoopTermCond() { BasicBlock *LatchBlock = L->getLoopLatch(); SmallVector ExitingBlocks; L->getExitingBlocks(ExitingBlocks); - if (llvm::all_of(ExitingBlocks, [&LatchBlock](const BasicBlock *BB) { - return LatchBlock != BB; - })) { + if (!llvm::is_contained(ExitingBlocks, LatchBlock)) { // The backedge doesn't exit the loop; treat this as a head-tested loop. IVIncInsertPos = LatchBlock->getTerminator(); return; diff --git a/llvm/lib/Transforms/Vectorize/VPlan.h b/llvm/lib/Transforms/Vectorize/VPlan.h index 009913f5a5eb2b..75a544a3825026 100644 --- a/llvm/lib/Transforms/Vectorize/VPlan.h +++ b/llvm/lib/Transforms/Vectorize/VPlan.h @@ -1489,9 +1489,7 @@ class VPInterleaveRecipe : public VPRecipeBase { bool onlyFirstLaneUsed(const VPValue *Op) const override { assert(is_contained(operands(), Op) && "Op must be an operand of the recipe"); - return Op == getAddr() && all_of(getStoredValues(), [Op](VPValue *StoredV) { - return Op != StoredV; - }); + return Op == getAddr() && !llvm::is_contained(getStoredValues(), Op); } }; diff --git a/mlir/include/mlir/Analysis/Presburger/Utils.h b/mlir/include/mlir/Analysis/Presburger/Utils.h index bc3006abe7ca4d..6d81c65b0faeaf 100644 --- a/mlir/include/mlir/Analysis/Presburger/Utils.h +++ b/mlir/include/mlir/Analysis/Presburger/Utils.h @@ -129,9 +129,7 @@ class DivisionRepr { // Check whether the `i^th` division has a division representation or not. bool hasRepr(unsigned i) const { return denoms[i] != 0; } // Check whether all the divisions have a division representation or not. - bool hasAllReprs() const { - return all_of(denoms, [](unsigned denom) { return denom != 0; }); - } + bool hasAllReprs() const { return !llvm::is_contained(denoms, 0); } // Clear the division representation of the i^th local variable. void clearRepr(unsigned i) { denoms[i] = 0; } diff --git a/mlir/include/mlir/Dialect/Quant/QuantTypes.h b/mlir/include/mlir/Dialect/Quant/QuantTypes.h index 17d350c9f0e303..260a9ba6f5641d 100644 --- a/mlir/include/mlir/Dialect/Quant/QuantTypes.h +++ b/mlir/include/mlir/Dialect/Quant/QuantTypes.h @@ -371,8 +371,7 @@ class UniformQuantizedPerAxisType bool isFixedPoint() const { if (!isSigned()) return false; - return llvm::all_of(getZeroPoints(), - [](int64_t zeroPoint) { return zeroPoint != 0; }); + return !llvm::is_contained(getZeroPoints(), 0); } };