1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 02:52:53 +02:00

[Analysis, IR, CodeGen] Use llvm::erase_if (NFC)

This commit is contained in:
Kazu Hirata 2020-12-20 09:19:35 -08:00
parent 4a14b47a89
commit 0abf9f34bf
8 changed files with 24 additions and 36 deletions

View File

@ -1129,9 +1129,9 @@ public:
for (auto &KeyValuePair : OuterAnalysisInvalidationMap) {
AnalysisKey *OuterID = KeyValuePair.first;
auto &InnerIDs = KeyValuePair.second;
InnerIDs.erase(llvm::remove_if(InnerIDs, [&](AnalysisKey *InnerID) {
return Inv.invalidate(InnerID, IRUnit, PA); }),
InnerIDs.end());
llvm::erase_if(InnerIDs, [&](AnalysisKey *InnerID) {
return Inv.invalidate(InnerID, IRUnit, PA);
});
if (InnerIDs.empty())
DeadKeys.push_back(OuterID);
}

View File

@ -1039,9 +1039,7 @@ static LazyCallGraph::SCC &updateCGAndAnalysisManagerForPass(
DeadTargets.push_back(&E.getNode());
}
// Remove the easy cases quickly and actually pull them out of our list.
DeadTargets.erase(
llvm::remove_if(DeadTargets,
[&](Node *TargetN) {
llvm::erase_if(DeadTargets, [&](Node *TargetN) {
SCC &TargetC = *G.lookupSCC(*TargetN);
RefSCC &TargetRC = TargetC.getOuterRefSCC();
@ -1051,11 +1049,10 @@ static LazyCallGraph::SCC &updateCGAndAnalysisManagerForPass(
return false;
RC->removeOutgoingEdge(N, *TargetN);
LLVM_DEBUG(dbgs() << "Deleting outgoing edge from '"
<< N << "' to '" << TargetN << "'\n");
LLVM_DEBUG(dbgs() << "Deleting outgoing edge from '" << N << "' to '"
<< TargetN << "'\n");
return true;
}),
DeadTargets.end());
});
// Now do a batch removal of the internal ref edges left.
auto NewRefSCCs = RC->removeInternalRefEdge(N, DeadTargets);

View File

@ -11620,9 +11620,7 @@ static bool findArrayDimensionsRec(ScalarEvolution &SE,
}
// Remove all SCEVConstants.
Terms.erase(
remove_if(Terms, [](const SCEV *E) { return isa<SCEVConstant>(E); }),
Terms.end());
erase_if(Terms, [](const SCEV *E) { return isa<SCEVConstant>(E); });
if (Terms.size() > 0)
if (!findArrayDimensionsRec(SE, Terms, Sizes))

View File

@ -1636,9 +1636,7 @@ bool DwarfDebug::buildLocationList(SmallVectorImpl<DebugLocEntry> &DebugLoc,
// Remove all values that are no longer live.
size_t Index = std::distance(EB, EI);
auto Last =
remove_if(OpenRanges, [&](OpenRange &R) { return R.first <= Index; });
OpenRanges.erase(Last, OpenRanges.end());
erase_if(OpenRanges, [&](OpenRange &R) { return R.first <= Index; });
// If we are dealing with a clobbering entry, this iteration will result in
// a location list entry starting after the clobbering instruction.

View File

@ -300,7 +300,7 @@ NodeList Liveness::getAllReachingDefs(RegisterRef RefRR,
auto DeadP = [](const NodeAddr<DefNode*> DA) -> bool {
return DA.Addr->getFlags() & NodeAttrs::Dead;
};
RDefs.resize(std::distance(RDefs.begin(), llvm::remove_if(RDefs, DeadP)));
llvm::erase_if(RDefs, DeadP);
return RDefs;
}

View File

@ -361,10 +361,7 @@ StackMaps::parseRegisterLiveOutMask(const uint32_t *Mask) const {
}
}
LiveOuts.erase(
llvm::remove_if(LiveOuts,
[](const LiveOutReg &LO) { return LO.Reg == 0; }),
LiveOuts.end());
llvm::erase_if(LiveOuts, [](const LiveOutReg &LO) { return LO.Reg == 0; });
return LiveOuts;
}

View File

@ -1304,8 +1304,7 @@ public:
///
/// Erases all attachments matching the \c shouldRemove predicate.
template <class PredTy> void remove_if(PredTy shouldRemove) {
Attachments.erase(llvm::remove_if(Attachments, shouldRemove),
Attachments.end());
llvm::erase_if(Attachments, shouldRemove);
}
};

View File

@ -1169,11 +1169,10 @@ bool MDAttachments::erase(unsigned ID) {
return true;
}
auto I = std::remove_if(Attachments.begin(), Attachments.end(),
auto OldSize = Attachments.size();
llvm::erase_if(Attachments,
[ID](const Attachment &A) { return A.MDKind == ID; });
bool Changed = I != Attachments.end();
Attachments.erase(I, Attachments.end());
return Changed;
return OldSize != Attachments.size();
}
MDNode *Value::getMetadata(unsigned KindID) const {