From 9181ab9223e13d8e2294bf34a0a65fa19d734857 Mon Sep 17 00:00:00 2001 From: liqinweng Date: Tue, 23 Aug 2022 12:09:31 +0800 Subject: [PATCH] [NFC]] Use llvm::all_of instead of std::all_of Reviewed By: kazu Differential Revision: https://reviews.llvm.org/D131886 --- llvm/lib/Analysis/TypeMetadataUtils.cpp | 2 +- llvm/lib/IR/Verifier.cpp | 4 ++-- llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/llvm/lib/Analysis/TypeMetadataUtils.cpp b/llvm/lib/Analysis/TypeMetadataUtils.cpp index e128187bac49..1c9354fbe01f 100644 --- a/llvm/lib/Analysis/TypeMetadataUtils.cpp +++ b/llvm/lib/Analysis/TypeMetadataUtils.cpp @@ -61,7 +61,7 @@ static void findLoadCallsAtConstantOffset( } else if (auto GEP = dyn_cast(User)) { // Take into account the GEP offset. if (VPtr == GEP->getPointerOperand() && GEP->hasAllConstantIndices()) { - SmallVector Indices(GEP->op_begin() + 1, GEP->op_end()); + SmallVector Indices(drop_begin(GEP->operands())); int64_t GEPOffset = M->getDataLayout().getIndexedOffsetInType( GEP->getSourceElementType(), Indices); findLoadCallsAtConstantOffset(M, DevirtCalls, User, Offset + GEPOffset, diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp index 693757d90a1d..15f0a80b68dc 100644 --- a/llvm/lib/IR/Verifier.cpp +++ b/llvm/lib/IR/Verifier.cpp @@ -4526,8 +4526,8 @@ void Verifier::visitMemProfMetadata(Instruction &I, MDNode *MD) { visitCallStackMetadata(StackMD); // Check that remaining operands are MDString. - Check(std::all_of(MIB->op_begin() + 1, MIB->op_end(), - [](const MDOperand &Op) { return isa(Op); }), + Check(llvm::all_of(llvm::drop_begin(MIB->operands()), + [](const MDOperand &Op) { return isa(Op); }), "Not all !memprof MemInfoBlock operands 1 to N are MDString", MIB); } } diff --git a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp index 7e7183ef396f..d9bb5a248f00 100644 --- a/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp +++ b/llvm/lib/Target/SPIRV/SPIRVModuleAnalysis.cpp @@ -20,6 +20,7 @@ #include "SPIRVTargetMachine.h" #include "SPIRVUtils.h" #include "TargetInfo/SPIRVTargetInfo.h" +#include "llvm/ADT/STLExtras.h" #include "llvm/CodeGen/MachineModuleInfo.h" #include "llvm/CodeGen/TargetPassConfig.h" @@ -77,10 +78,7 @@ getSymbolicOperandRequirements(SPIRV::OperandCategory::OperandCategory Category, // If there are no capabilities, or we can't satisfy the version or // capability requirements, use the list of extensions (if the subtarget // can handle them all). - if (std::all_of(ReqExts.begin(), ReqExts.end(), - [&ST](const SPIRV::Extension::Extension &Ext) { - return ST.canUseExtension(Ext); - })) { + if (llvm::all_of(ReqExts, [&ST](const SPIRV::Extension::Extension &Ext) { return {true, {}, ReqExts, 0, 0}; // TODO: add versions to extensions. } return {false, {}, {}, 0, 0};