diff --git a/lib/Analysis/LazyCallGraph.cpp b/lib/Analysis/LazyCallGraph.cpp index ef16f94822a..f2c85a69f12 100644 --- a/lib/Analysis/LazyCallGraph.cpp +++ b/lib/Analysis/LazyCallGraph.cpp @@ -866,7 +866,7 @@ LazyCallGraph::RefSCC::switchInternalEdgeToRef(Node &SourceN, Node &TargetN) { PendingSCCStack.clear(); while (!DFSStack.empty()) OldSCC.Nodes.push_back(DFSStack.pop_back_val().first); - for (Node &N : make_range(OldSCC.begin() + OldSize, OldSCC.end())) { + for (Node &N : drop_begin(OldSCC, OldSize)) { N.DFSNumber = N.LowLink = -1; G->SCCMap[&N] = &OldSCC; } diff --git a/lib/Analysis/ModuleSummaryAnalysis.cpp b/lib/Analysis/ModuleSummaryAnalysis.cpp index 7d06aac0861..ed544c28499 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 : make_range(Call.CB.arg_begin() + 1, Call.CB.arg_end())) { + for (auto &Arg : drop_begin(Call.CB.args(), 1)) { auto *CI = dyn_cast(Arg); if (!CI || CI->getBitWidth() > 64) { VCalls.insert({Guid, Call.Offset}); diff --git a/lib/Analysis/VFABIDemangling.cpp b/lib/Analysis/VFABIDemangling.cpp index 4cdffa63135..27b48b310af 100644 --- a/lib/Analysis/VFABIDemangling.cpp +++ b/lib/Analysis/VFABIDemangling.cpp @@ -290,9 +290,9 @@ bool verifyAllVectorsHaveSameWidth(FunctionType *Signature) { assert(VecTys.size() > 1 && "Invalid number of elements."); const ElementCount EC = VecTys[0]->getElementCount(); - return llvm::all_of( - llvm::make_range(VecTys.begin() + 1, VecTys.end()), - [&EC](VectorType *VTy) { return (EC == VTy->getElementCount()); }); + return llvm::all_of(llvm::drop_begin(VecTys, 1), [&EC](VectorType *VTy) { + return (EC == VTy->getElementCount()); + }); } #endif // NDEBUG diff --git a/lib/CodeGen/CodeGenPrepare.cpp b/lib/CodeGen/CodeGenPrepare.cpp index 564a3d7d9bc..2c636e1ac04 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::make_range(std::next(F.begin()), F.end())) + for (auto &Block : llvm::drop_begin(F, 1)) 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::make_range(std::next(F.begin()), F.end())) + for (auto &Block : llvm::drop_begin(F, 1)) Blocks.push_back(&Block); for (auto &Block : Blocks) { diff --git a/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp b/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp index f9f342a07f6..fa12fe1da44 100644 --- a/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp +++ b/lib/Target/Hexagon/MCTargetDesc/HexagonMCInstrInfo.cpp @@ -110,7 +110,7 @@ HexagonMCInstrInfo::bundleInstructions(MCInstrInfo const &MCII, iterator_range HexagonMCInstrInfo::bundleInstructions(MCInst const &MCI) { assert(isBundle(MCI)); - return make_range(MCI.begin() + bundleInstructionsOffset, MCI.end()); + return drop_begin(MCI, bundleInstructionsOffset); } size_t HexagonMCInstrInfo::bundleSize(MCInst const &MCI) { diff --git a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index c693bef6d32..e348bba2b04 100644 --- a/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -977,8 +977,7 @@ WebAssemblyTargetLowering::LowerCall(CallLoweringInfo &CLI, /*isSS=*/false); unsigned ValNo = 0; SmallVector Chains; - for (SDValue Arg : - make_range(OutVals.begin() + NumFixedArgs, OutVals.end())) { + for (SDValue Arg : drop_begin(OutVals, NumFixedArgs)) { assert(ArgLocs[ValNo].getValNo() == ValNo && "ArgLocs should remain in order and only hold varargs args"); unsigned Offset = ArgLocs[ValNo++].getLocMemOffset(); diff --git a/lib/Target/X86/X86MCInstLower.cpp b/lib/Target/X86/X86MCInstLower.cpp index 8505934acb1..4cbf7a40ad4 100644 --- a/lib/Target/X86/X86MCInstLower.cpp +++ b/lib/Target/X86/X86MCInstLower.cpp @@ -1334,7 +1334,7 @@ void X86AsmPrinter::LowerPATCHABLE_OP(const MachineInstr &MI, MCInst MCI; MCI.setOpcode(Opcode); - for (auto &MO : make_range(MI.operands_begin() + 2, MI.operands_end())) + for (auto &MO : drop_begin(MI.operands(), 2)) if (auto MaybeOperand = MCIL.LowerMachineOperand(&MI, MO)) MCI.addOperand(MaybeOperand.getValue()); @@ -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 : make_range(MI.operands_begin() + 1, MI.operands_end())) + for (auto &MO : drop_begin(MI.operands(), 1)) 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 : make_range(MI.operands_begin() + 1, MI.operands_end())) + for (auto &MO : drop_begin(MI.operands(), 1)) 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 fc3cc90c6f8..97a263bdbdc 100644 --- a/lib/Transforms/IPO/OpenMPOpt.cpp +++ b/lib/Transforms/IPO/OpenMPOpt.cpp @@ -739,8 +739,7 @@ private: << ore::NV("OpenMPParallelMergeFront", MergableCIs.front()->getDebugLoc()) << " merged with parallel regions at "; - for (auto *CI : - llvm::make_range(MergableCIs.begin() + 1, MergableCIs.end())) { + for (auto *CI : llvm::drop_begin(MergableCIs, 1)) { 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 1b419be57d5..2209f3b8d47 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 : make_range(std::next(F->arg_begin()), F->arg_end())) { + for (auto &Arg : drop_begin(F->args(), 1)) { 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 9e962a2e0d6..091259ec605 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 : make_range(CB.arg_begin() + 1, CB.arg_end())) { + for (auto &&Arg : drop_begin(CB.args(), 1)) { auto *CI = dyn_cast(Arg); if (!CI || CI->getBitWidth() > 64) return CSInfo; diff --git a/tools/llvm-xray/xray-stacks.cpp b/tools/llvm-xray/xray-stacks.cpp index b317ae67619..5f96b7050ca 100644 --- a/tools/llvm-xray/xray-stacks.cpp +++ b/tools/llvm-xray/xray-stacks.cpp @@ -456,8 +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(make_range(CurrentStack.begin() + 1, CurrentStack.end()))) { + for (auto *F : reverse(drop_begin(CurrentStack, 1))) { auto Sum = std::accumulate(F->ExtraData.IntermediateDurations.begin(), F->ExtraData.IntermediateDurations.end(), 0LL); auto FuncId = FN.SymbolOrNumber(F->FuncId);