Skip to content

Commit d3ca484

Browse files
[LiveDebugValues] Avoid repeated hash lookups (NFC) (#110379)
1 parent f8bd98b commit d3ca484

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

llvm/lib/CodeGen/LiveDebugValues/InstrRefBasedImpl.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3958,12 +3958,10 @@ class LDVSSAUpdater {
39583958
/// For a given MBB, create a wrapper block for it. Stores it in the
39593959
/// LDVSSAUpdater block map.
39603960
LDVSSABlock *getSSALDVBlock(MachineBasicBlock *BB) {
3961-
auto it = BlockMap.find(BB);
3962-
if (it == BlockMap.end()) {
3963-
BlockMap[BB] = new LDVSSABlock(*BB, *this);
3964-
it = BlockMap.find(BB);
3965-
}
3966-
return it->second;
3961+
auto [It, Inserted] = BlockMap.try_emplace(BB);
3962+
if (Inserted)
3963+
It->second = new LDVSSABlock(*BB, *this);
3964+
return It->second;
39673965
}
39683966

39693967
/// Find the live-in value number for the given block. Looks up the value at

0 commit comments

Comments
 (0)