Author: Kazu Hirata Date: 2021-10-18T09:33:42-07:00 New Revision: 8568ca789ec105ed96196d82c861116540433b89
URL: https://github.com/llvm/llvm-project/commit/8568ca789ec105ed96196d82c861116540433b89 DIFF: https://github.com/llvm/llvm-project/commit/8568ca789ec105ed96196d82c861116540433b89.diff LOG: Use llvm::erase_if (NFC) Added: Modified: lld/COFF/Writer.cpp lld/lib/Core/Resolver.cpp lldb/source/Breakpoint/BreakpointList.cpp llvm/include/llvm/Analysis/InlineOrder.h llvm/lib/CodeGen/LiveInterval.cpp llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp polly/lib/Analysis/ScopInfo.cpp Removed: ################################################################################ diff --git a/lld/COFF/Writer.cpp b/lld/COFF/Writer.cpp index 6641db119064f..600d14034dea8 100644 --- a/lld/COFF/Writer.cpp +++ b/lld/COFF/Writer.cpp @@ -1090,18 +1090,14 @@ void Writer::removeUnusedSections() { // later. Only remove sections that have no Chunks at all. return s->chunks.empty(); }; - ctx.outputSections.erase(std::remove_if(ctx.outputSections.begin(), - ctx.outputSections.end(), isUnused), - ctx.outputSections.end()); + llvm::erase_if(ctx.outputSections, isUnused); } // The Windows loader doesn't seem to like empty sections, // so we remove them if any. void Writer::removeEmptySections() { auto isEmpty = [](OutputSection *s) { return s->getVirtualSize() == 0; }; - ctx.outputSections.erase(std::remove_if(ctx.outputSections.begin(), - ctx.outputSections.end(), isEmpty), - ctx.outputSections.end()); + llvm::erase_if(ctx.outputSections, isEmpty); } void Writer::assignOutputSectionIndices() { diff --git a/lld/lib/Core/Resolver.cpp b/lld/lib/Core/Resolver.cpp index 17a46056f00c1..1ed0b1c6e618b 100644 --- a/lld/lib/Core/Resolver.cpp +++ b/lld/lib/Core/Resolver.cpp @@ -380,11 +380,9 @@ void Resolver::deadStripOptimize() { markLive(dsrAtom); // now remove all non-live atoms from _atoms - _atoms.erase(std::remove_if(_atoms.begin(), _atoms.end(), - [&](OwningAtomPtr<Atom> &a) { - return _liveAtoms.count(a.get()) == 0; - }), - _atoms.end()); + llvm::erase_if(_atoms, [&](OwningAtomPtr<Atom> &a) { + return _liveAtoms.count(a.get()) == 0; + }); } // error out if some undefines remain @@ -396,10 +394,8 @@ bool Resolver::checkUndefines() { std::vector<const UndefinedAtom *> undefinedAtoms = _symbolTable.undefines(); if (_ctx.deadStrip()) { // When dead code stripping, we don't care if dead atoms are undefined. - undefinedAtoms.erase( - std::remove_if(undefinedAtoms.begin(), undefinedAtoms.end(), - [&](const Atom *a) { return _liveAtoms.count(a) == 0; }), - undefinedAtoms.end()); + llvm::erase_if(undefinedAtoms, + [&](const Atom *a) { return _liveAtoms.count(a) == 0; }); } if (undefinedAtoms.empty()) @@ -440,12 +436,9 @@ void Resolver::removeCoalescedAwayAtoms() { DEBUG_WITH_TYPE("resolver", llvm::dbgs() << "******** Removing coalesced away atoms:\n"); ScopedTask task(getDefaultDomain(), "removeCoalescedAwayAtoms"); - _atoms.erase(std::remove_if(_atoms.begin(), _atoms.end(), - [&](OwningAtomPtr<Atom> &a) { - return _symbolTable.isCoalescedAway(a.get()) || - _deadAtoms.count(a.get()); - }), - _atoms.end()); + llvm::erase_if(_atoms, [&](OwningAtomPtr<Atom> &a) { + return _symbolTable.isCoalescedAway(a.get()) || _deadAtoms.count(a.get()); + }); } bool Resolver::resolve() { diff --git a/lldb/source/Breakpoint/BreakpointList.cpp b/lldb/source/Breakpoint/BreakpointList.cpp index a00f6bed61816..ca181ee306a4e 100644 --- a/lldb/source/Breakpoint/BreakpointList.cpp +++ b/lldb/source/Breakpoint/BreakpointList.cpp @@ -101,10 +101,8 @@ void BreakpointList::RemoveAllowed(bool notify) { NotifyChange(bp_sp, eBreakpointEventTypeRemoved); } - m_breakpoints.erase( - std::remove_if(m_breakpoints.begin(), m_breakpoints.end(), - [&](const BreakpointSP &bp) { return bp->AllowDelete(); }), - m_breakpoints.end()); + llvm::erase_if(m_breakpoints, + [&](const BreakpointSP &bp) { return bp->AllowDelete(); }); } BreakpointList::bp_collection::iterator diff --git a/llvm/include/llvm/Analysis/InlineOrder.h b/llvm/include/llvm/Analysis/InlineOrder.h index a2de8469cb0a6..def3192356f48 100644 --- a/llvm/include/llvm/Analysis/InlineOrder.h +++ b/llvm/include/llvm/Analysis/InlineOrder.h @@ -160,8 +160,7 @@ class PriorityInlineOrder : public InlineOrder<std::pair<CallBase *, int>> { auto PredWrapper = [=](HeapT P) -> bool { return Pred(std::make_pair(P.first, 0)); }; - Heap.erase(std::remove_if(Heap.begin(), Heap.end(), PredWrapper), - Heap.end()); + llvm::erase_if(Heap, PredWrapper); std::make_heap(Heap.begin(), Heap.end(), cmp); } diff --git a/llvm/lib/CodeGen/LiveInterval.cpp b/llvm/lib/CodeGen/LiveInterval.cpp index 1eed0ec5bbbe8..1ff9813c992a5 100644 --- a/llvm/lib/CodeGen/LiveInterval.cpp +++ b/llvm/lib/CodeGen/LiveInterval.cpp @@ -631,9 +631,8 @@ void LiveRange::removeSegment(SlotIndex Start, SlotIndex End, /// Also remove the value# from value# list. void LiveRange::removeValNo(VNInfo *ValNo) { if (empty()) return; - segments.erase(remove_if(*this, [ValNo](const Segment &S) { - return S.valno == ValNo; - }), end()); + llvm::erase_if(segments, + [ValNo](const Segment &S) { return S.valno == ValNo; }); // Now that ValNo is dead, remove it. markValNoForDeletion(ValNo); } diff --git a/llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp b/llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp index 08e1dacf7bad6..d55bf3917e9c1 100644 --- a/llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp +++ b/llvm/lib/Target/AMDGPU/AMDGPUReplaceLDSUseWithPointer.cpp @@ -130,11 +130,9 @@ class ReplaceLDSUseImpl { std::vector<GlobalVariable *> LDSGlobals = AMDGPU::findVariablesToLower(M); // Remove LDS which don't qualify for replacement. - LDSGlobals.erase(std::remove_if(LDSGlobals.begin(), LDSGlobals.end(), - [&](GlobalVariable *GV) { - return shouldIgnorePointerReplacement(GV); - }), - LDSGlobals.end()); + llvm::erase_if(LDSGlobals, [&](GlobalVariable *GV) { + return shouldIgnorePointerReplacement(GV); + }); return LDSGlobals; } diff --git a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp index 7bc8ebcdcdb74..8cf96f64d9d54 100644 --- a/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp +++ b/llvm/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp @@ -2027,12 +2027,8 @@ SDValue WebAssemblyTargetLowering::LowerBUILD_VECTOR(SDValue Op, size_t NumShuffleLanes = 0; if (ShuffleCounts.size()) { std::tie(ShuffleSrc1, NumShuffleLanes) = GetMostCommon(ShuffleCounts); - ShuffleCounts.erase(std::remove_if(ShuffleCounts.begin(), - ShuffleCounts.end(), - [&](const auto &Pair) { - return Pair.first == ShuffleSrc1; - }), - ShuffleCounts.end()); + llvm::erase_if(ShuffleCounts, + [&](const auto &Pair) { return Pair.first == ShuffleSrc1; }); } if (ShuffleCounts.size()) { size_t AdditionalShuffleLanes; diff --git a/polly/lib/Analysis/ScopInfo.cpp b/polly/lib/Analysis/ScopInfo.cpp index dc2d4848ba3bc..06b0aa3c3e8df 100644 --- a/polly/lib/Analysis/ScopInfo.cpp +++ b/polly/lib/Analysis/ScopInfo.cpp @@ -1303,8 +1303,7 @@ void ScopStmt::removeMemoryAccess(MemoryAccess *MA) { Parent.removeAccessData(MA); } } - MemAccs.erase(std::remove_if(MemAccs.begin(), MemAccs.end(), Predicate), - MemAccs.end()); + llvm::erase_if(MemAccs, Predicate); InstructionToAccess.erase(MA->getAccessInstruction()); } _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits