[llvm-commits] [poolalloc] r64462 - in /poolalloc/trunk: include/dsa/DataStructure.h lib/DSA/DataStructure.cpp
John Criswell
criswell at uiuc.edu
Fri Feb 13 09:27:21 PST 2009
Author: criswell
Date: Fri Feb 13 11:27:20 2009
New Revision: 64462
URL: http://llvm.org/viewvc/llvm-project?rev=64462&view=rev
Log:
Do not free the DSGraph if it has been stolen by another DSA pass.
Modified:
poolalloc/trunk/include/dsa/DataStructure.h
poolalloc/trunk/lib/DSA/DataStructure.cpp
Modified: poolalloc/trunk/include/dsa/DataStructure.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DataStructure.h?rev=64462&r1=64461&r2=64462&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DataStructure.h (original)
+++ poolalloc/trunk/include/dsa/DataStructure.h Fri Feb 13 11:27:20 2009
@@ -55,6 +55,9 @@
/// do we reset the aux list to the func list?
bool resetAuxCalls;
+ /// Were are DSGraphs stolen by another pass?
+ bool DSGraphsStolen;
+
void buildGlobalECs(std::set<const GlobalValue*>& ECGlobals);
void eliminateUsesOfECGlobals(DSGraph& G, const std::set<const GlobalValue*> &ECGlobals);
@@ -89,9 +92,12 @@
}
DataStructures(intptr_t id, const char* name)
- :ModulePass(id), TD(0), GraphSource(0), printname(name), GlobalsGraph(0) {
+ : ModulePass(id), TD(0), GraphSource(0), printname(name), GlobalsGraph(0) {
//a dummy node for empty call sites
ActualCallees[0];
+
+ // For now, the graphs are owned by this pass
+ DSGraphsStolen = false;
}
public:
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=64462&r1=64461&r2=64462&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Fri Feb 13 11:27:20 2009
@@ -2870,6 +2870,11 @@
GlobalsGraph = new DSGraph(D->getGlobalsGraph(), GlobalECs,
copyGlobalAuxCalls?0:DSGraph::DontCloneAuxCallNodes);
if (printAuxCalls) GlobalsGraph->setPrintAuxCalls();
+
+ //
+ // Tell the other DSA pass if we're stealing its graph.
+ //
+ if (!clone) D->DSGraphsStolen = true;
}
void DataStructures::init(TargetData* T) {
@@ -2881,6 +2886,11 @@
}
void DataStructures::releaseMemory() {
+ //
+ // If the DSGraphs were stolen by another pass, free nothing.
+ //
+ if (DSGraphsStolen) return;
+
hash_set<DSGraph*> toDelete;
for (DSInfoTy::iterator I = DSInfo.begin(), E = DSInfo.end(); I != E; ++I) {
I->second->getReturnNodes().clear();
More information about the llvm-commits
mailing list