use CallSite::isCalle instead of slow getOperandNo

llvm-svn: 62877
diff --git a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
index 9d7980c..dd5fce6 100644
--- a/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
+++ b/llvm/lib/Transforms/IPO/DeadArgumentElimination.cpp
@@ -182,7 +182,7 @@
     if (!TheCall) return false;   // Not a direct call site?
 
     // The addr of this function is passed to the call.
-    if (I.getOperandNo() != 0) return false;
+    if (!CS.isCallee(I)) return false;
   }
 
   // Okay, we know we can transform this function if safe.  Scan its body
@@ -438,13 +438,13 @@
   for (Value::use_iterator I = F.use_begin(), E = F.use_end(); I != E; ++I) {
     // If the function is PASSED IN as an argument, its address has been
     // taken.
-    if (I.getOperandNo() != 0) {
+    CallSite CS = CallSite::get(*I);
+    if (!CS.getInstruction() || !CS.isCallee(I)) {
       MarkLive(F);
       return;
     }
 
     // If this use is anything other than a call site, the function is alive.
-    CallSite CS = CallSite::get(*I);
     Instruction *TheCall = CS.getInstruction();
     if (!TheCall) {   // Not a direct call site?
       MarkLive(F);