Skip to content

Commit 1ae5ecc

Browse files
[Utils] Avoid repeated hash lookups (NFC) (llvm#115262)
1 parent 937e506 commit 1ae5ecc

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

llvm/lib/Transforms/Utils/Local.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2178,11 +2178,9 @@ void llvm::insertDebugValuesForPHIs(BasicBlock *BB,
21782178
auto V = DbgValueMap.find(VI);
21792179
if (V != DbgValueMap.end()) {
21802180
auto *DbgII = cast<DbgVariableIntrinsic>(V->second);
2181-
auto NewDI = NewDbgValueMap.find({Parent, DbgII});
2182-
if (NewDI == NewDbgValueMap.end()) {
2183-
auto *NewDbgII = cast<DbgVariableIntrinsic>(DbgII->clone());
2184-
NewDI = NewDbgValueMap.insert({{Parent, DbgII}, NewDbgII}).first;
2185-
}
2181+
auto [NewDI, Inserted] = NewDbgValueMap.try_emplace({Parent, DbgII});
2182+
if (Inserted)
2183+
NewDI->second = cast<DbgVariableIntrinsic>(DbgII->clone());
21862184
DbgVariableIntrinsic *NewDbgII = NewDI->second;
21872185
// If PHI contains VI as an operand more than once, we may
21882186
// replaced it in NewDbgII; confirm that it is present.

0 commit comments

Comments
 (0)