turn a dead conditional into an assert.
authorChris Lattner <sabre@nondot.org>
Wed, 23 Mar 2005 20:12:08 +0000 (20:12 +0000)
committerChris Lattner <sabre@nondot.org>
Wed, 23 Mar 2005 20:12:08 +0000 (20:12 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@20787 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/DataStructure/DataStructure.cpp

index a84c4fe0322301e79888f11baf175e275987389a..45b27733e2eab4f296d0e13be9f5c2417168a057 100644 (file)
@@ -1347,6 +1347,9 @@ void DSGraph::mergeInGraph(const DSCallSite &CS,
                            const DSGraph &Graph, unsigned CloneFlags) {
   TIME_REGION(X, "mergeInGraph");
 
+  assert((CloneFlags & DontCloneCallNodes) &&
+         "Doesn't support copying of call nodes!");
+
   // If this is not a recursive call, clone the graph into this graph...
   if (&Graph == this) {
     // Merge the return value with the return value of the context.
@@ -1381,13 +1384,6 @@ void DSGraph::mergeInGraph(const DSCallSite &CS,
     RC.merge(CS.getPtrArg(i), Args[i+1]);
   }
     
-  // If requested, copy all of the calls.
-  if (!(CloneFlags & DontCloneCallNodes)) {
-    // Copy the function calls list.
-    for (fc_iterator I = Graph.fc_begin(), E = Graph.fc_end(); I != E; ++I)
-      FunctionCalls.push_back(DSCallSite(*I, RC));
-  }
-
   // If the user has us copying aux calls (the normal case), set up a data
   // structure to keep track of which ones we've copied over.
   std::set<const DSCallSite*> CopiedAuxCall;
@@ -1405,10 +1401,10 @@ void DSGraph::mergeInGraph(const DSCallSite &CS,
 
       // If requested, copy any aux calls that can reach copied nodes.
       for (afc_iterator I = Graph.afc_begin(), E = Graph.afc_end(); I!=E; ++I)
-        if (CopiedAuxCall.insert(&*I).second &&
-            PathExistsToClonedNode(*I, RC)) {
+        if (!CopiedAuxCall.count(&*I) && PathExistsToClonedNode(*I, RC)) {
           AuxFunctionCalls.push_back(DSCallSite(*I, RC));
           MadeChange = true;
+          CopiedAuxCall.insert(&*I);
         }
     }
 }