simplify logic and get rid of the assumption that operand 0 is the callee
authorGabor Greif <ggreif@gmail.com>
Tue, 24 Mar 2009 19:28:39 +0000 (19:28 +0000)
committerGabor Greif <ggreif@gmail.com>
Tue, 24 Mar 2009 19:28:39 +0000 (19:28 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67642 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Analysis/AliasAnalysisEvaluator.cpp

index c7a86d3506fc3e92a9dadf80409692f2aa3111a8..07820e350681c935205ffb73878c4d386d9131bc 100644 (file)
@@ -123,14 +123,14 @@ bool AAEval::runOnFunction(Function &F) {
       Pointers.insert(&*I);
     Instruction &Inst = *I;
     User::op_iterator OI = Inst.op_begin();
-    if ((isa<InvokeInst>(Inst) || isa<CallInst>(Inst)) &&
-        isa<Function>(Inst.getOperand(0)))
+    CallSite CS = CallSite::get(&Inst);
+    if (CS.getInstruction() &&
+        isa<Function>(CS.getCalledValue()))
       ++OI;  // Skip actual functions for direct function calls.
     for (; OI != Inst.op_end(); ++OI)
       if (isa<PointerType>((*OI)->getType()) && !isa<ConstantPointerNull>(*OI))
         Pointers.insert(*OI);
 
-    CallSite CS = CallSite::get(&*I);
     if (CS.getInstruction()) CallSites.insert(CS);
   }