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

LLVM llvm at cs.uiuc.edu
Sat Jul 17 17:24:24 PDT 2004



Changes in directory llvm/lib/Transforms/IPO:

FunctionResolution.cpp updated: 1.48 -> 1.49

---
Log message:

bug 122: http://llvm.cs.uiuc.edu/PR122 :
- Replace ConstantPointerRef usage with GlobalValue usage


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

Index: llvm/lib/Transforms/IPO/FunctionResolution.cpp
diff -u llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.48 llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.49
--- llvm/lib/Transforms/IPO/FunctionResolution.cpp:1.48	Fri Jun 18 00:50:48 2004
+++ llvm/lib/Transforms/IPO/FunctionResolution.cpp	Sat Jul 17 19:24:14 2004
@@ -101,8 +101,7 @@
       if (!Old->use_empty()) {  // Avoid making the CPR unless we really need it
         Value *Replacement = Concrete;
         if (Concrete->getType() != Old->getType())
-          Replacement = ConstantExpr::getCast(ConstantPointerRef::get(Concrete),
-                                              Old->getType());
+          Replacement = ConstantExpr::getCast(Concrete,Old->getType());
         NumResolved += Old->use_size();
         Old->replaceAllUsesWith(Replacement);
       }
@@ -118,11 +117,10 @@
                                    std::vector<GlobalValue*> &Globals,
                                    GlobalVariable *Concrete) {
   bool Changed = false;
-  Constant *CCPR = ConstantPointerRef::get(Concrete);
 
   for (unsigned i = 0; i != Globals.size(); ++i)
     if (Globals[i] != Concrete) {
-      Constant *Cast = ConstantExpr::getCast(CCPR, Globals[i]->getType());
+      Constant *Cast = ConstantExpr::getCast(Concrete, Globals[i]->getType());
       Globals[i]->replaceAllUsesWith(Cast);
 
       // Since there are no uses of Old anymore, remove it from the module.
@@ -138,8 +136,8 @@
 static bool CallersAllIgnoreReturnValue(Function &F) {
   if (F.getReturnType() == Type::VoidTy) return true;
   for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) {
-    if (ConstantPointerRef *CPR = dyn_cast<ConstantPointerRef>(*I)) {
-      for (Value::use_iterator I = CPR->use_begin(), E = CPR->use_end();
+    if (GlobalValue *GV = dyn_cast<GlobalValue>(*I)) {
+      for (Value::use_iterator I = GV->use_begin(), E = GV->use_end();
            I != E; ++I) {
         CallSite CS = CallSite::get(*I);
         if (!CS.getInstruction() || !CS.getInstruction()->use_empty())





More information about the llvm-commits mailing list