[llvm-branch-commits] [llvm] fe67401 - [NFC][ScheduleDAG] Use structure bindings and emplace_back
Pavel Samolysov via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Mon Sep 12 05:38:25 PDT 2022
Author: Pavel Samolysov
Date: 2022-09-12T15:38:11+03:00
New Revision: fe67401fd8140787b0591bb0e1de39ad78f34456
URL: https://github.com/llvm/llvm-project/commit/fe67401fd8140787b0591bb0e1de39ad78f34456
DIFF: https://github.com/llvm/llvm-project/commit/fe67401fd8140787b0591bb0e1de39ad78f34456.diff
LOG: [NFC][ScheduleDAG] Use structure bindings and emplace_back
Some uses of std::make_pair and the std::pair's first/second members
in the ScheduleDAGRRList.cpp file were replaced with using of the
vector's emplace_back along with structure bindings from C++17.
Added:
Modified:
llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
Removed:
################################################################################
diff --git a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
index 12450b6602ea..04a8b4d3b42e 100644
--- a/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
+++ b/llvm/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp
@@ -1204,11 +1204,11 @@ SUnit *ScheduleDAGRRList::CopyAndMoveSuccessors(SUnit *SU) {
D.setSUnit(NewSU);
AddPredQueued(SuccSU, D);
D.setSUnit(SU);
- DelDeps.push_back(std::make_pair(SuccSU, D));
+ DelDeps.emplace_back(SuccSU, D);
}
}
- for (auto &DelDep : DelDeps)
- RemovePred(DelDep.first, DelDep.second);
+ for (const auto &[DelSU, DelD] : DelDeps)
+ RemovePred(DelSU, DelD);
AvailableQueue->updateNode(SU);
AvailableQueue->addNode(NewSU);
@@ -1242,17 +1242,17 @@ void ScheduleDAGRRList::InsertCopiesAndMoveSuccs(SUnit *SU, unsigned Reg,
SDep D = Succ;
D.setSUnit(CopyToSU);
AddPredQueued(SuccSU, D);
- DelDeps.push_back(std::make_pair(SuccSU, Succ));
+ DelDeps.emplace_back(SuccSU, Succ);
}
else {
- // Avoid scheduling the def-side copy before other successors. Otherwise
+ // Avoid scheduling the def-side copy before other successors. Otherwise,
// we could introduce another physreg interference on the copy and
// continue inserting copies indefinitely.
AddPredQueued(SuccSU, SDep(CopyFromSU, SDep::Artificial));
}
}
- for (auto &DelDep : DelDeps)
- RemovePred(DelDep.first, DelDep.second);
+ for (const auto &[DelSU, DelD] : DelDeps)
+ RemovePred(DelSU, DelD);
SDep FromDep(SU, SDep::Data, Reg);
FromDep.setLatency(SU->Latency);
@@ -1484,16 +1484,15 @@ SUnit *ScheduleDAGRRList::PickNodeToScheduleBottomUp() {
if (LRegs[0] == TRI->getNumRegs()) dbgs() << "CallResource";
else dbgs() << printReg(LRegs[0], TRI);
dbgs() << " SU #" << CurSU->NodeNum << '\n');
- std::pair<LRegsMapT::iterator, bool> LRegsPair =
- LRegsMap.insert(std::make_pair(CurSU, LRegs));
- if (LRegsPair.second) {
+ auto [LRegsIter, LRegsInserted] = LRegsMap.try_emplace(CurSU, LRegs);
+ if (LRegsInserted) {
CurSU->isPending = true; // This SU is not in AvailableQueue right now.
Interferences.push_back(CurSU);
}
else {
assert(CurSU->isPending && "Interferences are pending");
// Update the interference with current live regs.
- LRegsPair.first->second = LRegs;
+ LRegsIter->second = LRegs;
}
CurSU = AvailableQueue->pop();
}
More information about the llvm-branch-commits
mailing list