Skip to content

Commit af6c699

Browse files
[TableGen] Avoid repeated hash lookups (NFC) (llvm#126433)
1 parent df25511 commit af6c699

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

llvm/utils/TableGen/Common/CodeGenSchedule.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,9 @@ void CodeGenSchedModels::collectSTIPredicates() {
413413
for (const Record *R : Records.getAllDerivedDefinitions("STIPredicate")) {
414414
const Record *Decl = R->getValueAsDef("Declaration");
415415

416-
const auto It = Decl2Index.find(Decl);
417-
if (It == Decl2Index.end()) {
418-
Decl2Index[Decl] = STIPredicates.size();
416+
const auto [It, Inserted] =
417+
Decl2Index.try_emplace(Decl, STIPredicates.size());
418+
if (Inserted) {
419419
STIPredicateFunction Predicate(Decl);
420420
Predicate.addDefinition(R);
421421
STIPredicates.emplace_back(std::move(Predicate));

0 commit comments

Comments
 (0)