Index: lib/Analysis/CallGraph.cpp =================================================================== --- lib/Analysis/CallGraph.cpp +++ lib/Analysis/CallGraph.cpp @@ -55,6 +55,9 @@ } void CallGraph::addToCallGraph(Function *F) { + if (F->isIntrinsic()) + return; + CallGraphNode *Node = getOrInsertFunction(F); // If this function has external linkage, anything could call it. @@ -76,7 +79,7 @@ // If this function is not defined in this translation unit, it could call // anything. - if (F->isDeclaration() && !F->isIntrinsic()) + if (F->isDeclaration()) Node->addCalledFunction(CallSite(), CallsExternalNode.get()); // Look for calls by this function. Index: lib/Transforms/IPO/PruneEH.cpp =================================================================== --- lib/Transforms/IPO/PruneEH.cpp +++ lib/Transforms/IPO/PruneEH.cpp @@ -134,11 +134,14 @@ bool InstMightUnwind = true; if (const auto *CI = dyn_cast(&I)) { if (Function *Callee = CI->getCalledFunction()) { - CallGraphNode *CalleeNode = CG[Callee]; - // If the callee is outside our current SCC then we may throw - // because it might. If it is inside, do nothing. - if (SCCNodes.count(CalleeNode) > 0) - InstMightUnwind = false; + // The call graph does not contain intrinsics. + if (!Callee->isIntrinsic()) { + CallGraphNode *CalleeNode = CG[Callee]; + // If the callee is outside our current SCC then we may throw + // because it might. If it is inside, do nothing. + if (SCCNodes.count(CalleeNode) > 0) + InstMightUnwind = false; + } } } SCCMightUnwind |= InstMightUnwind; Index: test/Transforms/FunctionAttrs/assume.ll =================================================================== --- /dev/null +++ test/Transforms/FunctionAttrs/assume.ll @@ -0,0 +1,4 @@ +; RUN: opt -S -o - -functionattrs %s | FileCheck %s + +; CHECK-NOT: readnone +declare void @llvm.assume(i1)