Author: Kazu Hirata Date: 2022-08-27T09:53:10-07:00 New Revision: a33ef8f2b7b28e4ae50a6e4fa206f82d3b230a68
URL: https://github.com/llvm/llvm-project/commit/a33ef8f2b7b28e4ae50a6e4fa206f82d3b230a68 DIFF: https://github.com/llvm/llvm-project/commit/a33ef8f2b7b28e4ae50a6e4fa206f82d3b230a68.diff LOG: Use llvm::all_equal (NFC) Added: Modified: clang/lib/Driver/Action.cpp clang/lib/Driver/Driver.cpp clang/lib/Driver/ToolChains/AMDGPU.cpp llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h llvm/lib/Target/X86/X86ISelLowering.cpp llvm/lib/Transforms/IPO/PartialInlining.cpp llvm/lib/Transforms/Scalar/GVNSink.cpp llvm/lib/Transforms/Vectorize/LoopVectorize.cpp mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td Removed: ################################################################################ diff --git a/clang/lib/Driver/Action.cpp b/clang/lib/Driver/Action.cpp index cc7a59f9d956..1cb68276e11e 100644 --- a/clang/lib/Driver/Action.cpp +++ b/clang/lib/Driver/Action.cpp @@ -198,7 +198,7 @@ OffloadAction::OffloadAction(const DeviceDependences &DDeps, types::ID Ty) auto &OTCs = DDeps.getToolChains(); // If all inputs agree on the same kind, use it also for this action. - if (llvm::all_of(OKinds, [&](OffloadKind K) { return K == OKinds.front(); })) + if (llvm::all_equal(OKinds)) OffloadingDeviceKind = OKinds.front(); // If we have a single dependency, inherit the architecture from it. diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp index d23a8931a8a8..db6e4898ed55 100644 --- a/clang/lib/Driver/Driver.cpp +++ b/clang/lib/Driver/Driver.cpp @@ -991,9 +991,7 @@ bool Driver::loadConfigFile() { std::vector<std::string> ConfigFiles = CLOptions->getAllArgValues(options::OPT_config); if (ConfigFiles.size() > 1) { - if (!llvm::all_of(ConfigFiles, [ConfigFiles](const std::string &s) { - return s == ConfigFiles[0]; - })) { + if (!llvm::all_equal(ConfigFiles)) { Diag(diag::err_drv_duplicate_config); return true; } diff --git a/clang/lib/Driver/ToolChains/AMDGPU.cpp b/clang/lib/Driver/ToolChains/AMDGPU.cpp index 8718ab53ac1a..89f8e482ded6 100644 --- a/clang/lib/Driver/ToolChains/AMDGPU.cpp +++ b/clang/lib/Driver/ToolChains/AMDGPU.cpp @@ -804,10 +804,7 @@ llvm::Error AMDGPUToolChain::getSystemGPUArch(const ArgList &Args, } GPUArch = GPUArchs[0]; if (GPUArchs.size() > 1) { - bool AllSame = llvm::all_of(GPUArchs, [&](const StringRef &GPUArch) { - return GPUArch == GPUArchs.front(); - }); - if (!AllSame) + if (!llvm::all_equal(GPUArchs)) return llvm::createStringError( std::error_code(), "Multiple AMD GPUs found with diff erent archs"); } diff --git a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h index 876526093591..71862e85b49c 100644 --- a/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h +++ b/llvm/lib/Target/AArch64/MCTargetDesc/AArch64AddressingModes.h @@ -755,7 +755,7 @@ static inline uint64_t decodeAdvSIMDModImmType12(uint8_t Imm) { template <typename T> static inline bool isSVEMaskOfIdenticalElements(int64_t Imm) { auto Parts = bit_cast<std::array<T, sizeof(int64_t) / sizeof(T)>>(Imm); - return all_of(Parts, [&](T Elem) { return Elem == Parts[0]; }); + return llvm::all_equal(Parts); } /// Returns true if Imm is valid for CPY/DUP. diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 59333bf1b843..369c7d3d6504 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -53986,7 +53986,7 @@ static SDValue combineConcatVectorOps(const SDLoc &DL, MVT VT, return getZeroVector(VT, Subtarget, DAG, DL); SDValue Op0 = Ops[0]; - bool IsSplat = llvm::all_of(Ops, [&Op0](SDValue Op) { return Op == Op0; }); + bool IsSplat = llvm::all_equal(Ops); // Repeated subvectors. if (IsSplat && diff --git a/llvm/lib/Transforms/IPO/PartialInlining.cpp b/llvm/lib/Transforms/IPO/PartialInlining.cpp index d2b37f6a5c0d..653addd726c5 100644 --- a/llvm/lib/Transforms/IPO/PartialInlining.cpp +++ b/llvm/lib/Transforms/IPO/PartialInlining.cpp @@ -1083,10 +1083,8 @@ void PartialInlinerImpl::FunctionCloner::normalizeReturnBlock() const { return; auto IsTrivialPhi = [](PHINode *PN) -> Value * { - Value *CommonValue = PN->getIncomingValue(0); - if (all_of(PN->incoming_values(), - [&](Value *V) { return V == CommonValue; })) - return CommonValue; + if (llvm::all_equal(PN->incoming_values())) + return PN->getIncomingValue(0); return nullptr; }; diff --git a/llvm/lib/Transforms/Scalar/GVNSink.cpp b/llvm/lib/Transforms/Scalar/GVNSink.cpp index 6fc6a931a861..891f7d72529e 100644 --- a/llvm/lib/Transforms/Scalar/GVNSink.cpp +++ b/llvm/lib/Transforms/Scalar/GVNSink.cpp @@ -288,7 +288,7 @@ class ModelledPHI { ArrayRef<Value *> getValues() const { return Values; } bool areAllIncomingValuesSame() const { - return llvm::all_of(Values, [&](Value *V) { return V == Values[0]; }); + return llvm::all_equal(Values); } bool areAllIncomingValuesSameType() const { diff --git a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp index b62e41ae7144..244b2875d043 100644 --- a/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp +++ b/llvm/lib/Transforms/Vectorize/LoopVectorize.cpp @@ -8258,12 +8258,8 @@ VPRecipeOrVPValueTy VPRecipeBuilder::tryToBlend(PHINode *Phi, VPlanPtr &Plan) { // If all incoming values are equal, the incoming VPValue can be used directly // instead of creating a new VPBlendRecipe. - VPValue *FirstIncoming = Operands[0]; - if (all_of(Operands, [FirstIncoming](const VPValue *Inc) { - return FirstIncoming == Inc; - })) { + if (llvm::all_equal(Operands)) return Operands[0]; - } unsigned NumIncoming = Phi->getNumIncomingValues(); // For in-loop reductions, we do not need to create an additional select. diff --git a/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td b/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td index 760b0d027add..618d5b08b4b7 100644 --- a/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td +++ b/mlir/lib/Dialect/Shape/IR/ShapeCanonicalization.td @@ -3,9 +3,7 @@ include "mlir/Dialect/Shape/IR/ShapeOps.td" include "mlir/Dialect/Tensor/IR/TensorOps.td" def AllInputShapesEq : Constraint<CPred< [{ - llvm::all_of($0, [&](mlir::Value val) { - return $0[0] == val; - }) + llvm::all_equal($0) }]>>; def HasSingleElement : Constraint<CPred< [{ _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits