]> granicus.if.org Git - llvm/commitdiff
[ThinLTO] Correct counting of functions in inliner stats
authorTeresa Johnson <tejohnson@google.com>
Fri, 24 Mar 2017 17:59:06 +0000 (17:59 +0000)
committerTeresa Johnson <tejohnson@google.com>
Fri, 24 Mar 2017 17:59:06 +0000 (17:59 +0000)
Summary: Declarations need to be filtered out when counting functions.

Reviewers: eraman

Subscribers: Prazek, llvm-commits

Differential Revision: https://reviews.llvm.org/D31336

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298720 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp
test/Transforms/Inline/inline_stats.ll

index ed018bb73107486280c1852a7003a4f237bb399a..b8c12ad5ea84636e1d6202375540054e6ddc4641 100644 (file)
@@ -62,6 +62,8 @@ void ImportedFunctionsInliningStatistics::recordInline(const Function &Caller,
 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 cf0d43e9215b724cc648ba8b583cc3ee918954ba..bc005b6afd51e355ec00a2902ad02e1fc97582ff 100644 (file)
@@ -36,9 +36,12 @@ define void @internal3() {
     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
 }