[llvm-commits] [poolalloc] r57848 - in /poolalloc/trunk/lib/DSA: BottomUpClosure.cpp CompleteBottomUp.cpp DataStructure.cpp Local.cpp
Andrew Lenharth
alenhar2 at cs.uiuc.edu
Mon Oct 20 15:40:33 PDT 2008
Author: alenhar2
Date: Mon Oct 20 17:40:32 2008
New Revision: 57848
URL: http://llvm.org/viewvc/llvm-project?rev=57848&view=rev
Log:
Make simpler and more correct
Modified:
poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp
poolalloc/trunk/lib/DSA/DataStructure.cpp
poolalloc/trunk/lib/DSA/Local.cpp
Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=57848&r1=57847&r2=57848&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Mon Oct 20 17:40:32 2008
@@ -462,6 +462,7 @@
DSGraph::StripAllocaBit|DSGraph::DontCloneCallNodes|
(isComplete?0:DSGraph::DontCloneAuxCallNodes));
++NumInlines;
+ DEBUG(Graph->AssertGraphOK(););
} else if (CalledFuncs.size() > 1) {
DEBUG(std::cerr << "In Fns: " << Graph->getFunctionNames() << "\n");
DEBUG(std::cerr << " calls " << CalledFuncs.size()
@@ -543,7 +544,8 @@
++NumInlines;
}
}
- DEBUG(Graph->AssertGraphOK(); Graph->getGlobalsGraph()->AssertGraphOK());
+ DEBUG(Graph->AssertGraphOK(););
+ DEBUG(Graph->getGlobalsGraph()->AssertGraphOK());
if (!isComplete)
AuxCallsList.push_front(CS);
TempFCs.erase(TempFCs.begin());
Modified: poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp?rev=57848&r1=57847&r2=57848&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp (original)
+++ poolalloc/trunk/lib/DSA/CompleteBottomUp.cpp Mon Oct 20 17:40:32 2008
@@ -35,6 +35,7 @@
init(&getAnalysis<BUDataStructures>(), false, true, false, true);
buildIndirectFunctionSets(M);
+ formGlobalECs();
return runOnModuleInternal(M);
}
@@ -50,12 +51,13 @@
for (std::vector<const Instruction*>::iterator ii = keys.begin(), ee = keys.end();
ii != ee; ++ii) {
if (*ii) {
- callee_iterator base = callee_begin(*ii);
-
- for (callee_iterator csi = callee_begin(*ii), cse = callee_end(*ii);
- csi != cse; ++csi) {
- GlobalECs.unionSets(*base, *csi);
- GlobalsGraph->getNodeForValue(*base).mergeWith(GlobalsGraph->getNodeForValue(*csi));
+ callee_iterator csi = callee_begin(*ii), cse = callee_end(*ii);
+ if (csi != cse) ++csi;
+ DSGraph* G = getOrCreateGraph((*ii)->getParent()->getParent());
+ for ( ; csi != cse; ++csi) {
+ G->getNodeForValue(*csi).mergeWith(G->getNodeForValue((*ii)->getOperand(0)));
+ G->getNodeForValue((*ii)->getOperand(0)).getNode()->setGlobalMarker();
+ G->getNodeForValue((*ii)->getOperand(0)).getNode()->addGlobal(*csi);
}
}
}
Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=57848&r1=57847&r2=57848&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Mon Oct 20 17:40:32 2008
@@ -146,7 +146,6 @@
if (T) mergeTypeInfo(T, 0);
if (G) G->addNode(this);
++NumNodeAllocated;
- // DOUT << "LLVA: Creating (1) DSNode " << this << "\n";
}
// DSNode copy constructor... do not copy over the referrers list!
@@ -159,7 +158,6 @@
Links.resize(N.Links.size()); // Create the appropriate number of null links
G->addNode(this);
++NumNodeAllocated;
- // DOUT << "LLVA: Creating (2) DSNode " << this << "\n";
}
DSNode::~DSNode() {
@@ -193,6 +191,7 @@
assert(ParentGraph && "Node has no parent?");
const DSScalarMap &SM = ParentGraph->getScalarMap();
for (unsigned i = 0, e = Globals.size(); i != e; ++i) {
+ Globals[i]->dump();
assert(SM.global_count(Globals[i]));
assert(SM.find(Globals[i])->second.getNode() == this);
}
@@ -808,6 +807,11 @@
std::set_union(Globals.begin(), Globals.end(),
RHS.Globals.begin(), RHS.Globals.end(),
back_it);
+ DEBUG(
+ for (std::vector<const GlobalValue*>::iterator ii = Temp.begin(),
+ ee = Temp.end(); ii != ee; ++ii)
+ assert(isa<GlobalValue>(*ii) && "Non global merged");
+ );
Globals.swap(Temp);
}
Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=57848&r1=57847&r2=57848&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Mon Oct 20 17:40:32 2008
@@ -641,6 +641,11 @@
if (isa<PointerType>(I->getType()))
RetVal = getValueDest(*I);
+ if (!isa<Function>(Callee))
+ if (ConstantExpr* EX = dyn_cast<ConstantExpr>(Callee))
+ if (EX->isCast() && isa<Function>(EX->getOperand(0)))
+ Callee = cast<Function>(EX->getOperand(0));
+
DSNode *CalleeNode = 0;
if (!isa<Function>(Callee)) {
CalleeNode = getValueDest(*Callee).getNode();
More information about the llvm-commits
mailing list