diff options
author | Kazu Hirata <kazu@google.com> | 2025-05-22 23:50:58 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-05-22 23:50:58 -0700 |
commit | cc78177e8f50f1d217b2fba5677fc1664aabd91e (patch) | |
tree | 29723bff7e4aa91ccee9c273b9a5b4172e6e1822 /llvm/lib/Analysis/ScalarEvolution.cpp | |
parent | 05674b21fed51a940b93e09b38d1833010f3f694 (diff) | |
download | llvm-cc78177e8f50f1d217b2fba5677fc1664aabd91e.zip llvm-cc78177e8f50f1d217b2fba5677fc1664aabd91e.tar.gz llvm-cc78177e8f50f1d217b2fba5677fc1664aabd91e.tar.bz2 |
[llvm] Use *Map::try_emplace (NFC) (#141190)
try_emplace can default-construct values, so we do not need to do so
on our own. Plus, try_emplace(Key) is much simpler/shorter than
insert({Key, LongValueType()}).
Diffstat (limited to 'llvm/lib/Analysis/ScalarEvolution.cpp')
-rw-r--r-- | llvm/lib/Analysis/ScalarEvolution.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/lib/Analysis/ScalarEvolution.cpp b/llvm/lib/Analysis/ScalarEvolution.cpp index 5e01c29..b0975df 100644 --- a/llvm/lib/Analysis/ScalarEvolution.cpp +++ b/llvm/lib/Analysis/ScalarEvolution.cpp @@ -8371,7 +8371,7 @@ ScalarEvolution::getPredicatedBackedgeTakenInfo(const Loop *L) { if (BTI.hasFullInfo()) return BTI; - auto Pair = PredicatedBackedgeTakenCounts.insert({L, BackedgeTakenInfo()}); + auto Pair = PredicatedBackedgeTakenCounts.try_emplace(L); if (!Pair.second) return Pair.first->second; @@ -8390,7 +8390,7 @@ ScalarEvolution::getBackedgeTakenInfo(const Loop *L) { // code elsewhere that it shouldn't attempt to request a new // backedge-taken count, which could result in infinite recursion. std::pair<DenseMap<const Loop *, BackedgeTakenInfo>::iterator, bool> Pair = - BackedgeTakenCounts.insert({L, BackedgeTakenInfo()}); + BackedgeTakenCounts.try_emplace(L); if (!Pair.second) return Pair.first->second; |