[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/DataStructure.cpp

Chris Lattner lattner at cs.uiuc.edu
Tue Jan 27 21:04:02 PST 2004


Changes in directory llvm/lib/Analysis/DataStructure:

DataStructure.cpp updated: 1.142 -> 1.143

---
Log message:

In updateFromGlobalsGraph, instead of iterating over all of the scalars in the 
function to find the globals, iterate over all of the globals directly.  This
speeds the function up from 14s to 6.3s on perlbmk, reducing DSA time from 
53->46s.



---
Diffs of the changes:  (+7 -8)

Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.142 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.143
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.142	Tue Jan 27 20:41:32 2004
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Tue Jan 27 21:03:06 2004
@@ -1064,14 +1064,13 @@
   ReachabilityCloner RC(*this, *GlobalsGraph, 0);
 
   // Clone the non-up-to-date global nodes into this graph.
-  for (ScalarMapTy::const_iterator I = getScalarMap().begin(),
-         E = getScalarMap().end(); I != E; ++I)
-    if (GlobalValue* GV = dyn_cast<GlobalValue>(I->first))
-      if (InlinedGlobals.count(GV) == 0) { // GNode is not up-to-date
-        ScalarMapTy::iterator It = GlobalsGraph->ScalarMap.find(GV);
-        if (It != GlobalsGraph->ScalarMap.end())
-          RC.merge(I->second, It->second);
-      }
+  for (DSScalarMap::global_iterator I = getScalarMap().global_begin(),
+         E = getScalarMap().global_end(); I != E; ++I)
+    if (InlinedGlobals.count(*I) == 0) { // GNode is not up-to-date
+      ScalarMapTy::iterator It = GlobalsGraph->ScalarMap.find(*I);
+      if (It != GlobalsGraph->ScalarMap.end())
+        RC.merge(getNodeForValue(*I), It->second);
+    }
   
   // Merging global nodes leaves behind unused nodes: get rid of them now.
   removeTriviallyDeadNodes();





More information about the llvm-commits mailing list