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

Chris Lattner lattner at cs.uiuc.edu
Sun Jul 18 00:23:08 PDT 2004



Changes in directory llvm/lib/Transforms/IPO:

GlobalDCE.cpp updated: 1.32 -> 1.33

---
Log message:

Remove useless statistic, fix some slightly broken logic


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

Index: llvm/lib/Transforms/IPO/GlobalDCE.cpp
diff -u llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.32 llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.33
--- llvm/lib/Transforms/IPO/GlobalDCE.cpp:1.32	Sat Jul 17 19:25:04 2004
+++ llvm/lib/Transforms/IPO/GlobalDCE.cpp	Sun Jul 18 02:22:58 2004
@@ -26,7 +26,6 @@
 namespace {
   Statistic<> NumFunctions("globaldce","Number of functions removed");
   Statistic<> NumVariables("globaldce","Number of global variables removed");
-  Statistic<> NumGVs("globaldce", "Number of global values removed");
 
   struct GlobalDCE : public Pass {
     // run - Do the GlobalDCE pass on the specified module, optionally updating
@@ -171,13 +170,10 @@
 // might make it deader.
 //
 bool GlobalDCE::RemoveUnusedGlobalValue(GlobalValue &GV) {
-  for (Value::use_iterator I = GV.use_begin(), E = GV.use_end(); I != E; ++I)
-    if (GlobalValue* User = dyn_cast<GlobalValue>(*I))
-      if (User->removeDeadConstantUsers()) {  // Only if unreferenced...
-        ++NumGVs;
-      }
-   return false;
- }
+  if (GV.use_empty()) return false;
+  GV.removeDeadConstantUsers();
+  return GV.use_empty();
+}
  
 // SafeToDestroyConstant - It is safe to destroy a constant iff it is only used
 // by constants itself.  Note that constants cannot be cyclic, so this test is





More information about the llvm-commits mailing list