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

Arushi Aggarwal aggarwa4 at illinois.edu
Tue Dec 21 12:46:03 PST 2010


Author: aggarwa4
Date: Tue Dec 21 14:46:02 2010
New Revision: 122358

URL: http://llvm.org/viewvc/llvm-project?rev=122358&view=rev
Log:
1. Do not merge call sites in Local. This handles the
case where a call site that could be resolved, 
was getting merged with a call site that could not be
resolved because their callees were identical.
2. Better handling of AddressTaken for functions.

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=122358&r1=122357&r2=122358&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/Local.cpp (original)
+++ poolalloc/trunk/lib/DSA/Local.cpp Tue Dec 21 14:46:02 2010
@@ -189,7 +189,7 @@
       g.computeIntPtrFlags();
 
       // Remove any nodes made dead due to merging...
-      g.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
+      //g.removeDeadNodes(DSGraph::KeepUnreachableGlobals);
     }
 
     // GraphBuilder ctor for working on the globals graph
@@ -1195,9 +1195,21 @@
           GGB.mergeInGlobalInitializer(I);
       }
     // Add Functions to the globals graph.
-    for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
-      if (I->hasAddressTaken())
-        GGB.mergeFunction(I);
+    for (Module::iterator FI = M.begin(), FE = M.end(); FI != FE; ++FI){
+      for (Value::use_iterator I = (*FI).use_begin(), E = (*FI).use_end(); I != E; ++I) {
+        User *U = *I;
+        if (!isa<CallInst>(U) && !isa<InvokeInst>(U)){
+          if(U->getNumUses() == 0)
+            continue;
+          GGB.mergeFunction(FI);
+          continue;
+        } 
+        CallSite CS(cast<Instruction>(U));
+        if (!CS.isCallee(I)){
+          GGB.mergeFunction(FI);
+        }
+      }
+    }
   }
   
   if (hasMagicSections.size())
@@ -1225,7 +1237,7 @@
       DEBUG(G->AssertGraphOK());
     }
 
-  GlobalsGraph->removeTriviallyDeadNodes();
+  //GlobalsGraph->removeTriviallyDeadNodes();
   GlobalsGraph->markIncompleteNodes(DSGraph::MarkFormalArgs);
   GlobalsGraph->computeExternalFlags(DSGraph::ProcessCallSites);
 





More information about the llvm-commits mailing list