mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-08-18 12:29:21 +00:00
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
This commit is contained in:
parent
a47f60bfaf
commit
d46825c6a1
@ -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,12 +550,11 @@ 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))
|
||||
if (!dynamic_cast<ImmutablePass*>(P1)
|
||||
&& std::find(PreservedSet.begin(), PreservedSet.end(), P1->getPassInfo()) ==
|
||||
PreservedSet.end())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -568,13 +571,12 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
// Check inherited analysis also. If P is not preserving analysis
|
||||
// provided by parent manager then remove it here.
|
||||
@ -587,14 +589,13 @@ 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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user