[llvm-commits] [poolalloc] r130309 - /poolalloc/trunk/lib/DSA/Local.cpp

Arushi Aggarwal aggarwa4 at illinois.edu
Wed Apr 27 10:07:08 PDT 2011


Author: aggarwa4
Date: Wed Apr 27 12:07:08 2011
New Revision: 130309

URL: http://llvm.org/viewvc/llvm-project?rev=130309&view=rev
Log:
Do not infer types for loads/stores used for
only copying data. Use these only to infer
the size a DSNode must have, to indicate
the size of the data being read/written.

Helps reduce spurious type information.

Modified:
    poolalloc/trunk/lib/DSA/Local.cpp

Modified: poolalloc/trunk/lib/DSA/Local.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/Local.cpp?rev=130309&r1=130308&r2=130309&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Wed Apr 27 12:07:08 2011
@@ -46,6 +46,7 @@
 STATISTIC(NumIndirectCall,  "Number of indirect calls added");
 STATISTIC(NumAsmCall,       "Number of asm calls collapsed/seen");
 STATISTIC(NumIntrinsicCall, "Number of intrinsics called");
+STATISTIC(IgnoredInst,       "Number of instructions ignored");
 
 RegisterPass<LocalDataStructures>
 X("dsa-local", "Local Data Structure Analysis");
@@ -366,10 +367,20 @@
   Ptr.getNode()->setReadMarker();
 
   // Ensure a typerecord exists...
-  Ptr.getNode()->mergeTypeInfo(LI.getType(), Ptr.getOffset());
+  Ptr.getNode()->growSizeForType(LI.getType(), Ptr.getOffset());
 
   if (isa<PointerType>(LI.getType()))
     setDestTo(LI, getLink(Ptr));
+
+  // check that it is the inserted value
+  if(TypeInferenceOptimize)
+    if(LI.getNumUses() == 1) 
+      if(StoreInst *SI = dyn_cast<StoreInst>(LI.use_begin()))
+        if(SI->getOperand(0) == &LI) {
+        ++IgnoredInst;
+        return;
+      }
+  Ptr.getNode()->mergeTypeInfo(LI.getType(), Ptr.getOffset());
 }
 
 void GraphBuilder::visitStoreInst(StoreInst &SI) {
@@ -381,11 +392,19 @@
   Dest.getNode()->setModifiedMarker();
 
   // Ensure a type-record exists...
-  Dest.getNode()->mergeTypeInfo(StoredTy, Dest.getOffset());
+  Dest.getNode()->growSizeForType(StoredTy, Dest.getOffset());
 
   // Avoid adding edges from null, or processing non-"pointer" stores
   if (isa<PointerType>(StoredTy))
     Dest.addEdgeTo(getValueDest(SI.getOperand(0)));
+
+  if(TypeInferenceOptimize)
+    if(SI.getOperand(0)->getNumUses() == 1)
+      if(isa<LoadInst>(SI.getOperand(0))){
+        ++IgnoredInst;
+        return;
+      }
+  Dest.getNode()->mergeTypeInfo(StoredTy, Dest.getOffset());
 }
 
 void GraphBuilder::visitReturnInst(ReturnInst &RI) {
@@ -470,7 +489,7 @@
     Offset += SL->getElementOffset(*i);
     STy = (cast<StructType>(STy))->getTypeAtIndex(*i);
   }
-  
+
   // Ensure a typerecord exists...
   Ptr.getNode()->mergeTypeInfo(I.getType(), Offset);
 
@@ -494,7 +513,7 @@
   //
 
   if (!Value.isNull() &&
-                   Value.getNode()->isNodeCompletelyFolded()) {
+      Value.getNode()->isNodeCompletelyFolded()) {
     setDestTo(GEP, Value);
     return;
   }





More information about the llvm-commits mailing list