* Fix a bug introduced in the last checkin wrt Stack markers
authorChris Lattner <sabre@nondot.org>
Mon, 3 Feb 2003 20:08:51 +0000 (20:08 +0000)
committerChris Lattner <sabre@nondot.org>
Mon, 3 Feb 2003 20:08:51 +0000 (20:08 +0000)
* Make cloning more efficient in the process...

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

lib/Analysis/DataStructure/DataStructure.cpp

index 818ca3781fc2f1ba7f64dd302883c1d5064a8527..80c64d126c6cd7d136e3a68ab8e385080d8f7682 100644 (file)
@@ -599,10 +599,15 @@ DSNodeHandle DSGraph::cloneInto(const DSGraph &G,
 
   // Duplicate all of the nodes, populating the node map...
   Nodes.reserve(FN+G.Nodes.size());
+
+  // Remove alloca or mod/ref bits as specified...
+  unsigned clearBits = (CloneFlags & StripAllocaBit ? DSNode::AllocaNode : 0)
+    | (CloneFlags & StripModRefBits ? (DSNode::Modified | DSNode::Read) : 0);
+  clearBits |= DSNode::DEAD;  // Clear dead flag...
   for (unsigned i = 0, e = G.Nodes.size(); i != e; ++i) {
     DSNode *Old = G.Nodes[i];
     DSNode *New = new DSNode(*Old);
-    New->NodeType &= ~DSNode::DEAD;  // Clear dead flag...
+    New->NodeType &= ~clearBits;
     Nodes.push_back(New);
     OldNodeMap[Old] = New;
   }
@@ -615,13 +620,6 @@ DSNodeHandle DSGraph::cloneInto(const DSGraph &G,
   for (unsigned i = FN, e = Nodes.size(); i != e; ++i)
     Nodes[i]->remapLinks(OldNodeMap);
 
-  // Remove alloca markers as specified
-  if (CloneFlags & (StripAllocaBit | StripModRefBits)) {
-    unsigned clearBits = (CloneFlags & StripAllocaBit ? DSNode::AllocaNode : 0)
-       | (CloneFlags & StripModRefBits ? (DSNode::Modified | DSNode::Read) : 0);
-    maskNodeTypes(~clearBits);
-  }
-
   // Copy the scalar map... merging all of the global nodes...
   for (hash_map<Value*, DSNodeHandle>::const_iterator I = G.ScalarMap.begin(),
          E = G.ScalarMap.end(); I != E; ++I) {