diff options
author | Jay Foad <jay.foad@amd.com> | 2020-11-26 16:48:14 +0000 |
---|---|---|
committer | Jay Foad <jay.foad@amd.com> | 2020-11-27 10:42:01 +0000 |
commit | 68ed6447855632b954b55f63807481eaa44705df (patch) | |
tree | 7072a1063e5674cbc834fc5f0ea1c799a1d4ea81 /llvm/lib/IR/LegacyPassManager.cpp | |
parent | 0d9166ff79578c7e98cef8c554e1342ece8efee6 (diff) | |
download | llvm-68ed6447855632b954b55f63807481eaa44705df.zip llvm-68ed6447855632b954b55f63807481eaa44705df.tar.gz llvm-68ed6447855632b954b55f63807481eaa44705df.tar.bz2 |
[LegacyPM] Avoid a redundant map lookup in setLastUser. NFC.
As a bonus this makes it (IMO) obvious that the iterator is not
invalidated, so remove the comment explaining that.
Diffstat (limited to 'llvm/lib/IR/LegacyPassManager.cpp')
-rw-r--r-- | llvm/lib/IR/LegacyPassManager.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index bb2661d..8fd35ef 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -675,11 +675,9 @@ PMTopLevelManager::setLastUser(ArrayRef<Pass*> AnalysisPasses, Pass *P) { // If AP is the last user of other passes then make P last user of // such passes. - for (auto LU : LastUser) { + for (auto &LU : LastUser) { if (LU.second == AP) - // DenseMap iterator is not invalidated here because - // this is just updating existing entries. - LastUser[LU.first] = P; + LU.second = P; } } } |