[llvm-commits] [llvm] r48476 - in /llvm/trunk: include/llvm/ include/llvm/Analysis/ lib/Analysis/ lib/Analysis/IPA/ lib/VMCore/
Devang Patel
dpatel at apple.com
Mon Mar 17 17:39:19 PDT 2008
Author: dpatel
Date: Mon Mar 17 19:39:19 2008
New Revision: 48476
URL: http://llvm.org/viewvc/llvm-project?rev=48476&view=rev
Log:
Identify Analysis pass.
Do not run analysis pass again if analysis info is still available.
This fixes PR1441.
Modified:
llvm/trunk/include/llvm/Analysis/Dominators.h
llvm/trunk/include/llvm/Analysis/FindUsedTypes.h
llvm/trunk/include/llvm/Analysis/IntervalPartition.h
llvm/trunk/include/llvm/Analysis/LoopInfo.h
llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
llvm/trunk/include/llvm/Analysis/PostDominators.h
llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
llvm/trunk/include/llvm/Pass.h
llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp
llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp
llvm/trunk/lib/Analysis/AliasDebugger.cpp
llvm/trunk/lib/Analysis/AliasSetTracker.cpp
llvm/trunk/lib/Analysis/CFGPrinter.cpp
llvm/trunk/lib/Analysis/IPA/Andersens.cpp
llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp
llvm/trunk/lib/Analysis/InstCount.cpp
llvm/trunk/lib/Analysis/LoadValueNumbering.cpp
llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp
llvm/trunk/lib/VMCore/PassManager.cpp
Modified: llvm/trunk/include/llvm/Analysis/Dominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/Dominators.h?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/Dominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/Dominators.h Mon Mar 17 19:39:19 2008
@@ -300,6 +300,9 @@
// FIXME: Should remove this
virtual bool runOnFunction(Function &F) { return false; }
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual void releaseMemory() { reset(); }
/// getNode - return the (Post)DominatorTree node for the specified basic
@@ -691,6 +694,9 @@
return DT->getRootNode();
}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -910,6 +916,9 @@
return Roots[0];
}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &) {
Frontiers.clear();
DominatorTree &DT = getAnalysis<DominatorTree>();
Modified: llvm/trunk/include/llvm/Analysis/FindUsedTypes.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/FindUsedTypes.h?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/FindUsedTypes.h (original)
+++ llvm/trunk/include/llvm/Analysis/FindUsedTypes.h Mon Mar 17 19:39:19 2008
@@ -50,6 +50,10 @@
void IncorporateValue(const Value *V);
public:
+
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
/// run - This incorporates all types used by the specified module
bool runOnModule(Module &M);
Modified: llvm/trunk/include/llvm/Analysis/IntervalPartition.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/IntervalPartition.h?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/IntervalPartition.h (original)
+++ llvm/trunk/include/llvm/Analysis/IntervalPartition.h Mon Mar 17 19:39:19 2008
@@ -49,6 +49,9 @@
IntervalPartition() : FunctionPass((intptr_t)&ID), RootInterval(0) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
// run - Calculate the interval partition for this function
virtual bool runOnFunction(Function &F);
Modified: llvm/trunk/include/llvm/Analysis/LoopInfo.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/LoopInfo.h?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/LoopInfo.h (original)
+++ llvm/trunk/include/llvm/Analysis/LoopInfo.h Mon Mar 17 19:39:19 2008
@@ -580,6 +580,9 @@
LoopInfoBase() { }
~LoopInfoBase() { releaseMemory(); }
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
void releaseMemory() {
for (typename std::vector<LoopBase<BlockT>* >::iterator I =
TopLevelLoops.begin(), E = TopLevelLoops.end(); I != E; ++I)
Modified: llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h (original)
+++ llvm/trunk/include/llvm/Analysis/MemoryDependenceAnalysis.h Mon Mar 17 19:39:19 2008
@@ -68,6 +68,9 @@
static char ID; // Class identification, replacement for typeinfo
MemoryDependenceAnalysis() : 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; }
Modified: llvm/trunk/include/llvm/Analysis/PostDominators.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/PostDominators.h?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/PostDominators.h (original)
+++ llvm/trunk/include/llvm/Analysis/PostDominators.h Mon Mar 17 19:39:19 2008
@@ -29,6 +29,9 @@
DT = new DominatorTreeBase<BasicBlock>(true);
}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &F);
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
@@ -69,6 +72,9 @@
PostDominanceFrontier()
: DominanceFrontierBase((intptr_t) &ID, true) {}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &) {
Frontiers.clear();
PostDominatorTree &DT = getAnalysis<PostDominatorTree>();
Modified: llvm/trunk/include/llvm/Analysis/ScalarEvolution.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Analysis/ScalarEvolution.h?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Analysis/ScalarEvolution.h (original)
+++ llvm/trunk/include/llvm/Analysis/ScalarEvolution.h Mon Mar 17 19:39:19 2008
@@ -291,6 +291,9 @@
/// that no dangling references are left around.
void deleteValueFromRecords(Value *V) const;
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const { return true; }
+
virtual bool runOnFunction(Function &F);
virtual void releaseMemory();
virtual void getAnalysisUsage(AnalysisUsage &AU) const;
Modified: llvm/trunk/include/llvm/Pass.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Pass.h?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Pass.h (original)
+++ llvm/trunk/include/llvm/Pass.h Mon Mar 17 19:39:19 2008
@@ -130,6 +130,11 @@
return Resolver;
}
+ /// isAnalysis - Return true if this pass is implementing an analysis pass.
+ virtual bool isAnalysis() const {
+ return false;
+ }
+
/// getAnalysisUsage - This function should be overriden by passes that need
/// analysis information to do their job. If a pass specifies that it uses a
/// particular analysis result to this function, it can then use the
Modified: llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysisCounter.cpp Mon Mar 17 19:39:19 2008
@@ -72,6 +72,9 @@
}
}
+ /// 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);
Modified: llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasAnalysisEvaluator.cpp Mon Mar 17 19:39:19 2008
@@ -70,6 +70,9 @@
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);
};
Modified: llvm/trunk/lib/Analysis/AliasDebugger.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasDebugger.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasDebugger.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasDebugger.cpp Mon Mar 17 19:39:19 2008
@@ -43,6 +43,9 @@
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
Modified: llvm/trunk/lib/Analysis/AliasSetTracker.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/AliasSetTracker.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/AliasSetTracker.cpp (original)
+++ llvm/trunk/lib/Analysis/AliasSetTracker.cpp Mon Mar 17 19:39:19 2008
@@ -558,6 +558,9 @@
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>());
Modified: llvm/trunk/lib/Analysis/CFGPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/CFGPrinter.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/CFGPrinter.cpp (original)
+++ llvm/trunk/lib/Analysis/CFGPrinter.cpp Mon Mar 17 19:39:19 2008
@@ -94,6 +94,9 @@
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 @@
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 @@
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 @@
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;
Modified: llvm/trunk/lib/Analysis/IPA/Andersens.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/Andersens.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/Andersens.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/Andersens.cpp Mon Mar 17 19:39:19 2008
@@ -432,6 +432,9 @@
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);
Modified: llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp (original)
+++ llvm/trunk/lib/Analysis/IPA/GlobalsModRef.cpp Mon Mar 17 19:39:19 2008
@@ -86,6 +86,9 @@
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
Modified: llvm/trunk/lib/Analysis/InstCount.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/InstCount.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/InstCount.cpp (original)
+++ llvm/trunk/lib/Analysis/InstCount.cpp Mon Mar 17 19:39:19 2008
@@ -51,6 +51,10 @@
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) {}
Modified: llvm/trunk/lib/Analysis/LoadValueNumbering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/LoadValueNumbering.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/LoadValueNumbering.cpp (original)
+++ llvm/trunk/lib/Analysis/LoadValueNumbering.cpp Mon Mar 17 19:39:19 2008
@@ -43,6 +43,9 @@
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; }
Modified: llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp (original)
+++ llvm/trunk/lib/Analysis/ProfileInfoLoaderPass.cpp Mon Mar 17 19:39:19 2008
@@ -46,6 +46,9 @@
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);
};
Modified: llvm/trunk/lib/VMCore/PassManager.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/PassManager.cpp?rev=48476&r1=48475&r2=48476&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/PassManager.cpp (original)
+++ llvm/trunk/lib/VMCore/PassManager.cpp Mon Mar 17 19:39:19 2008
@@ -426,6 +426,12 @@
// 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();
More information about the llvm-commits
mailing list