Account for global variables resolved more accurately.
authorChris Lattner <sabre@nondot.org>
Sun, 13 Oct 2002 17:30:30 +0000 (17:30 +0000)
committerChris Lattner <sabre@nondot.org>
Sun, 13 Oct 2002 17:30:30 +0000 (17:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@4143 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/IPO/FunctionResolution.cpp

index f26438dbd2e3fe7533a8d5399e715d234e59af3a..09d46bedd92b052bec0546cd8c37f290bb2812d3 100644 (file)
@@ -236,14 +236,16 @@ static bool ProcessGlobalsWithSameName(Module &M,
     // later.
     //
     if (Globals[i]->isExternal() && Globals[i]->use_empty()) {
-      if (isFunction)
+      if (isFunction) {
         M.getFunctionList().erase(cast<Function>(Globals[i]));
-      else
+        ++NumResolved;
+      } else {
         M.getGlobalList().erase(cast<GlobalVariable>(Globals[i]));
+        ++NumGlobals;
+      }
 
       Globals.erase(Globals.begin()+i);
       Changed = true;
-      ++NumResolved;
     } else if (isFunction) {
       // For functions, we look to merge functions definitions of "int (...)"
       // to 'int (int)' or 'int ()' or whatever else is not completely generic.