[llvm-commits] CVS: llvm/lib/VMCore/PassManager.cpp
Devang Patel
dpatel at apple.com
Thu Mar 8 11:05:22 PST 2007
Changes in directory llvm/lib/VMCore:
PassManager.cpp updated: 1.145 -> 1.146
---
Log message:
Speed Up Pass Manager.
- Check Immutableness before searching PreservedSet.
- Avoid unnecessary traversal while setting Last User.
---
Diffs of the changes: (+16 -15)
PassManager.cpp | 31 ++++++++++++++++---------------
1 files changed, 16 insertions(+), 15 deletions(-)
Index: llvm/lib/VMCore/PassManager.cpp
diff -u llvm/lib/VMCore/PassManager.cpp:1.145 llvm/lib/VMCore/PassManager.cpp:1.146
--- llvm/lib/VMCore/PassManager.cpp:1.145 Tue Mar 6 11:52:53 2007
+++ llvm/lib/VMCore/PassManager.cpp Thu Mar 8 13:05:01 2007
@@ -353,6 +353,10 @@
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 @@
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 @@
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 @@
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);
}
}
More information about the llvm-commits
mailing list