[llvm-commits] CVS: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp DataStructure.cpp TopDownClosure.cpp

Vikram Adve vadve at cs.uiuc.edu
Wed Nov 27 11:42:01 PST 2002


Changes in directory llvm/lib/Analysis/DataStructure:

BottomUpClosure.cpp updated: 1.45 -> 1.46
DataStructure.cpp updated: 1.69 -> 1.70
TopDownClosure.cpp updated: 1.30 -> 1.31

---
Log message:

Fix logical error in TD pass: we should clear Mod/Ref bits of each caller
before inlining their graphs into a function.  To support this,
added flags to CloneFlags to strip/keep Mod/Ref bits.


---
Diffs of the changes:

Index: llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.45 llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.46
--- llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp:1.45	Sun Nov 17 16:16:28 2002
+++ llvm/lib/Analysis/DataStructure/BottomUpClosure.cpp	Wed Nov 27 11:41:13 2002
@@ -344,8 +344,9 @@
 #endif
       
       // Handle self recursion by resolving the arguments and return value
-      Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
-                         DSGraph::DontCloneCallNodes);
+      Graph.mergeInGraph(CS, GI,
+                         DSGraph::KeepModRefBits | 
+                         DSGraph::StripAllocaBit | DSGraph::DontCloneCallNodes);
 
 #if 0
       Graph.writeGraphToFile(std::cerr, "bu_" + F.getName() + "_after_" +
@@ -424,7 +425,8 @@
             << GI.getAuxFunctionCalls().size() << "]\n");
 
       // Handle self recursion by resolving the arguments and return value
-      Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
+      Graph.mergeInGraph(CS, GI,
+                         DSGraph::KeepModRefBits | DSGraph::StripAllocaBit |
                          DSGraph::DontCloneCallNodes);
     }
   }
@@ -508,7 +510,8 @@
               << GI.getAuxFunctionCalls().size() << "]\n");
         
         // Handle self recursion by resolving the arguments and return value
-        Graph.mergeInGraph(CS, GI, DSGraph::StripAllocaBit |
+        Graph.mergeInGraph(CS, GI,
+                           DSGraph::KeepModRefBits | DSGraph::StripAllocaBit |
                            DSGraph::DontCloneCallNodes);
 
         if (SCCFunctions.count(Callee))


Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.69 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.70
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.69	Mon Nov 25 12:21:25 2002
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Wed Nov 27 11:41:13 2002
@@ -598,9 +598,14 @@
     Nodes[i]->remapLinks(OldNodeMap);
 
   // Remove alloca markers as specified
-  if (CloneFlags & StripAllocaBit)
+  if (CloneFlags & (StripAllocaBit | StripModRefBits)) {
+    unsigned short clearBits =   (CloneFlags & StripAllocaBit
+                                  ? DSNode::AllocaNode : 0)
+                               | (CloneFlags & StripModRefBits
+                                  ? (DSNode::Modified | DSNode::Read) : 0);
     for (unsigned i = FN, e = Nodes.size(); i != e; ++i)
-      Nodes[i]->NodeType &= ~DSNode::AllocaNode;
+      Nodes[i]->NodeType &= ~clearBits;
+  }
 
   // Copy the value map... and merge all of the global nodes...
   for (std::map<Value*, DSNodeHandle>::const_iterator I = G.ScalarMap.begin(),


Index: llvm/lib/Analysis/DataStructure/TopDownClosure.cpp
diff -u llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.30 llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.31
--- llvm/lib/Analysis/DataStructure/TopDownClosure.cpp:1.30	Mon Nov 11 15:36:05 2002
+++ llvm/lib/Analysis/DataStructure/TopDownClosure.cpp	Wed Nov 27 11:41:13 2002
@@ -100,7 +100,7 @@
   const std::vector<DSCallSite> &CallSites = Graph.getFunctionCalls();
   if (CallSites.empty()) {
     DEBUG(std::cerr << "  [TD] No callees for: " << F.getName() << "\n");
-    return;  // If no call sites, the graph is the same as the BU graph!
+    return;  // If no call sites, there is nothing more to do here
   }
 
   // Loop over all of the call sites, building a multi-map from Callees to
@@ -143,9 +143,10 @@
       std::map<Value*, DSNodeHandle> OldValMap;
       std::map<const DSNode*, DSNodeHandle> OldNodeMap;
       CG.cloneInto(Graph, OldValMap, OldNodeMap,
+                   DSGraph::StripModRefBits |
                    DSGraph::KeepAllocaBit | DSGraph::DontCloneCallNodes);
       OldValMap.clear();  // We don't care about the ValMap
-      
+
       // Loop over all of the invocation sites of the callee, resolving
       // arguments to our graph.  This loop may iterate multiple times if the
       // current function calls this callee multiple times with different





More information about the llvm-commits mailing list