do not bother inlining nullary functions without return values. The only
authorChris Lattner <sabre@nondot.org>
Fri, 18 Mar 2005 23:19:47 +0000 (23:19 +0000)
committerChris Lattner <sabre@nondot.org>
Fri, 18 Mar 2005 23:19:47 +0000 (23:19 +0000)
effect these calls can have is due to global variables, and these passes
all use the globals graph to capture their effect anyway.  This speeds up
the BU pass very slightly on perlbmk, reducing the number of dsnodes
allocated from 98913 to 96423.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20676 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/BottomUpClosure.cpp
lib/Analysis/DataStructure/CompleteBottomUp.cpp
lib/Analysis/DataStructure/EquivClassGraphs.cpp

index 91cfc7c14ebc26a2817d744d868536ee6e220847..7ab7d8056435e931087545aebf7735ae9a21a45e 100644 (file)
@@ -305,6 +305,13 @@ void BUDataStructures::calculateGraph(DSGraph &Graph) {
 
     CalledFuncs.clear();
 
+    // Fast path for noop calls.  Note that we don't care about merging globals
+    // in the callee with nodes in the caller here.
+    if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0) {
+      TempFCs.erase(TempFCs.begin());
+      continue;
+    }
+
     if (CS.isDirectCall()) {
       Function *F = CS.getCalleeFunc();
       if (isResolvableFunc(F))
index 5a0436c0616b54d69aaa7db4e46a967edbd114cf..a70080a8c66bc43e6c4359f38ee0ecd14f7ec6af 100644 (file)
@@ -217,7 +217,11 @@ void CompleteBUDataStructures::processGraph(DSGraph &G) {
 
     assert(calls.insert(TheCall).second &&
            "Call instruction occurs multiple times in graph??");
-      
+    
+    // Fast path for noop calls.  Note that we don't care about merging globals
+    // in the callee with nodes in the caller here.
+    if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0)
+      continue;
 
     // Loop over all of the potentially called functions...
     // Inline direct calls as well as indirect calls because the direct
index ef78d66f7a588bed28593aa1800c59539411b3fe..c1789ef44a7f0fb5ce39b8041ef4cbee0f41dc5e 100644 (file)
@@ -406,6 +406,9 @@ void EquivClassGraphs::processGraph(DSGraph &G) {
     assert(calls.insert(TheCall).second &&
            "Call instruction occurs multiple times in graph??");
     
+    if (CS.getRetVal().isNull() && CS.getNumPtrArgs() == 0)
+      continue;
+
     // Inline the common callee graph into the current graph, if the callee
     // graph has not changed.  Note that all callees should have the same
     // graph so we only need to do this once.