@@ -311,15 +311,13 @@ static void processSTIPredicate(STIPredicateFunction &Fn,
311
311
ConstRecVec Classes = Def->getValueAsListOfDefs (" Classes" );
312
312
for (const Record *EC : Classes) {
313
313
const Record *Pred = EC->getValueAsDef (" Predicate" );
314
- if (! Predicate2Index.contains (Pred) )
315
- Predicate2Index[Pred] = NumUniquePredicates++ ;
314
+ if (Predicate2Index.try_emplace (Pred, NumUniquePredicates). second )
315
+ ++NumUniquePredicates ;
316
316
317
317
ConstRecVec Opcodes = EC->getValueAsListOfDefs (" Opcodes" );
318
318
for (const Record *Opcode : Opcodes) {
319
- if (!Opcode2Index.contains (Opcode)) {
320
- Opcode2Index[Opcode] = OpcodeMappings.size ();
319
+ if (Opcode2Index.try_emplace (Opcode, OpcodeMappings.size ()).second )
321
320
OpcodeMappings.emplace_back (Opcode, OpcodeInfo ());
322
- }
323
321
}
324
322
}
325
323
}
@@ -452,11 +450,9 @@ void CodeGenSchedModels::checkMCInstPredicates() const {
452
450
for (const Record *TIIPred :
453
451
Records.getAllDerivedDefinitions (" TIIPredicate" )) {
454
452
StringRef Name = TIIPred->getValueAsString (" FunctionName" );
455
- StringMap<const Record *>::const_iterator It = TIIPredicates.find (Name);
456
- if (It == TIIPredicates.end ()) {
457
- TIIPredicates[Name] = TIIPred;
453
+ auto [It, Inserted] = TIIPredicates.try_emplace (Name, TIIPred);
454
+ if (Inserted)
458
455
continue ;
459
- }
460
456
461
457
PrintError (TIIPred->getLoc (),
462
458
" TIIPredicate " + Name + " is multiply defined." );
0 commit comments