[llvm-commits] CVS: llvm/lib/Transforms/IPO/GlobalDCE.cpp

Chris Lattner lattner at cs.uiuc.edu
Thu Jun 26 00:42:01 PDT 2003


Changes in directory llvm/lib/Transforms/IPO:

GlobalDCE.cpp updated: 1.23 -> 1.24

---
Log message:

Add support to globaldce for deleting dead function prototypes


---
Diffs of the changes:

Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp
diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.23 llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.24
--- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.23	Sun Oct 13 12:12:47 2002
+++ llvm/lib/Transforms/IPO/GlobalDCE.cpp	Thu Jun 26 00:41:18 2003
@@ -46,12 +46,18 @@
     // Nothing to do if no unreachable functions have been found...
     if (FunctionsToDelete.empty()) return false;
     
-    // Unreachables functions have been found and should have no references to
+    // Unreachable functions have been found and should have no references to
     // them, delete them now.
     //
     for (std::vector<CallGraphNode*>::iterator I = FunctionsToDelete.begin(),
            E = FunctionsToDelete.end(); I != E; ++I)
       delete CallGraph.removeFunctionFromModule(*I);
+
+    // Walk the function list, removing prototypes for functions which are not
+    // used.
+    for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
+      if (I->use_size() == 0 && I->isExternal())
+        delete CallGraph.removeFunctionFromModule(I);
     
     return true;
   }





More information about the llvm-commits mailing list