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

Chris Lattner lattner at cs.uiuc.edu
Sat May 31 16:09:00 PDT 2003


Changes in directory llvm/lib/Transforms/IPO:

FunctionResolution.cpp updated: 1.29 -> 1.30

---
Log message:

Fix bug: FuncResolve/2003-05-31-InternalDecl.ll
Count resolutions correctly.


---
Diffs of the changes:

Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.29 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.30
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.29	Sat May 31 15:44:46 2003
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp	Sat May 31 16:08:45 2003
@@ -193,9 +193,14 @@
       // If there are any more uses that we could not resolve, force them to use
       // a casted pointer now.
       if (!Old->use_empty()) {
+        NumResolved += Old->use_size();
         Constant *NewCPR = ConstantPointerRef::get(Concrete);
         Old->replaceAllUsesWith(ConstantExpr::getCast(NewCPR, Old->getType()));
+        Changed = true;
       }
+
+      // Since there are no uses of Old anymore, remove it from the module.
+      M.getFunctionList().erase(Old);
     }
   return Changed;
 }
@@ -345,8 +350,7 @@
         GlobalValue *GV = cast<GlobalValue>(PI->second);
         assert(PI->first == GV->getName() &&
                "Global name and symbol table do not agree!");
-        if (!GV->hasInternalLinkage())  // Only resolve decls to external fns
-          Globals[PI->first].push_back(GV);
+        Globals[PI->first].push_back(GV);
       }
     }
 





More information about the llvm-commits mailing list