Skip to content

Commit a754bc2

Browse files
[CodeGen] Avoid repeated map lookups (NFC) (#140662)
1 parent 95202ab commit a754bc2

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

llvm/lib/CodeGen/RDFLiveness.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -603,11 +603,8 @@ void Liveness::computePhiInfo() {
603603
for (NodeAddr<DefNode *> D : Ds) {
604604
if (D.Addr->getFlags() & NodeAttrs::PhiRef) {
605605
NodeId RP = D.Addr->getOwner(DFG).Id;
606-
std::map<NodeId, RegisterAggr> &M = PhiUp[PUA.Id];
607-
auto F = M.find(RP);
608-
if (F == M.end())
609-
M.insert(std::make_pair(RP, DefRRs));
610-
else
606+
auto [F, Inserted] = PhiUp[PUA.Id].try_emplace(RP, DefRRs);
607+
if (!Inserted)
611608
F->second.insert(DefRRs);
612609
}
613610
DefRRs.insert(D.Addr->getRegRef(DFG));

0 commit comments

Comments
 (0)