[llvm-commits] [poolalloc] r58525 - /poolalloc/trunk/lib/DSA/CallTargets.cpp

John Criswell criswell at uiuc.edu
Fri Oct 31 12:10:37 PDT 2008


Author: criswell
Date: Fri Oct 31 14:10:36 2008
New Revision: 58525

URL: http://llvm.org/viewvc/llvm-project?rev=58525&view=rev
Log:
Handle the case where we have a calls and invokes to function pointers that
are NULL.

Modified:
    poolalloc/trunk/lib/DSA/CallTargets.cpp

Modified: poolalloc/trunk/lib/DSA/CallTargets.cpp
URL: http://llvm.org/viewvc/llvm-project/poolalloc/trunk/lib/DSA/CallTargets.cpp?rev=58525&r1=58524&r2=58525&view=diff

==============================================================================
--- poolalloc/trunk/lib/DSA/CallTargets.cpp (original)
+++ poolalloc/trunk/lib/DSA/CallTargets.cpp Fri Oct 31 14:10:36 2008
@@ -51,21 +51,27 @@
             CallSite cs = CallSite::get(B);
             AllSites.push_back(cs);
             if (!cs.getCalledFunction()) {
-              IndCall++;
-              DSNode* N = T->getDSGraph(*cs.getCaller())
-                ->getNodeForValue(cs.getCalledValue()).getNode();
-              N->addFullFunctionList(IndMap[cs]);
-              if (N->isCompleteNode() && IndMap[cs].size()) {
+              if (isa<ConstantPointerNull>(cs.getCalledValue())) {
+                ++DirCall;
                 CompleteSites.insert(cs);
-                ++CompleteInd;
-              } 
-              if (N->isCompleteNode() && !IndMap[cs].size()) {
-                ++CompleteEmpty;
-                cerr << "Call site empty: '"
-                     << cs.getInstruction()->getName() 
-                     << "' In '"
-                     << cs.getInstruction()->getParent()->getParent()->getName()
-                     << "'\n";
+              } else {
+                IndCall++;
+                DSNode* N = T->getDSGraph(*cs.getCaller())
+                  ->getNodeForValue(cs.getCalledValue()).getNode();
+                assert (N && "CallTarget: findIndTargets: No DSNode!\n");
+                N->addFullFunctionList(IndMap[cs]);
+                if (N->isCompleteNode() && IndMap[cs].size()) {
+                  CompleteSites.insert(cs);
+                  ++CompleteInd;
+                } 
+                if (N->isCompleteNode() && !IndMap[cs].size()) {
+                  ++CompleteEmpty;
+                  cerr << "Call site empty: '"
+                       << cs.getInstruction()->getName() 
+                       << "' In '"
+                       << cs.getInstruction()->getParent()->getParent()->getName()
+                       << "'\n";
+                }
               }
             } else {
               ++DirCall;





More information about the llvm-commits mailing list