[llvm] r298720 - [ThinLTO] Correct counting of functions in inliner stats
Teresa Johnson via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 24 10:59:06 PDT 2017
Author: tejohnson
Date: Fri Mar 24 12:59:06 2017
New Revision: 298720
URL: http://llvm.org/viewvc/llvm-project?rev=298720&view=rev
Log:
[ThinLTO] Correct counting of functions in inliner stats
Summary: Declarations need to be filtered out when counting functions.
Reviewers: eraman
Subscribers: Prazek, llvm-commits
Differential Revision: https://reviews.llvm.org/D31336
Modified:
llvm/trunk/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp
llvm/trunk/test/Transforms/Inline/inline_stats.ll
Modified: llvm/trunk/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp?rev=298720&r1=298719&r2=298720&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp (original)
+++ llvm/trunk/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp Fri Mar 24 12:59:06 2017
@@ -62,6 +62,8 @@ void ImportedFunctionsInliningStatistics
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);
}
Modified: llvm/trunk/test/Transforms/Inline/inline_stats.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/Inline/inline_stats.ll?rev=298720&r1=298719&r2=298720&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/Inline/inline_stats.ll (original)
+++ llvm/trunk/test/Transforms/Inline/inline_stats.ll Fri Mar 24 12:59:06 2017
@@ -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
}
More information about the llvm-commits
mailing list