Index: llvm/trunk/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp =================================================================== --- llvm/trunk/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp +++ llvm/trunk/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp @@ -62,6 +62,8 @@ void ImportedFunctionsInliningStatistics::setModuleInfo(const Module &M) { ModuleName = M.getName(); for (const auto &F : M.functions()) { + if (F.isDeclaration()) + continue; AllFunctions++; ImportedFunctions += int(F.getMetadata("thinlto_src_module") != nullptr); } Index: llvm/trunk/test/Transforms/Inline/inline_stats.ll =================================================================== --- llvm/trunk/test/Transforms/Inline/inline_stats.ll +++ llvm/trunk/test/Transforms/Inline/inline_stats.ll @@ -36,9 +36,12 @@ ret void } +declare void @external_decl() + define void @external1() alwaysinline !thinlto_src_module !0 { call fastcc void @internal2() call fastcc void @external2(); + call void @external_decl(); ret void }