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

Chris Lattner lattner at cs.uiuc.edu
Tue Oct 21 23:44:01 PDT 2003


Changes in directory llvm/lib/Transforms/IPO:

FunctionResolution.cpp updated: 1.40 -> 1.41

---
Log message:

Update the 'used' flag correctly


---
Diffs of the changes:  (+7 -6)

Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.40 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.41
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.40	Tue Oct 21 23:42:20 2003
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp	Tue Oct 21 23:43:18 2003
@@ -245,23 +245,24 @@
   // algorithm here to avoid problems with iterators getting invalidated if we
   // did a one pass scheme.
   //
+  bool Changed = false;
   for (Module::iterator I = M.begin(), E = M.end(); I != E; ) {
     Function *F = I++;
-    if (F->use_empty() && F->isExternal())
+    if (F->use_empty() && F->isExternal()) {
       M.getFunctionList().erase(F);
-    else if (!F->hasInternalLinkage() && !F->getName().empty())
+      Changed = true;
+    } else if (!F->hasInternalLinkage() && !F->getName().empty())
       Globals[F->getName()].push_back(F);
   }
 
   for (Module::giterator I = M.gbegin(), E = M.gend(); I != E; ) {
     GlobalVariable *GV = I++;
-    if (GV->use_empty() && GV->isExternal())
+    if (GV->use_empty() && GV->isExternal()) {
       M.getGlobalList().erase(GV);
-    else if (!GV->hasInternalLinkage() && !GV->getName().empty())
+      Changed = true;
+    } else if (!GV->hasInternalLinkage() && !GV->getName().empty())
       Globals[GV->getName()].push_back(GV);
   }
-
-  bool Changed = false;
 
   TargetData &TD = getAnalysis<TargetData>();
 





More information about the llvm-commits mailing list