Skip to content

Commit e71686e

Browse files
[TargetParser] Avoid repeated hash lookups (NFC) (#131555)
1 parent 8789c00 commit e71686e

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

llvm/lib/TargetParser/RISCVISAInfo.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -839,10 +839,11 @@ void RISCVISAInfo::updateImplication() {
839839
std::for_each(Range.first, Range.second,
840840
[&](const ImpliedExtsEntry &Implied) {
841841
const char *ImpliedExt = Implied.ImpliedExt;
842-
if (Exts.count(ImpliedExt))
842+
auto [It, Inserted] = Exts.try_emplace(ImpliedExt);
843+
if (!Inserted)
843844
return;
844845
auto Version = findDefaultVersion(ImpliedExt);
845-
Exts[ImpliedExt] = *Version;
846+
It->second = *Version;
846847
WorkList.push_back(ImpliedExt);
847848
});
848849
}

0 commit comments

Comments
 (0)