[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/Local.cpp
Chris Lattner
lattner at cs.uiuc.edu
Wed Feb 25 17:32:00 PST 2004
Changes in directory llvm/lib/Analysis/DataStructure:
Local.cpp updated: 1.90 -> 1.91
---
Log message:
When building local graphs, clone the initializer for constant globals into each
local graph that uses the global.
---
Diffs of the changes: (+21 -7)
Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.90 llvm/lib/Analysis/DataStructure/Local.cpp:1.91
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.90 Wed Feb 25 17:06:40 2004
+++ llvm/lib/Analysis/DataStructure/Local.cpp Wed Feb 25 17:31:02 2004
@@ -177,6 +177,18 @@
else
++I;
+ // If there are any constant globals referenced in this function, merge their
+ // initializers into the local graph from the globals graph.
+ if (ScalarMap.global_begin() != ScalarMap.global_end()) {
+ ReachabilityCloner RC(*this, *GG, 0);
+
+ for (DSScalarMap::global_iterator I = ScalarMap.global_begin();
+ I != ScalarMap.global_end(); ++I)
+ if (GlobalVariable *GV = dyn_cast<GlobalVariable>(*I))
+ if (GV->isConstant())
+ RC.merge(ScalarMap[GV], GG->ScalarMap[GV]);
+ }
+
markIncompleteNodes(DSGraph::MarkFormalArgs);
// Remove any nodes made dead due to merging...
@@ -894,17 +906,19 @@
const TargetData &TD = getAnalysis<TargetData>();
+ {
+ GraphBuilder GGB(*GlobalsGraph);
+
+ // Add initializers for all of the globals to the globals graph...
+ for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
+ if (!I->isExternal())
+ GGB.mergeInGlobalInitializer(I);
+ }
+
// Calculate all of the graphs...
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isExternal())
DSInfo.insert(std::make_pair(I, new DSGraph(TD, *I, GlobalsGraph)));
-
- GraphBuilder GGB(*GlobalsGraph);
-
- // Add initializers for all of the globals to the globals graph...
- for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ++I)
- if (!I->isExternal())
- GGB.mergeInGlobalInitializer(I);
GlobalsGraph->removeTriviallyDeadNodes();
GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs);
More information about the llvm-commits
mailing list