[llvm-branch-commits] [llvm-branch] r100552 - in /llvm/branches/ggreif/CallInst-operands: ./ lib/Transforms/IPO/GlobalOpt.cpp

Gabor Greif ggreif at gmail.com
Tue Apr 6 12:43:11 PDT 2010


Author: ggreif
Date: Tue Apr  6 14:43:11 2010
New Revision: 100552

URL: http://llvm.org/viewvc/llvm-project?rev=100552&view=rev
Log:
pull an important fix from trunk

Modified:
    llvm/branches/ggreif/CallInst-operands/   (props changed)
    llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp

Propchange: llvm/branches/ggreif/CallInst-operands/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Apr  6 14:43:11 2010
@@ -1,2 +1,3 @@
 /llvm/branches/ggreif/InvokeInst-operands:98645-99398
 /llvm/branches/ggreif/const-CallSite:99517-100006
+/llvm/trunk:100544

Modified: llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp?rev=100552&r1=100551&r2=100552&view=diff
==============================================================================
--- llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp (original)
+++ llvm/branches/ggreif/CallInst-operands/lib/Transforms/IPO/GlobalOpt.cpp Tue Apr  6 14:43:11 2010
@@ -682,16 +682,17 @@
         Changed = true;
       }
     } else if (isa<CallInst>(I) || isa<InvokeInst>(I)) {
-      if (I->getOperand(0) == V) {
+      CallSite CS(I);
+      if (CS.getCalledValue() == V) {
         // Calling through the pointer!  Turn into a direct call, but be careful
         // that the pointer is not also being passed as an argument.
-        I->setOperand(0, NewV);
+        CS.setCalledFunction(NewV);
         Changed = true;
         bool PassedAsArg = false;
-        for (unsigned i = 1, e = I->getNumOperands(); i != e; ++i)
-          if (I->getOperand(i) == V) {
+        for (unsigned i = 0, e = CS.arg_size(); i != e; ++i)
+          if (CS.getArgument(i) == V) {
             PassedAsArg = true;
-            I->setOperand(i, NewV);
+            CS.setArgument(i, NewV);
           }
 
         if (PassedAsArg) {





More information about the llvm-branch-commits mailing list