[llvm-commits] [poolalloc] r111441 - /poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp

John Criswell criswell at uiuc.edu
Wed Aug 18 15:40:06 PDT 2010


Author: criswell
Date: Wed Aug 18 17:40:06 2010
New Revision: 111441

URL: http://llvm.org/viewvc/llvm-project?rev=111441&view=rev
Log:
When we find that a function's DSGraph has been inlined into this DSGraph, go
ahead and merge its arguments into the arguments of the other functions and
set its DSGraph to be common DSGraph constructed for the equivalence class.
This fixes the assertion in poolalloc that asserts on 254.gap when poolalloc
assigns different numbers of pools to pass into different functions targeted by
the same indirect call site.

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

Modified: poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp?rev=111441&r1=111440&r2=111441&view=diff
==============================================================================
--- poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp (original)
+++ poolalloc/trunk/lib/DSA/EquivClassGraphs.cpp Wed Aug 18 17:40:06 2010
@@ -109,7 +109,40 @@
           BaseGraph = getOrCreateGraph(F);
           BaseGraph->getFunctionArgumentsForCall(F, Args);
         } else if (BaseGraph->containsFunction(F)) {
-          // The DSGraph for this function has already been merged.
+          //
+          // The DSGraph for this function has already been merged into the
+          // graph that we are creating.  However, that does not mean that
+          // function arguments of this function have been merged with the
+          // function arguments of the other functions in the equivalence graph
+          // (or even with functions belonging to the same SCC in the call
+          // graph).  Furthermore, it doesn't necessarily imply that the
+          // contained function's DSGraph is the same as the one we're
+          // building; it is possible (I think) for only the function's DSNodes
+          // and other information to have been merged in.
+          //
+          // For these reasons, we will merge the function argument DSNodes and
+          // set this function's DSGraph to be the same graph used for all
+          // other function's in this equivalence class.
+          //
+
+          //
+          // Merge the arguments together.
+          //
+          std::vector<DSNodeHandle> NextArgs;
+          BaseGraph->getFunctionArgumentsForCall(F, NextArgs);
+          unsigned i = 0, e = Args.size();
+          for (; i != e; ++i) {
+            if (i == NextArgs.size()) break;
+            Args[i].mergeWith(NextArgs[i]);
+          }
+          for (e = NextArgs.size(); i != e; ++i)
+            Args.push_back(NextArgs[i]);
+
+          //
+          // Make this function use the DSGraph that we're creating for all of
+          // the functions in this equivalence class.
+          //
+          setDSGraph(*F, BaseGraph);
         } else {
           //
           // Merge in the DSGraph.





More information about the llvm-commits mailing list