aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2008-03-18 00:39:19 +0000
committerDevang Patel <dpatel@apple.com>2008-03-18 00:39:19 +0000
commit2b4fa68564c792a120f73ccf659f190fa9caae2c (patch)
treedcbe3d4a2811447eec457bce66c90106e4245c24 /lib
parenteb48523776410ba88eef505b0ce3bdd4c67efdb5 (diff)
downloadexternal_llvm-2b4fa68564c792a120f73ccf659f190fa9caae2c.zip
external_llvm-2b4fa68564c792a120f73ccf659f190fa9caae2c.tar.gz
external_llvm-2b4fa68564c792a120f73ccf659f190fa9caae2c.tar.bz2
Identify Analysis pass.
Do not run analysis pass again if analysis info is still available. This fixes PR1441. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@48476 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Analysis/AliasAnalysisCounter.cpp3
-rw-r--r--lib/Analysis/AliasAnalysisEvaluator.cpp3
-rw-r--r--lib/Analysis/AliasDebugger.cpp3
-rw-r--r--lib/Analysis/AliasSetTracker.cpp3
-rw-r--r--lib/Analysis/CFGPrinter.cpp13
-rw-r--r--lib/Analysis/IPA/Andersens.cpp3
-rw-r--r--lib/Analysis/IPA/GlobalsModRef.cpp3
-rw-r--r--lib/Analysis/InstCount.cpp4
-rw-r--r--lib/Analysis/LoadValueNumbering.cpp3
-rw-r--r--lib/Analysis/ProfileInfoLoaderPass.cpp3
-rw-r--r--lib/VMCore/PassManager.cpp6
11 files changed, 47 insertions, 0 deletions
diff --git a/lib/Analysis/AliasAnalysisCounter.cpp b/lib/Analysis/AliasAnalysisCounter.cpp
index 3746253..8b35ea8 100644
--- a/lib/Analysis/AliasAnalysisCounter.cpp
+++ b/lib/Analysis/AliasAnalysisCounter.cpp
@@ -72,6 +72,9 @@ namespace {
}
}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
bool runOnModule(Module &M) {
this->M = &M;
InitializeAliasAnalysis(this);
diff --git a/lib/Analysis/AliasAnalysisEvaluator.cpp b/lib/Analysis/AliasAnalysisEvaluator.cpp
index 1ed0680..51fdec4 100644
--- a/lib/Analysis/AliasAnalysisEvaluator.cpp
+++ b/lib/Analysis/AliasAnalysisEvaluator.cpp
@@ -70,6 +70,9 @@ namespace {
return false;
}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
bool runOnFunction(Function &F);
bool doFinalization(Module &M);
};
diff --git a/lib/Analysis/AliasDebugger.cpp b/lib/Analysis/AliasDebugger.cpp
index dd766e9..6b534e9 100644
--- a/lib/Analysis/AliasDebugger.cpp
+++ b/lib/Analysis/AliasDebugger.cpp
@@ -43,6 +43,9 @@ namespace {
static char ID; // Class identification, replacement for typeinfo
AliasDebugger() : ModulePass((intptr_t)&ID) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
bool runOnModule(Module &M) {
InitializeAliasAnalysis(this); // set up super class
diff --git a/lib/Analysis/AliasSetTracker.cpp b/lib/Analysis/AliasSetTracker.cpp
index d5038ea..69cf4b3 100644
--- a/lib/Analysis/AliasSetTracker.cpp
+++ b/lib/Analysis/AliasSetTracker.cpp
@@ -558,6 +558,9 @@ namespace {
AU.addRequired<AliasAnalysis>();
}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &F) {
Tracker = new AliasSetTracker(getAnalysis<AliasAnalysis>());
diff --git a/lib/Analysis/CFGPrinter.cpp b/lib/Analysis/CFGPrinter.cpp
index a96e9d0..7b61ff8 100644
--- a/lib/Analysis/CFGPrinter.cpp
+++ b/lib/Analysis/CFGPrinter.cpp
@@ -94,6 +94,9 @@ namespace {
static char ID; // Pass identifcation, replacement for typeid
CFGViewer() : FunctionPass((intptr_t)&ID) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &F) {
F.viewCFG();
return false;
@@ -114,6 +117,9 @@ namespace {
static char ID; // Pass identifcation, replacement for typeid
CFGOnlyViewer() : FunctionPass((intptr_t)&ID) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &F) {
CFGOnly = true;
F.viewCFG();
@@ -137,6 +143,9 @@ namespace {
CFGPrinter() : FunctionPass((intptr_t)&ID) {}
explicit CFGPrinter(intptr_t pid) : FunctionPass(pid) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &F) {
std::string Filename = "cfg." + F.getName() + ".dot";
cerr << "Writing '" << Filename << "'...";
@@ -164,6 +173,10 @@ namespace {
struct VISIBILITY_HIDDEN CFGOnlyPrinter : public CFGPrinter {
static char ID; // Pass identification, replacement for typeid
CFGOnlyPrinter() : CFGPrinter((intptr_t)&ID) {}
+
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &F) {
bool OldCFGOnly = CFGOnly;
CFGOnly = true;
diff --git a/lib/Analysis/IPA/Andersens.cpp b/lib/Analysis/IPA/Andersens.cpp
index 5557c01..8650fb1 100644
--- a/lib/Analysis/IPA/Andersens.cpp
+++ b/lib/Analysis/IPA/Andersens.cpp
@@ -432,6 +432,9 @@ namespace {
static char ID;
Andersens() : ModulePass((intptr_t)&ID) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
bool runOnModule(Module &M) {
InitializeAliasAnalysis(this);
IdentifyObjects(M);
diff --git a/lib/Analysis/IPA/GlobalsModRef.cpp b/lib/Analysis/IPA/GlobalsModRef.cpp
index 9aafe37..9f0159e 100644
--- a/lib/Analysis/IPA/GlobalsModRef.cpp
+++ b/lib/Analysis/IPA/GlobalsModRef.cpp
@@ -86,6 +86,9 @@ namespace {
static char ID;
GlobalsModRef() : ModulePass((intptr_t)&ID) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
bool runOnModule(Module &M) {
InitializeAliasAnalysis(this); // set up super class
AnalyzeGlobals(M); // find non-addr taken globals
diff --git a/lib/Analysis/InstCount.cpp b/lib/Analysis/InstCount.cpp
index 78c4a37..08a27a6 100644
--- a/lib/Analysis/InstCount.cpp
+++ b/lib/Analysis/InstCount.cpp
@@ -51,6 +51,10 @@ namespace {
abort();
}
public:
+
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
static char ID; // Pass identification, replacement for typeid
InstCount() : FunctionPass((intptr_t)&ID) {}
diff --git a/lib/Analysis/LoadValueNumbering.cpp b/lib/Analysis/LoadValueNumbering.cpp
index 0a2f36b..6dd55a4 100644
--- a/lib/Analysis/LoadValueNumbering.cpp
+++ b/lib/Analysis/LoadValueNumbering.cpp
@@ -43,6 +43,9 @@ namespace {
static char ID; // Class identification, replacement for typeinfo
LoadVN() : FunctionPass((intptr_t)&ID) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
/// Pass Implementation stuff. This doesn't do any analysis.
///
bool runOnFunction(Function &) { return false; }
diff --git a/lib/Analysis/ProfileInfoLoaderPass.cpp b/lib/Analysis/ProfileInfoLoaderPass.cpp
index 9df1e91..e18625f 100644
--- a/lib/Analysis/ProfileInfoLoaderPass.cpp
+++ b/lib/Analysis/ProfileInfoLoaderPass.cpp
@@ -46,6 +46,9 @@ namespace {
return "Profiling information loader";
}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
/// run - Load the profile information from the specified file.
virtual bool runOnModule(Module &M);
};
diff --git a/lib/VMCore/PassManager.cpp b/lib/VMCore/PassManager.cpp
index e7d7c5b..b0afaef 100644
--- a/lib/VMCore/PassManager.cpp
+++ b/lib/VMCore/PassManager.cpp
@@ -426,6 +426,12 @@ void PMTopLevelManager::schedulePass(Pass *P) {
// Give pass a chance to prepare the stage.
P->preparePassManager(activeStack);
+ // If P is an analysis pass and it is available then do not
+ // generate the analysis again. Stale analysis info should not be
+ // available at this point.
+ if (P->isAnalysis() && findAnalysisPass(P->getPassInfo()))
+ return;
+
AnalysisUsage AnUsage;
P->getAnalysisUsage(AnUsage);
const std::vector<AnalysisID> &RequiredSet = AnUsage.getRequiredSet();