Now that invoke of an intrinsic is possible (for the llvm.do.nothing intrinsic)
[oota-llvm.git] / lib / Analysis / IPA / CallGraph.cpp
index 17631ddb305616d268c06bcf0ad5006bf163d07f..dec0eced27863cacf2599e8c7415b608bd48703a 100644 (file)
@@ -141,12 +141,13 @@ private:
       for (BasicBlock::iterator II = BB->begin(), IE = BB->end();
            II != IE; ++II) {
         CallSite CS(cast<Value>(II));
-        if (CS && !isa<IntrinsicInst>(II)) {
+        if (CS) {
           const Function *Callee = CS.getCalledFunction();
-          if (Callee)
-            Node->addCalledFunction(CS, getOrInsertFunction(Callee));
-          else
+          if (!Callee)
+            // Indirect calls of intrinsics are not allowed so no need to check.
             Node->addCalledFunction(CS, CallsExternalNode);
+          else if (!Callee->isIntrinsic())
+            Node->addCalledFunction(CS, getOrInsertFunction(Callee));
         }
       }
   }