Skip to content

Commit da06d9e

Browse files
authored
[CodeGen] Use insert idiom in CFIInstrInserter instead of find [nfc] (#170760)
1 parent be79a0d commit da06d9e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

llvm/lib/CodeGen/CFIInstrInserter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,8 @@ void CFIInstrInserter::calculateOutgoingCFAInfo(MBBCFAInfo &MBBInfo) {
279279
}
280280
if (CSRReg || CSROffset) {
281281
CSRSavedLocation Loc(CSRReg, CSROffset);
282-
auto It = CSRLocMap.find(CFI.getRegister());
283-
if (It == CSRLocMap.end()) {
284-
CSRLocMap.insert({CFI.getRegister(), Loc});
285-
} else if (It->second != Loc) {
282+
auto [It, Inserted] = CSRLocMap.insert({CFI.getRegister(), Loc});
283+
if (!Inserted && It->second != Loc) {
286284
reportFatalInternalError(
287285
"Different saved locations for the same CSR");
288286
}

0 commit comments

Comments
 (0)