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

Chris Lattner lattner at cs.uiuc.edu
Wed Jan 28 21:33:03 PST 2004


Changes in directory llvm/lib/Analysis/DataStructure:

DataStructure.cpp updated: 1.146 -> 1.147

---
Log message:

Minor bugfixes


---
Diffs of the changes:  (+12 -8)

Index: llvm/lib/Analysis/DataStructure/DataStructure.cpp
diff -u llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.146 llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.147
--- llvm/lib/Analysis/DataStructure/DataStructure.cpp:1.146	Wed Jan 28 03:15:42 2004
+++ llvm/lib/Analysis/DataStructure/DataStructure.cpp	Wed Jan 28 21:32:15 2004
@@ -1176,8 +1176,8 @@
       // Advance the argument iterator to the first pointer argument...
       while (AI != F.aend() && !isPointerType(AI->getType())) {
         ++AI;
-#ifndef NDEBUG
-        if (AI == F.aend())
+#ifndef NDEBUG  // FIXME: We should merge vararg arguments!
+        if (AI == F.aend() && !F.getFunctionType()->isVarArg())
           std::cerr << "Bad call to Function: " << F.getName() << "\n";
 #endif
       }
@@ -1227,8 +1227,8 @@
       // Advance the argument iterator to the first pointer argument...
       while (AI != F.aend() && !isPointerType(AI->getType())) {
         ++AI;
-#ifndef NDEBUG
-        if (AI == F.aend())
+#ifndef NDEBUG // FIXME: We should merge varargs arguments!!
+        if (AI == F.aend() && !F.getFunctionType()->isVarArg())
           std::cerr << "Bad call to Function: " << F.getName() << "\n";
 #endif
       }
@@ -1490,14 +1490,18 @@
       if (Node->getNumReferrers() == Node->getGlobals().size()) {
         const std::vector<GlobalValue*> &Globals = Node->getGlobals();
 
+        // Loop through and make sure all of the globals are referring directly
+        // to the node...
+        for (unsigned j = 0, e = Globals.size(); j != e; ++j) {
+          DSNode *N = getNodeForValue(Globals[j]).getNode();
+          assert(N == Node && "ScalarMap doesn't match globals list!");
+        }
+
         // Make sure NumReferrers still agrees, if so, the node is truly dead.
-        // Remove the scalarmap entries, which will drop the actual referrer
-        // count to zero.
         if (Node->getNumReferrers() == Globals.size()) {
           for (unsigned j = 0, e = Globals.size(); j != e; ++j)
             ScalarMap.erase(Globals[j]);
-          if (Node->hasNoReferrers())
-            Node->makeNodeDead();
+          Node->makeNodeDead();
         }
       }
     }





More information about the llvm-commits mailing list