[Driver] Avoid repeated map lookups (NFC) (#122625)

This commit is contained in:
Kazu Hirata 2025-01-11 19:49:59 -08:00 committed by GitHub
parent 5e4b41c1d5
commit 4f6fabd11a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2534,8 +2534,8 @@ enum {
static unsigned PrintActions1(const Compilation &C, Action *A,
std::map<Action *, unsigned> &Ids,
Twine Indent = {}, int Kind = TopLevelAction) {
if (Ids.count(A)) // A was already visited.
return Ids[A];
if (auto It = Ids.find(A); It != Ids.end()) // A was already visited.
return It->second;
std::string str;
llvm::raw_string_ostream os(str);