diff options
author | Gabor Greif <ggreif@gmail.com> | 2010-04-06 18:45:08 +0000 |
---|---|---|
committer | Gabor Greif <ggreif@gmail.com> | 2010-04-06 18:45:08 +0000 |
commit | 04397890233b29b44fe70eb27e51df6164ea1818 (patch) | |
tree | e3d27aa4cabab7c3894fc7b78da80a121aea13d7 /llvm/lib/Transforms | |
parent | 5ec32e7fd845e0b7db33689f33cc2ef7c83710fa (diff) | |
download | bcm5719-llvm-04397890233b29b44fe70eb27e51df6164ea1818.tar.gz bcm5719-llvm-04397890233b29b44fe70eb27e51df6164ea1818.zip |
use CallSite to access calls vs. invokes uniformly
and remove assumptions about operand order
llvm-svn: 100544
Diffstat (limited to 'llvm/lib/Transforms')
-rw-r--r-- | llvm/lib/Transforms/IPO/GlobalOpt.cpp | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/IPO/GlobalOpt.cpp b/llvm/lib/Transforms/IPO/GlobalOpt.cpp index ddff5ef8b36..f61dc91ee03 100644 --- a/llvm/lib/Transforms/IPO/GlobalOpt.cpp +++ b/llvm/lib/Transforms/IPO/GlobalOpt.cpp @@ -682,16 +682,17 @@ static bool OptimizeAwayTrappingUsesOfValue(Value *V, Constant *NewV) { 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) { |