[llvm-branch-commits] [llvm-branch] r99310 - in /llvm/branches/ggreif/InvokeInst-operands: include/llvm/Support/CallSite.h lib/VMCore/Function.cpp

Gabor Greif ggreif at gmail.com
Tue Mar 23 11:55:42 PDT 2010


Author: ggreif
Date: Tue Mar 23 13:55:42 2010
New Revision: 99310

URL: http://llvm.org/viewvc/llvm-project?rev=99310&view=rev
Log:
use CallSite to determine whether a use is the actual callee
fixes MultiSource/Benchmarks/PAQ8p

Modified:
    llvm/branches/ggreif/InvokeInst-operands/include/llvm/Support/CallSite.h
    llvm/branches/ggreif/InvokeInst-operands/lib/VMCore/Function.cpp

Modified: llvm/branches/ggreif/InvokeInst-operands/include/llvm/Support/CallSite.h
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/InvokeInst-operands/include/llvm/Support/CallSite.h?rev=99310&r1=99309&r2=99310&view=diff
==============================================================================
--- llvm/branches/ggreif/InvokeInst-operands/include/llvm/Support/CallSite.h (original)
+++ llvm/branches/ggreif/InvokeInst-operands/include/llvm/Support/CallSite.h Tue Mar 23 13:55:42 2010
@@ -192,6 +192,9 @@
   bool isCallee(Value::use_iterator UI) const {
     return getCallee() == &UI.getUse();
   }
+  bool isCallee(Value::use_const_iterator UI) const {
+    return getCallee() == &UI.getUse();
+  }
 private:
   /// Returns the operand number of the first argument
   unsigned getArgumentOffset() const {

Modified: llvm/branches/ggreif/InvokeInst-operands/lib/VMCore/Function.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/branches/ggreif/InvokeInst-operands/lib/VMCore/Function.cpp?rev=99310&r1=99309&r2=99310&view=diff
==============================================================================
--- llvm/branches/ggreif/InvokeInst-operands/lib/VMCore/Function.cpp (original)
+++ llvm/branches/ggreif/InvokeInst-operands/lib/VMCore/Function.cpp Tue Mar 23 13:55:42 2010
@@ -16,6 +16,7 @@
 #include "llvm/IntrinsicInst.h"
 #include "llvm/LLVMContext.h"
 #include "llvm/CodeGen/ValueTypes.h"
+#include "llvm/Support/CallSite.h"
 #include "llvm/Support/LeakDetector.h"
 #include "llvm/Support/ManagedStatic.h"
 #include "llvm/Support/StringPool.h"
@@ -404,8 +405,10 @@
 /// other than direct calls or invokes to it.
 bool Function::hasAddressTaken() const {
   for (Value::use_const_iterator I = use_begin(), E = use_end(); I != E; ++I) {
-    if (I.getOperandNo() != 0 ||
-        (!isa<CallInst>(*I) && !isa<InvokeInst>(*I)))
+    if (!isa<CallInst>(*I) && !isa<InvokeInst>(*I))
+      return true;
+    CallSite CS(const_cast<Instruction*>(static_cast<const Instruction*>(*I)));
+    if (!CS.isCallee(I))
       return true;
   }
   return false;





More information about the llvm-branch-commits mailing list