mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 02:33:06 +01:00
[llvm] Use llvm::find (NFC)
This commit is contained in:
parent
02241dff2c
commit
f118370581
@ -18957,8 +18957,7 @@ SDValue DAGCombiner::reduceBuildVecToShuffle(SDNode *N) {
|
||||
// Have we seen this input vector before?
|
||||
// The vectors are expected to be tiny (usually 1 or 2 elements), so using
|
||||
// a map back from SDValues to numbers isn't worth it.
|
||||
unsigned Idx = std::distance(
|
||||
VecIn.begin(), std::find(VecIn.begin(), VecIn.end(), ExtractedFromVec));
|
||||
unsigned Idx = std::distance(VecIn.begin(), find(VecIn, ExtractedFromVec));
|
||||
if (Idx == VecIn.size())
|
||||
VecIn.push_back(ExtractedFromVec);
|
||||
|
||||
|
@ -30,8 +30,7 @@ Error InstructionTables::execute(InstRef &IR) {
|
||||
if (!Resource.second.size())
|
||||
continue;
|
||||
unsigned Cycles = Resource.second.size();
|
||||
unsigned Index = std::distance(
|
||||
Masks.begin(), std::find(Masks.begin(), Masks.end(), Resource.first));
|
||||
unsigned Index = std::distance(Masks.begin(), find(Masks, Resource.first));
|
||||
const MCProcResourceDesc &ProcResource = *SM.getProcResource(Index);
|
||||
unsigned NumUnits = ProcResource.NumUnits;
|
||||
if (!ProcResource.SubUnitsIdxBegin) {
|
||||
|
@ -39,9 +39,7 @@ public:
|
||||
HandleSet() : Process(nullptr) {}
|
||||
~HandleSet();
|
||||
|
||||
HandleList::iterator Find(void *Handle) {
|
||||
return std::find(Handles.begin(), Handles.end(), Handle);
|
||||
}
|
||||
HandleList::iterator Find(void *Handle) { return find(Handles, Handle); }
|
||||
|
||||
bool Contains(void *Handle) {
|
||||
return Handle == Process || Find(Handle) != Handles.end();
|
||||
|
@ -527,7 +527,7 @@ void HexagonSubtarget::restoreLatency(SUnit *Src, SUnit *Dst) const {
|
||||
|
||||
// Update the latency of opposite edge too.
|
||||
T.setSUnit(Src);
|
||||
auto F = std::find(Dst->Preds.begin(), Dst->Preds.end(), T);
|
||||
auto F = find(Dst->Preds, T);
|
||||
assert(F != Dst->Preds.end());
|
||||
F->setLatency(I.getLatency());
|
||||
}
|
||||
@ -544,7 +544,7 @@ void HexagonSubtarget::changeLatency(SUnit *Src, SUnit *Dst, unsigned Lat)
|
||||
|
||||
// Update the latency of opposite edge too.
|
||||
T.setSUnit(Src);
|
||||
auto F = std::find(Dst->Preds.begin(), Dst->Preds.end(), T);
|
||||
auto F = find(Dst->Preds, T);
|
||||
assert(F != Dst->Preds.end());
|
||||
F->setLatency(Lat);
|
||||
}
|
||||
|
@ -206,9 +206,9 @@ static bool splitMBB(BlockSplitInfo &BSI) {
|
||||
NewMBB->splice(NewMBB->end(), ThisMBB, InsertPoint, ThisMBB->end());
|
||||
NewMBB->transferSuccessors(ThisMBB);
|
||||
if (!ProbOrigTarget.isUnknown()) {
|
||||
auto MBBI = std::find(NewMBB->succ_begin(), NewMBB->succ_end(), OrigTarget);
|
||||
auto MBBI = find(NewMBB->successors(), OrigTarget);
|
||||
NewMBB->setSuccProbability(MBBI, ProbOrigTarget);
|
||||
MBBI = std::find(NewMBB->succ_begin(), NewMBB->succ_end(), OrigFallThrough);
|
||||
MBBI = find(NewMBB->successors(), OrigFallThrough);
|
||||
NewMBB->setSuccProbability(MBBI, ProbOrigFallThrough);
|
||||
}
|
||||
|
||||
|
@ -347,9 +347,8 @@ bool GuardWideningImpl::eliminateInstrViaWidening(
|
||||
const auto &GuardsInCurBB = GuardsInBlock.find(CurBB)->second;
|
||||
|
||||
auto I = GuardsInCurBB.begin();
|
||||
auto E = Instr->getParent() == CurBB
|
||||
? std::find(GuardsInCurBB.begin(), GuardsInCurBB.end(), Instr)
|
||||
: GuardsInCurBB.end();
|
||||
auto E = Instr->getParent() == CurBB ? find(GuardsInCurBB, Instr)
|
||||
: GuardsInCurBB.end();
|
||||
|
||||
#ifndef NDEBUG
|
||||
{
|
||||
|
@ -413,14 +413,14 @@ class VPBlockBase {
|
||||
|
||||
/// Remove \p Predecessor from the predecessors of this block.
|
||||
void removePredecessor(VPBlockBase *Predecessor) {
|
||||
auto Pos = std::find(Predecessors.begin(), Predecessors.end(), Predecessor);
|
||||
auto Pos = find(Predecessors, Predecessor);
|
||||
assert(Pos && "Predecessor does not exist");
|
||||
Predecessors.erase(Pos);
|
||||
}
|
||||
|
||||
/// Remove \p Successor from the successors of this block.
|
||||
void removeSuccessor(VPBlockBase *Successor) {
|
||||
auto Pos = std::find(Successors.begin(), Successors.end(), Successor);
|
||||
auto Pos = find(Successors, Successor);
|
||||
assert(Pos && "Successor does not exist");
|
||||
Successors.erase(Pos);
|
||||
}
|
||||
|
@ -121,8 +121,7 @@ void GIMatchTreeBuilderLeafInfo::declareInstr(const GIMatchDagInstr *Instr, unsi
|
||||
Info.bindOperandVariable(VarBinding.second, ID, VarBinding.first);
|
||||
|
||||
// Clear the bit indicating we haven't visited this instr.
|
||||
const auto &NodeI = std::find(MatchDag.instr_nodes_begin(),
|
||||
MatchDag.instr_nodes_end(), Instr);
|
||||
const auto &NodeI = find(MatchDag.instr_nodes(), Instr);
|
||||
assert(NodeI != MatchDag.instr_nodes_end() && "Instr isn't in this DAG");
|
||||
unsigned InstrIdx = MatchDag.getInstrNodeIdx(NodeI);
|
||||
RemainingInstrNodes.reset(InstrIdx);
|
||||
|
@ -730,10 +730,8 @@ void SubtargetEmitter::EmitLoadStoreQueueInfo(const CodeGenProcModel &ProcModel,
|
||||
unsigned QueueID = 0;
|
||||
if (ProcModel.LoadQueue) {
|
||||
const Record *Queue = ProcModel.LoadQueue->getValueAsDef("QueueDescriptor");
|
||||
QueueID =
|
||||
1 + std::distance(ProcModel.ProcResourceDefs.begin(),
|
||||
std::find(ProcModel.ProcResourceDefs.begin(),
|
||||
ProcModel.ProcResourceDefs.end(), Queue));
|
||||
QueueID = 1 + std::distance(ProcModel.ProcResourceDefs.begin(),
|
||||
find(ProcModel.ProcResourceDefs, Queue));
|
||||
}
|
||||
OS << " " << QueueID << ", // Resource Descriptor for the Load Queue\n";
|
||||
|
||||
@ -741,10 +739,8 @@ void SubtargetEmitter::EmitLoadStoreQueueInfo(const CodeGenProcModel &ProcModel,
|
||||
if (ProcModel.StoreQueue) {
|
||||
const Record *Queue =
|
||||
ProcModel.StoreQueue->getValueAsDef("QueueDescriptor");
|
||||
QueueID =
|
||||
1 + std::distance(ProcModel.ProcResourceDefs.begin(),
|
||||
std::find(ProcModel.ProcResourceDefs.begin(),
|
||||
ProcModel.ProcResourceDefs.end(), Queue));
|
||||
QueueID = 1 + std::distance(ProcModel.ProcResourceDefs.begin(),
|
||||
find(ProcModel.ProcResourceDefs, Queue));
|
||||
}
|
||||
OS << " " << QueueID << ", // Resource Descriptor for the Store Queue\n";
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user