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));
}
}
}
--- /dev/null
+; RUN: opt < %s -basiccg
+; PR13903
+
+define void @main() {
+ invoke void @llvm.donothing()
+ to label %ret unwind label %unw
+unw:
+ %tmp = landingpad i8 personality i8 0 cleanup
+ br label %ret
+ret:
+ ret void
+}
+declare void @llvm.donothing() nounwind readnone