summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Transforms/IPO/GlobalDCE.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/lib/Transforms/IPO/GlobalDCE.cpp')
-rw-r--r--llvm/lib/Transforms/IPO/GlobalDCE.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalDCE.cpp b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
index 664381cec68..1b64a0b369b 100644
--- a/llvm/lib/Transforms/IPO/GlobalDCE.cpp
+++ b/llvm/lib/Transforms/IPO/GlobalDCE.cpp
@@ -46,8 +46,17 @@ static bool RemoveUnreachableMethods(Module *M, cfg::CallGraph &CallGraph) {
}
bool GlobalDCE::run(Module *M) {
- // TODO: FIXME: GET THE CALL GRAPH FROM THE PASS!
- // Create a call graph if one is not already available...
- cfg::CallGraph CallGraph(M);
- return RemoveUnreachableMethods(M, CallGraph);
+ return RemoveUnreachableMethods(M, getAnalysis<cfg::CallGraph>());
+}
+
+// getAnalysisUsageInfo - This function works on the call graph of a module.
+// It is capable of updating the call graph to reflect the new state of the
+// module.
+//
+void GlobalDCE::getAnalysisUsageInfo(Pass::AnalysisSet &Required,
+ Pass::AnalysisSet &Destroyed,
+ Pass::AnalysisSet &Provided) {
+ Required.push_back(cfg::CallGraph::ID);
+ // FIXME: This should update the callgraph, not destroy it!
+ Destroyed.push_back(cfg::CallGraph::ID);
}
OpenPOWER on IntegriCloud