@@ -282,13 +282,13 @@ RegisterBankInfo::getPartialMapping(unsigned StartIdx, unsigned Length,
282
282
++NumPartialMappingsAccessed;
283
283
284
284
hash_code Hash = hashPartialMapping (StartIdx, Length, &RegBank);
285
- const auto &It = MapOfPartialMappings.find (Hash);
286
- if (It != MapOfPartialMappings. end () )
285
+ auto [It, Inserted] = MapOfPartialMappings.try_emplace (Hash);
286
+ if (!Inserted )
287
287
return *It->second ;
288
288
289
289
++NumPartialMappingsCreated;
290
290
291
- auto &PartMapping = MapOfPartialMappings[Hash] ;
291
+ auto &PartMapping = It-> second ;
292
292
PartMapping = std::make_unique<PartialMapping>(StartIdx, Length, RegBank);
293
293
return *PartMapping;
294
294
}
@@ -316,13 +316,13 @@ RegisterBankInfo::getValueMapping(const PartialMapping *BreakDown,
316
316
++NumValueMappingsAccessed;
317
317
318
318
hash_code Hash = hashValueMapping (BreakDown, NumBreakDowns);
319
- const auto &It = MapOfValueMappings.find (Hash);
320
- if (It != MapOfValueMappings. end () )
319
+ auto [It, Inserted] = MapOfValueMappings.try_emplace (Hash);
320
+ if (!Inserted )
321
321
return *It->second ;
322
322
323
323
++NumValueMappingsCreated;
324
324
325
- auto &ValMapping = MapOfValueMappings[Hash] ;
325
+ auto &ValMapping = It-> second ;
326
326
ValMapping = std::make_unique<ValueMapping>(BreakDown, NumBreakDowns);
327
327
return *ValMapping;
328
328
}
@@ -390,13 +390,13 @@ RegisterBankInfo::getInstructionMappingImpl(
390
390
391
391
hash_code Hash =
392
392
hashInstructionMapping (ID, Cost, OperandsMapping, NumOperands);
393
- const auto &It = MapOfInstructionMappings.find (Hash);
394
- if (It != MapOfInstructionMappings. end () )
393
+ auto [It, Inserted] = MapOfInstructionMappings.try_emplace (Hash);
394
+ if (!Inserted )
395
395
return *It->second ;
396
396
397
397
++NumInstructionMappingsCreated;
398
398
399
- auto &InstrMapping = MapOfInstructionMappings[Hash] ;
399
+ auto &InstrMapping = It-> second ;
400
400
InstrMapping = std::make_unique<InstructionMapping>(
401
401
ID, Cost, OperandsMapping, NumOperands);
402
402
return *InstrMapping;
0 commit comments