diff options
author | Devang Patel <dpatel@apple.com> | 2007-03-08 19:05:01 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2007-03-08 19:05:01 +0000 |
commit | d46825c6a1fa903ad8d9ec2d1890535e3afdd8d4 (patch) | |
tree | f2a834d99c061e19d9140cde805555564ddf4a7c | |
parent | a47f60bfafaf73da21c9a396ed0ea84e6a7dde6d (diff) | |
download | external_llvm-d46825c6a1fa903ad8d9ec2d1890535e3afdd8d4.zip external_llvm-d46825c6a1fa903ad8d9ec2d1890535e3afdd8d4.tar.gz external_llvm-d46825c6a1fa903ad8d9ec2d1890535e3afdd8d4.tar.bz2 |
Speed Up Pass Manager.
- Check Immutableness before searching PreservedSet.
- Avoid unnecessary traversal while setting Last User.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@35028 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | lib/VMCore/PassManager.cpp | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp index 60c002c..cdeb256 100644 --- a/lib/VMCore/PassManager.cpp +++ b/lib/VMCore/PassManager.cpp @@ -353,6 +353,10 @@ void PMTopLevelManager::setLastUser(std::vector<Pass *> &AnalysisPasses, E = AnalysisPasses.end(); I != E; ++I) { Pass *AP = *I; LastUser[AP] = P; + + if (P == AP) + continue; + // If AP is the last user of other passes then make P last user of // such passes. for (std::map<Pass *, Pass *>::iterator LUI = LastUser.begin(), @@ -546,11 +550,10 @@ bool PMDataManager::preserveHigherLevelAnalysis(Pass *P) { for (std::vector<Pass *>::iterator I = HigherLevelAnalysis.begin(), E = HigherLevelAnalysis.end(); I != E; ++I) { Pass *P1 = *I; - if (std::find(PreservedSet.begin(), PreservedSet.end(), P1->getPassInfo()) == - PreservedSet.end()) { - if (!dynamic_cast<ImmutablePass*>(P1)) - return false; - } + if (!dynamic_cast<ImmutablePass*>(P1) + && std::find(PreservedSet.begin(), PreservedSet.end(), P1->getPassInfo()) == + PreservedSet.end()) + return false; } return true; @@ -568,12 +571,11 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) { for (std::map<AnalysisID, Pass*>::iterator I = AvailableAnalysis.begin(), E = AvailableAnalysis.end(); I != E; ) { std::map<AnalysisID, Pass*>::iterator Info = I++; - if (std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) == - PreservedSet.end()) { + if (!dynamic_cast<ImmutablePass*>(Info->second) + && std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) == + PreservedSet.end()) // Remove this analysis - if (!dynamic_cast<ImmutablePass*>(Info->second)) - AvailableAnalysis.erase(Info); - } + AvailableAnalysis.erase(Info); } // Check inherited analysis also. If P is not preserving analysis @@ -587,12 +589,11 @@ void PMDataManager::removeNotPreservedAnalysis(Pass *P) { I = InheritedAnalysis[Index]->begin(), E = InheritedAnalysis[Index]->end(); I != E; ) { std::map<AnalysisID, Pass *>::iterator Info = I++; - if (std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) == - PreservedSet.end()) { + if (!dynamic_cast<ImmutablePass*>(Info->second) + && std::find(PreservedSet.begin(), PreservedSet.end(), Info->first) == + PreservedSet.end()) // Remove this analysis - if (!dynamic_cast<ImmutablePass*>(Info->second)) - InheritedAnalysis[Index]->erase(Info); - } + InheritedAnalysis[Index]->erase(Info); } } |