[llvm-commits] [poolalloc] r156053 - in /poolalloc/trunk: include/dsa/DSSupport.h lib/DSA/BottomUpClosure.cpp lib/DSA/DSGraph.cpp lib/DSA/DataStructure.cpp

Will Dietz wdietz2 at illinois.edu
Wed May 2 19:20:29 PDT 2012


Author: wdietz2
Date: Wed May  2 21:20:28 2012
New Revision: 156053

URL: http://llvm.org/viewvc/llvm-project?rev=156053&view=rev
Log:
Introduce notion of "unresolvable" DSCallSites, and use for great justice.

There are two reasons a DSCallSite can be 'unresolvable':
* Direct call to declaration.
* Indirect call through node marked External.

In both of these cases the property is permanent once acquired (clearly
  declaration stay that way, and External is only given not taken away),
  keeping these around (and cloning everywhere!) is not only unnecessary
  but just plain wasteful.  This is because by virtue of never being
  resolved, no caller will ever gain any information from this callsite.

In fact, removing these callsites helps us track things passed to External
  code as +E without necessarily having to be +I (since we know everything
  about them, other than they're passed to external code), where before this
  patch we'd inline external DSCallSites indefinitely, forever re-marking
  Nodes passed to them as incomplete (since they're in Aux calls).

This breaks extern.ll/extern2.ll for this reason, as they expect +I also.
Will fix this in following commit.

This greatly improves runtime speed and memory usage across the board,
  but is particularly helpful for those that were especially terrible before:
  benchmarks that took gigs of memory and minutes (hours!) to run now need only
  few hundred megs and complete in seconds.

Modified:
    poolalloc/trunk/include/dsa/DSSupport.h
    poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
    poolalloc/trunk/lib/DSA/DSGraph.cpp
    poolalloc/trunk/lib/DSA/DataStructure.cpp

Modified: poolalloc/trunk/include/dsa/DSSupport.h
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/include/dsa/DSSupport.h?rev=156053&r1=156052&r2=156053&view=diff
==============================================================================
--- poolalloc/trunk/include/dsa/DSSupport.h (original)
+++ poolalloc/trunk/include/dsa/DSSupport.h Wed May  2 21:20:28 2012
@@ -362,6 +362,12 @@
   /// function
   ///
   bool isVarArg() const;
+
+  /// isUnresolvable - Determines if this call has properties that would
+  /// prevent it from ever being resolvded.  Put another way, no amount
+  /// additional information will make this callsite resolvable.
+  ///
+  bool isUnresolvable() const;
 };
 
 } // End llvm namespace

Modified: poolalloc/trunk/lib/DSA/BottomUpClosure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/BottomUpClosure.cpp?rev=156053&r1=156052&r2=156053&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/BottomUpClosure.cpp (original)
+++ poolalloc/trunk/lib/DSA/BottomUpClosure.cpp Wed May  2 21:20:28 2012
@@ -613,6 +613,12 @@
       continue;
     }
 
+    // If this callsite is unresolvable, get rid of it now.
+    if (CS.isUnresolvable()) {
+      TempFCs.erase(TempFCs.begin());
+      continue;
+    }
+
     // Find all callees for this callsite, according to the DSGraph!
     // Do *not* use the callgraph, because we're updating that as we go!
     std::vector<const Function*> CalledFuncs;

Modified: poolalloc/trunk/lib/DSA/DSGraph.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DSGraph.cpp?rev=156053&r1=156052&r2=156053&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DSGraph.cpp (original)
+++ poolalloc/trunk/lib/DSA/DSGraph.cpp Wed May  2 21:20:28 2012
@@ -483,16 +483,9 @@
 
   if (!(CloneFlags & DontCloneAuxCallNodes))
     for (afc_const_iterator I = Graph.afc_begin(), E = Graph.afc_end(); I!=E; ++I)
-      if (SCCFinder.PathExistsToClonedNode(*I))
+      if (!I->isUnresolvable() && SCCFinder.PathExistsToClonedNode(*I))
         AuxCallToCopy.push_back(&*I);
-//       else if (I->isIndirectCall()){
-//  	//If the call node doesn't have any callees, clone it
-//  	std::vector< const Function *> List;
-//  	I->getCalleeNode()->addFullFunctionList(List);
-//  	if (!List.size())
-//  	  AuxCallToCopy.push_back(&*I);
-//        }
-  
+
   // Copy aux calls that are needed.
   // Copy these before calculating the globals to be copied, as there might be
   // globals that reach the nodes cloned due to aux calls.

Modified: poolalloc/trunk/lib/DSA/DataStructure.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/DataStructure.cpp?rev=156053&r1=156052&r2=156053&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/DataStructure.cpp (original)
+++ poolalloc/trunk/lib/DSA/DataStructure.cpp Wed May  2 21:20:28 2012
@@ -1089,6 +1089,20 @@
   return FT->isVarArg();
 }
 
+/// isUnresolvable - Determines if this call has properties that would
+/// prevent it from ever being resolvded.  Put another way, no amount
+/// additional information will make this callsite resolvable.
+///
+bool DSCallSite::isUnresolvable() const {
+  // Direct calls are forever unresolvable if they are calls to declarations.
+  if (isDirectCall())
+    return getCalleeFunc()->isDeclaration();
+  // Indirect calls are forever unresolvable if the call node is marked
+  // external.
+  // (Nodes can't become non-external through additional information)
+  return getCalleeNode()->isExternFuncNode();
+}
+
 /// remapLinks - Change all of the Links in the current node according to the
 /// specified mapping.
 ///





More information about the llvm-commits mailing list