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

Chris Lattner lattner at cs.uiuc.edu
Mon Mar 21 18:45:29 PST 2005



Changes in directory llvm/lib/Analysis/DataStructure:

Local.cpp updated: 1.131 -> 1.132
---
Log message:

Remove an iteration pass over the entire scalarmap for each function created
by not allowing integer constants to get into the scalar map in the first 
place.


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

 Local.cpp |   23 ++++++++---------------
 1 files changed, 8 insertions(+), 15 deletions(-)


Index: llvm/lib/Analysis/DataStructure/Local.cpp
diff -u llvm/lib/Analysis/DataStructure/Local.cpp:1.131 llvm/lib/Analysis/DataStructure/Local.cpp:1.132
--- llvm/lib/Analysis/DataStructure/Local.cpp:1.131	Sat Mar 19 21:32:35 2005
+++ llvm/lib/Analysis/DataStructure/Local.cpp	Mon Mar 21 20:45:13 2005
@@ -82,7 +82,8 @@
         FunctionCalls(&fc) {
 
       // Create scalar nodes for all pointer arguments...
-      for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end(); I != E; ++I)
+      for (Function::arg_iterator I = f.arg_begin(), E = f.arg_end();
+           I != E; ++I)
         if (isPointerType(I->getType()))
           getValueDest(*I);
 
@@ -177,13 +178,6 @@
   Timer::addPeakMemoryMeasurement();
 #endif
 
-  // Remove all integral constants from the scalarmap!
-  for (DSScalarMap::iterator I = ScalarMap.begin(); I != ScalarMap.end();)
-    if (isa<ConstantIntegral>(I->first))
-      ScalarMap.erase(I++);
-    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()) {
@@ -228,9 +222,12 @@
     N->addGlobal(GV);
   } else if (Constant *C = dyn_cast<Constant>(V)) {
     if (ConstantExpr *CE = dyn_cast<ConstantExpr>(C)) {
-      if (CE->getOpcode() == Instruction::Cast)
-        NH = getValueDest(*CE->getOperand(0));
-      else if (CE->getOpcode() == Instruction::GetElementPtr) {
+      if (CE->getOpcode() == Instruction::Cast) {
+        if (isa<PointerType>(CE->getOperand(0)->getType()))
+          NH = getValueDest(*CE->getOperand(0));
+        else
+          NH = createNode()->setUnknownNodeMarker();
+      } else if (CE->getOpcode() == Instruction::GetElementPtr) {
         visitGetElementPtrInst(*CE);
         DSScalarMap::iterator I = ScalarMap.find(CE);
         assert(I != ScalarMap.end() && "GEP didn't get processed right?");
@@ -244,10 +241,6 @@
         return 0;
       }
       return NH;
-
-    } else if (ConstantIntegral *CI = dyn_cast<ConstantIntegral>(C)) {
-      // Random constants are unknown mem
-      return NH = createNode()->setUnknownNodeMarker();
     } else if (isa<UndefValue>(C)) {
       ScalarMap.erase(V);
       return 0;






More information about the llvm-commits mailing list