[llvm-commits] [llvm] r54528 - in /llvm/trunk: include/llvm/PassManagers.h lib/Analysis/IPA/CallGraphSCCPass.cpp lib/Analysis/LoopPass.cpp lib/VMCore/PassManager.cpp
Chris Lattner
sabre at nondot.org
Fri Aug 8 08:14:12 PDT 2008
Author: lattner
Date: Fri Aug 8 10:14:09 2008
New Revision: 54528
URL: http://llvm.org/viewvc/llvm-project?rev=54528&view=rev
Log:
Don't call getAnalysisUsage unless -debug-pass is enabled. This speeds
up the passmgr by avoiding useless work.
Modified:
llvm/trunk/include/llvm/PassManagers.h
llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
llvm/trunk/lib/Analysis/LoopPass.cpp
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/include/llvm/PassManagers.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/PassManagers.h?rev=54528&r1=54527&r2=54528&view=diff
==============================================================================
--- llvm/trunk/include/llvm/PassManagers.h (original)
+++ llvm/trunk/include/llvm/PassManagers.h Fri Aug 8 10:14:09 2008
@@ -308,8 +308,8 @@
void dumpPassArguments() const;
void dumpPassInfo(Pass *P, enum PassDebuggingString S1,
enum PassDebuggingString S2, const char *Msg);
- void dumpAnalysisSetInfo(const char *Msg, Pass *P,
- const AnalysisUsage::VectorType &Set) const;
+ void dumpRequiredSet(const Pass *P) const;
+ void dumpPreservedSet(const Pass *P) const;
virtual unsigned getNumContainedPasses() const {
return (unsigned)PassVector.size();
@@ -346,6 +346,9 @@
std::map<AnalysisID, Pass *> *InheritedAnalysis[PMT_Last];
private:
+ void dumpAnalysisUsage(const char *Msg, const Pass *P,
+ const AnalysisUsage::VectorType &Set) const;
+
// Set of available Analysis. This information is used while scheduling
// pass. If a pass requires an analysis which is not not available then
// equired analysis pass is scheduled to run before the pass itself is
Modified: llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp?rev=54528&r1=54527&r2=54528&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/CallGraphSCCPass.cpp Fri Aug 8 10:14:09 2008
@@ -91,11 +91,9 @@
// Run all passes on current SCC
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
Pass *P = getContainedPass(Index);
- AnalysisUsage AnUsage;
- P->getAnalysisUsage(AnUsage);
dumpPassInfo(P, EXECUTION_MSG, ON_CG_MSG, "");
- dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet());
+ dumpRequiredSet(P);
initializeAnalysisImpl(P);
@@ -120,7 +118,7 @@
if (Changed)
dumpPassInfo(P, MODIFICATION_MSG, ON_CG_MSG, "");
- dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet());
+ dumpPreservedSet(P);
verifyPreservedAnalysis(P);
removeNotPreservedAnalysis(P);
Modified: llvm/trunk/lib/Analysis/LoopPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoopPass.cpp?rev=54528&r1=54527&r2=54528&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoopPass.cpp (original)
+++ llvm/trunk/lib/Analysis/LoopPass.cpp Fri Aug 8 10:14:09 2008
@@ -214,11 +214,9 @@
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
Pass *P = getContainedPass(Index);
- AnalysisUsage AnUsage;
- P->getAnalysisUsage(AnUsage);
dumpPassInfo(P, EXECUTION_MSG, ON_LOOP_MSG, "");
- dumpAnalysisSetInfo("Required", P, AnUsage.getRequiredSet());
+ dumpRequiredSet(P);
initializeAnalysisImpl(P);
@@ -230,7 +228,7 @@
if (Changed)
dumpPassInfo(P, MODIFICATION_MSG, ON_LOOP_MSG, "");
- dumpAnalysisSetInfo("Preserved", P, AnUsage.getPreservedSet());
+ dumpPreservedSet(P);
verifyPreservedAnalysis(LP);
removeNotPreservedAnalysis(P);
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=54528&r1=54527&r2=54528&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Fri Aug 8 10:14:09 2008
@@ -954,17 +954,38 @@
}
}
-void PMDataManager::dumpAnalysisSetInfo(const char *Msg, Pass *P,
+void PMDataManager::dumpRequiredSet(const Pass *P)
+ const {
+ if (PassDebugging < Details)
+ return;
+
+ AnalysisUsage analysisUsage;
+ P->getAnalysisUsage(analysisUsage);
+ dumpAnalysisUsage("Required", P, analysisUsage.getRequiredSet());
+}
+
+void PMDataManager::dumpPreservedSet(const Pass *P)
+ const {
+ if (PassDebugging < Details)
+ return;
+
+ AnalysisUsage analysisUsage;
+ P->getAnalysisUsage(analysisUsage);
+ dumpAnalysisUsage("Preserved", P, analysisUsage.getPreservedSet());
+}
+
+void PMDataManager::dumpAnalysisUsage(const char *Msg, const Pass *P,
const AnalysisUsage::VectorType &Set)
const {
- if (PassDebugging >= Details && !Set.empty()) {
- cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:";
- for (unsigned i = 0; i != Set.size(); ++i) {
- if (i) cerr << ",";
- cerr << " " << Set[i]->getPassName();
- }
- cerr << "\n";
- }
+ assert(PassDebugging >= Details);
+ if (Set.empty())
+ return;
+ cerr << (void*)P << std::string(getDepth()*2+3, ' ') << Msg << " Analyses:";
+ for (unsigned i = 0; i != Set.size(); ++i) {
+ if (i) cerr << ",";
+ cerr << " " << Set[i]->getPassName();
+ }
+ cerr << "\n";
}
/// Add RequiredPass into list of lower level passes required by pass P.
@@ -1031,11 +1052,9 @@
for (Function::iterator I = F.begin(), E = F.end(); I != E; ++I)
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
BasicBlockPass *BP = getContainedPass(Index);
- AnalysisUsage AnUsage;
- BP->getAnalysisUsage(AnUsage);
dumpPassInfo(BP, EXECUTION_MSG, ON_BASICBLOCK_MSG, I->getNameStart());
- dumpAnalysisSetInfo("Required", BP, AnUsage.getRequiredSet());
+ dumpRequiredSet(BP);
initializeAnalysisImpl(BP);
@@ -1046,7 +1065,7 @@
if (Changed)
dumpPassInfo(BP, MODIFICATION_MSG, ON_BASICBLOCK_MSG,
I->getNameStart());
- dumpAnalysisSetInfo("Preserved", BP, AnUsage.getPreservedSet());
+ dumpPreservedSet(BP);
verifyPreservedAnalysis(BP);
removeNotPreservedAnalysis(BP);
@@ -1232,11 +1251,8 @@
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
FunctionPass *FP = getContainedPass(Index);
- AnalysisUsage AnUsage;
- FP->getAnalysisUsage(AnUsage);
-
dumpPassInfo(FP, EXECUTION_MSG, ON_FUNCTION_MSG, F.getNameStart());
- dumpAnalysisSetInfo("Required", FP, AnUsage.getRequiredSet());
+ dumpRequiredSet(FP);
initializeAnalysisImpl(FP);
@@ -1246,7 +1262,7 @@
if (Changed)
dumpPassInfo(FP, MODIFICATION_MSG, ON_FUNCTION_MSG, F.getNameStart());
- dumpAnalysisSetInfo("Preserved", FP, AnUsage.getPreservedSet());
+ dumpPreservedSet(FP);
verifyPreservedAnalysis(FP);
removeNotPreservedAnalysis(FP);
@@ -1304,12 +1320,9 @@
for (unsigned Index = 0; Index < getNumContainedPasses(); ++Index) {
ModulePass *MP = getContainedPass(Index);
- AnalysisUsage AnUsage;
- MP->getAnalysisUsage(AnUsage);
-
dumpPassInfo(MP, EXECUTION_MSG, ON_MODULE_MSG,
M.getModuleIdentifier().c_str());
- dumpAnalysisSetInfo("Required", MP, AnUsage.getRequiredSet());
+ dumpRequiredSet(MP);
initializeAnalysisImpl(MP);
@@ -1320,7 +1333,7 @@
if (Changed)
dumpPassInfo(MP, MODIFICATION_MSG, ON_MODULE_MSG,
M.getModuleIdentifier().c_str());
- dumpAnalysisSetInfo("Preserved", MP, AnUsage.getPreservedSet());
+ dumpPreservedSet(MP);
verifyPreservedAnalysis(MP);
removeNotPreservedAnalysis(MP);
More information about the llvm-commits
mailing list