Changes in directory llvm/lib/VMCore:
PassManager.cpp updated: 1.135 -> 1.136 --- Log message: Use inverted map to speedup collectLastUses(). --- Diffs of the changes: (+16 -4) PassManager.cpp | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) Index: llvm/lib/VMCore/PassManager.cpp diff -u llvm/lib/VMCore/PassManager.cpp:1.135 llvm/lib/VMCore/PassManager.cpp:1.136 --- llvm/lib/VMCore/PassManager.cpp:1.135 Wed Feb 7 13:37:53 2007 +++ llvm/lib/VMCore/PassManager.cpp Fri Feb 16 21:53:44 2007 @@ -362,13 +362,19 @@ } } +// Walk LastUser map and create inverted map. This should be done +// after all passes are added and before running first pass. +void PMTopLevelManager::collectInvertedLU() { + for (std::map<Pass *, Pass *>::iterator LUI = LastUser.begin(), + LUE = LastUser.end(); LUI != LUE; ++LUI) + InvertedLU[LUI->second].push_back(LUI->first); +} + /// Collect passes whose last user is P void PMTopLevelManager::collectLastUses(std::vector<Pass *> &LastUses, Pass *P) { - for (std::map<Pass *, Pass *>::iterator LUI = LastUser.begin(), - LUE = LastUser.end(); LUI != LUE; ++LUI) - if (LUI->second == P) - LastUses.push_back(LUI->first); + std::vector<Pass *>&LU = InvertedLU[P]; + LastUses.insert(LastUses.end(), LU.begin(), LU.end()); } /// Schedule pass P for execution. Make sure that passes required by @@ -938,6 +944,9 @@ dumpArguments(); dumpPasses(); + // Collect inverted map of LastUsers. This improves speed of + // collectLastUses(). + TPM->collectInvertedLU(); initializeAllAnalysisInfo(); for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { FPPassManager *FP = getContainedManager(Index); @@ -1086,6 +1095,9 @@ dumpArguments(); dumpPasses(); + // Collect inverted map of LastUsers. This improves speed of + // collectLastUses(). + TPM->collectInvertedLU(); initializeAllAnalysisInfo(); for (unsigned Index = 0; Index < getNumContainedManagers(); ++Index) { MPPassManager *MP = getContainedManager(Index); _______________________________________________ llvm-commits mailing list llvm-commits@cs.uiuc.edu http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits