From e20efa3dd5c75a79a47d40335aee0f63261f9c5b Mon Sep 17 00:00:00 2001 From: Jay Foad Date: Fri, 27 Nov 2020 17:34:35 +0000 Subject: [PATCH] [LegacyPM] Simplify PMTopLevelManager::collectLastUses. NFC. --- llvm/lib/IR/LegacyPassManager.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/llvm/lib/IR/LegacyPassManager.cpp b/llvm/lib/IR/LegacyPassManager.cpp index 8fd35ef975e2..544c56a789a3 100644 --- a/llvm/lib/IR/LegacyPassManager.cpp +++ b/llvm/lib/IR/LegacyPassManager.cpp @@ -685,16 +685,12 @@ PMTopLevelManager::setLastUser(ArrayRef AnalysisPasses, Pass *P) { /// Collect passes whose last user is P void PMTopLevelManager::collectLastUses(SmallVectorImpl &LastUses, Pass *P) { - DenseMap >::iterator DMI = - InversedLastUser.find(P); + auto DMI = InversedLastUser.find(P); if (DMI == InversedLastUser.end()) return; - SmallPtrSet &LU = DMI->second; - for (Pass *LUP : LU) { - LastUses.push_back(LUP); - } - + auto &LU = DMI->second; + LastUses.append(LU.begin(), LU.end()); } AnalysisUsage *PMTopLevelManager::findAnalysisUsage(Pass *P) {