From 8b4d487fa22ffba4cfd9ea23d6d5d20120dc6dc4 Mon Sep 17 00:00:00 2001 From: Kazu Hirata Date: Mon, 18 Jan 2021 10:16:36 -0800 Subject: [PATCH] [llvm] Use the default value of drop_begin (NFC) --- lib/Analysis/LoopInfo.cpp | 2 +- lib/Analysis/ModuleSummaryAnalysis.cpp | 2 +- lib/Analysis/ScalarEvolution.cpp | 2 +- lib/Analysis/VFABIDemangling.cpp | 2 +- lib/CodeGen/CodeGenPrepare.cpp | 4 ++-- lib/CodeGen/SafeStackLayout.cpp | 2 +- lib/CodeGen/SelectionDAG/LegalizeDAG.cpp | 2 +- lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp | 4 ++-- lib/Target/WebAssembly/WebAssemblyRegStackify.cpp | 4 ++-- lib/Target/X86/X86MCInstLower.cpp | 4 ++-- lib/Transforms/IPO/OpenMPOpt.cpp | 2 +- lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp | 2 +- lib/Transforms/IPO/WholeProgramDevirt.cpp | 2 +- lib/Transforms/Scalar/LoopInterchange.cpp | 4 ++-- tools/llvm-xray/xray-stacks.cpp | 2 +- 15 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lib/Analysis/LoopInfo.cpp b/lib/Analysis/LoopInfo.cpp index e925e0d2064..a85869b1633 100644 --- a/lib/Analysis/LoopInfo.cpp +++ b/lib/Analysis/LoopInfo.cpp @@ -567,7 +567,7 @@ bool Loop::isAnnotatedParallel() const { SmallPtrSet ParallelAccessGroups; // For scalable 'contains' check. if (ParallelAccesses) { - for (const MDOperand &MD : drop_begin(ParallelAccesses->operands(), 1)) { + for (const MDOperand &MD : drop_begin(ParallelAccesses->operands())) { MDNode *AccGroup = cast(MD.get()); assert(isValidAsAccessGroup(AccGroup) && "List item must be an access group"); diff --git a/lib/Analysis/ModuleSummaryAnalysis.cpp b/lib/Analysis/ModuleSummaryAnalysis.cpp index ed544c28499..5f7746eeed1 100644 --- a/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -145,7 +145,7 @@ static void addVCallToSet(DevirtCallSite Call, GlobalValue::GUID Guid, SetVector &ConstVCalls) { std::vector Args; // Start from the second argument to skip the "this" pointer. - for (auto &Arg : drop_begin(Call.CB.args(), 1)) { + for (auto &Arg : drop_begin(Call.CB.args())) { auto *CI = dyn_cast(Arg); if (!CI || CI->getBitWidth() > 64) { VCalls.insert({Guid, Call.Offset}); diff --git a/lib/Analysis/ScalarEvolution.cpp b/lib/Analysis/ScalarEvolution.cpp index 2f5c91aafd3..f8c297fb3da 100644 --- a/lib/Analysis/ScalarEvolution.cpp +++ b/lib/Analysis/ScalarEvolution.cpp @@ -3274,7 +3274,7 @@ const SCEV *ScalarEvolution::getUDivExactExpr(const SCEV *LHS, // first element of the mulexpr. if (const auto *LHSCst = dyn_cast(Mul->getOperand(0))) { if (LHSCst == RHSCst) { - SmallVector Operands(drop_begin(Mul->operands(), 1)); + SmallVector Operands(drop_begin(Mul->operands())); return getMulExpr(Operands); } diff --git a/lib/Analysis/VFABIDemangling.cpp b/lib/Analysis/VFABIDemangling.cpp index 27b48b310af..faa46537ad1 100644 --- a/lib/Analysis/VFABIDemangling.cpp +++ b/lib/Analysis/VFABIDemangling.cpp @@ -290,7 +290,7 @@ bool verifyAllVectorsHaveSameWidth(FunctionType *Signature) { assert(VecTys.size() > 1 && "Invalid number of elements."); const ElementCount EC = VecTys[0]->getElementCount(); - return llvm::all_of(llvm::drop_begin(VecTys, 1), [&EC](VectorType *VTy) { + return llvm::all_of(llvm::drop_begin(VecTys), [&EC](VectorType *VTy) { return (EC == VTy->getElementCount()); }); } diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index 2c636e1ac04..c2fccab947d 100644 --- a/lib/CodeGen/CodeGenPrepare.cpp +++ b/lib/CodeGen/CodeGenPrepare.cpp @@ -661,7 +661,7 @@ bool CodeGenPrepare::eliminateFallThrough(Function &F) { // Use a temporary array to avoid iterator being invalidated when // deleting blocks. SmallVector Blocks; - for (auto &Block : llvm::drop_begin(F, 1)) + for (auto &Block : llvm::drop_begin(F)) Blocks.push_back(&Block); SmallSet Preds; @@ -747,7 +747,7 @@ bool CodeGenPrepare::eliminateMostlyEmptyBlocks(Function &F) { // as we remove them. // Note that this intentionally skips the entry block. SmallVector Blocks; - for (auto &Block : llvm::drop_begin(F, 1)) + for (auto &Block : llvm::drop_begin(F)) Blocks.push_back(&Block); for (auto &Block : Blocks) { diff --git a/lib/CodeGen/SafeStackLayout.cpp b/lib/CodeGen/SafeStackLayout.cpp index 5bd4f4d60d7..5d61b3a146b 100644 --- a/lib/CodeGen/SafeStackLayout.cpp +++ b/lib/CodeGen/SafeStackLayout.cpp @@ -140,7 +140,7 @@ void StackLayout::computeLayout() { // Sort objects by size (largest first) to reduce fragmentation. if (StackObjects.size() > 2) - llvm::stable_sort(drop_begin(StackObjects, 1), + llvm::stable_sort(drop_begin(StackObjects), [](const StackObject &a, const StackObject &b) { return a.Size > b.Size; }); diff --git a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp index ee781d4aa1d..62d7191036c 100644 --- a/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp +++ b/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp @@ -2194,7 +2194,7 @@ void SelectionDAGLegalize::ExpandFPLibCall(SDNode* Node, if (Node->isStrictFPOpcode()) { EVT RetVT = Node->getValueType(0); - SmallVector Ops(drop_begin(Node->ops(), 1)); + SmallVector Ops(drop_begin(Node->ops())); TargetLowering::MakeLibCallOptions CallOptions; // FIXME: This doesn't support tail calls. std::pair Tmp = TLI.makeLibCall(DAG, LC, RetVT, diff --git a/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp b/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp index e1ab64c8c37..08f4ab87c68 100644 --- a/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp +++ b/lib/Target/NVPTX/NVPTXISelDAGToDAG.cpp @@ -2854,7 +2854,7 @@ bool NVPTXDAGToDAGISel::tryTextureIntrinsic(SDNode *N) { } // Copy over operands - SmallVector Ops(drop_begin(N->ops(), 1)); + SmallVector Ops(drop_begin(N->ops())); Ops.push_back(N->getOperand(0)); // Move chain to the back. ReplaceNode(N, CurDAG->getMachineNode(Opc, SDLoc(N), N->getVTList(), Ops)); @@ -3363,7 +3363,7 @@ bool NVPTXDAGToDAGISel::trySurfaceIntrinsic(SDNode *N) { } // Copy over operands - SmallVector Ops(drop_begin(N->ops(), 1)); + SmallVector Ops(drop_begin(N->ops())); Ops.push_back(N->getOperand(0)); // Move chain to the back. ReplaceNode(N, CurDAG->getMachineNode(Opc, SDLoc(N), N->getVTList(), Ops)); diff --git a/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp b/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp index b106b8238eb..d474b9a2c1e 100644 --- a/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp +++ b/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp @@ -342,7 +342,7 @@ static bool isSafeToMove(const MachineOperand *Def, const MachineOperand *Use, // instruction in which the current value is used, we cannot // stackify. Stackifying in this case would require that def moving below the // current def in the stack, which cannot be achieved, even with locals. - for (const auto &SubsequentDef : drop_begin(DefI->defs(), 1)) { + for (const auto &SubsequentDef : drop_begin(DefI->defs())) { for (const auto &PriorUse : UseI->uses()) { if (&PriorUse == Use) break; @@ -701,7 +701,7 @@ public: MachineOperand &pop() { RangeTy &Range = Worklist.back(); MachineOperand &Op = *Range.begin(); - Range = drop_begin(Range, 1); + Range = drop_begin(Range); if (Range.empty()) Worklist.pop_back(); assert((Worklist.empty() || !Worklist.back().empty()) && diff --git a/lib/Target/X86/X86MCInstLower.cpp b/lib/Target/X86/X86MCInstLower.cpp index 4cbf7a40ad4..89fa3ae3a3f 100644 --- a/lib/Target/X86/X86MCInstLower.cpp +++ b/lib/Target/X86/X86MCInstLower.cpp @@ -1710,7 +1710,7 @@ void X86AsmPrinter::LowerPATCHABLE_RET(const MachineInstr &MI, unsigned OpCode = MI.getOperand(0).getImm(); MCInst Ret; Ret.setOpcode(OpCode); - for (auto &MO : drop_begin(MI.operands(), 1)) + for (auto &MO : drop_begin(MI.operands())) if (auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO)) Ret.addOperand(MaybeOperand.getValue()); OutStreamer->emitInstruction(Ret, getSubtargetInfo()); @@ -1749,7 +1749,7 @@ void X86AsmPrinter::LowerPATCHABLE_TAIL_CALL(const MachineInstr &MI, // Before emitting the instruction, add a comment to indicate that this is // indeed a tail call. OutStreamer->AddComment("TAILCALL"); - for (auto &MO : drop_begin(MI.operands(), 1)) + for (auto &MO : drop_begin(MI.operands())) if (auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO)) TC.addOperand(MaybeOperand.getValue()); OutStreamer->emitInstruction(TC, getSubtargetInfo()); diff --git a/lib/Transforms/IPO/OpenMPOpt.cpp b/lib/Transforms/IPO/OpenMPOpt.cpp index 3de930cb3d1..a5ba6edb9a0 100644 --- a/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/lib/Transforms/IPO/OpenMPOpt.cpp @@ -739,7 +739,7 @@ private: << ore::NV("OpenMPParallelMergeFront", MergableCIs.front()->getDebugLoc()) << " merged with parallel regions at "; - for (auto *CI : llvm::drop_begin(MergableCIs, 1)) { + for (auto *CI : llvm::drop_begin(MergableCIs)) { OR << ore::NV("OpenMPParallelMerge", CI->getDebugLoc()); if (CI != MergableCIs.back()) OR << ", "; diff --git a/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp b/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp index 2209f3b8d47..76a88ea6b2e 100644 --- a/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp +++ b/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp @@ -261,7 +261,7 @@ void splitAndWriteThinLTOBitcode( if (!RT || RT->getBitWidth() > 64 || F->arg_empty() || !F->arg_begin()->use_empty()) return; - for (auto &Arg : drop_begin(F->args(), 1)) { + for (auto &Arg : drop_begin(F->args())) { auto *ArgT = dyn_cast(Arg.getType()); if (!ArgT || ArgT->getBitWidth() > 64) return; diff --git a/lib/Transforms/IPO/WholeProgramDevirt.cpp b/lib/Transforms/IPO/WholeProgramDevirt.cpp index 5591fa2fe15..dc498719c12 100644 --- a/lib/Transforms/IPO/WholeProgramDevirt.cpp +++ b/lib/Transforms/IPO/WholeProgramDevirt.cpp @@ -470,7 +470,7 @@ CallSiteInfo &VTableSlotInfo::findCallSiteInfo(CallBase &CB) { auto *CBType = dyn_cast(CB.getType()); if (!CBType || CBType->getBitWidth() > 64 || CB.arg_empty()) return CSInfo; - for (auto &&Arg : drop_begin(CB.args(), 1)) { + for (auto &&Arg : drop_begin(CB.args())) { auto *CI = dyn_cast(Arg); if (!CI || CI->getBitWidth() > 64) return CSInfo; diff --git a/lib/Transforms/Scalar/LoopInterchange.cpp b/lib/Transforms/Scalar/LoopInterchange.cpp index f676ffc18e2..a93273970a2 100644 --- a/lib/Transforms/Scalar/LoopInterchange.cpp +++ b/lib/Transforms/Scalar/LoopInterchange.cpp @@ -1580,9 +1580,9 @@ bool LoopInterchangeTransform::adjustLoopBranches() { // Now update the reduction PHIs in the inner and outer loop headers. SmallVector InnerLoopPHIs, OuterLoopPHIs; - for (PHINode &PHI : drop_begin(InnerLoopHeader->phis(), 1)) + for (PHINode &PHI : drop_begin(InnerLoopHeader->phis())) InnerLoopPHIs.push_back(cast(&PHI)); - for (PHINode &PHI : drop_begin(OuterLoopHeader->phis(), 1)) + for (PHINode &PHI : drop_begin(OuterLoopHeader->phis())) OuterLoopPHIs.push_back(cast(&PHI)); auto &OuterInnerReductions = LIL.getOuterInnerReductions(); diff --git a/tools/llvm-xray/xray-stacks.cpp b/tools/llvm-xray/xray-stacks.cpp index 5f96b7050ca..d04b998dacc 100644 --- a/tools/llvm-xray/xray-stacks.cpp +++ b/tools/llvm-xray/xray-stacks.cpp @@ -456,7 +456,7 @@ public: int Level = 0; OS << formatv("{0,-5} {1,-60} {2,+12} {3,+16}\n", "lvl", "function", "count", "sum"); - for (auto *F : reverse(drop_begin(CurrentStack, 1))) { + for (auto *F : reverse(drop_begin(CurrentStack))) { auto Sum = std::accumulate(F->ExtraData.IntermediateDurations.begin(), F->ExtraData.IntermediateDurations.end(), 0LL); auto FuncId = FN.SymbolOrNumber(F->FuncId);