From: Dehao Chen Date: Tue, 21 Mar 2017 17:22:35 +0000 (+0000) Subject: Use ProfileSummary:getProfileCount to get ScaledCount for ModuleSummary X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1f1b30ac8fb1fc60c5ef0cb551bbf463641ce4c0;p=llvm Use ProfileSummary:getProfileCount to get ScaledCount for ModuleSummary Summary: ModuleSummary should use the standard interface of ProfileSummary::getProfileCount. Reviewers: eraman, tejohnson Reviewed By: tejohnson Subscribers: tejohnson, mehdi_amini, llvm-commits Differential Revision: https://reviews.llvm.org/D31154 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@298404 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/ModuleSummaryAnalysis.cpp b/lib/Analysis/ModuleSummaryAnalysis.cpp index 87b6c0d18a0..2a54f03f5c6 100644 --- a/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/lib/Analysis/ModuleSummaryAnalysis.cpp @@ -231,7 +231,7 @@ computeFunctionSummary(ModuleSummaryIndex &Index, const Module &M, } // We should have named any anonymous globals assert(CalledFunction->hasName()); - auto ScaledCount = BFI ? BFI->getBlockProfileCount(&BB) : None; + auto ScaledCount = ProfileSummaryInfo::getProfileCount(&I, BFI); auto Hotness = ScaledCount ? getHotness(ScaledCount.getValue(), PSI) : CalleeInfo::HotnessType::Unknown; diff --git a/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll b/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll index a9f65c97610..3a5adea202e 100644 --- a/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll +++ b/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll @@ -10,7 +10,7 @@ ; CHECK-NEXT: +; CHECK-NEXT: ; CHECK-NEXT: ; CHECK-LABEL: ; CHECK-LABEL: @@ -49,6 +50,7 @@ entry: Cold: ; 1/1000 goes here call void @cold() call void @hot2() + call void @hot4(), !prof !15 call void @none1() br label %exit Hot: ; 999/1000 goes here @@ -69,6 +71,7 @@ exit: declare void @hot1() #1 declare void @hot2() #1 declare void @hot3() #1 +declare void @hot4() #1 declare void @cold() #1 declare void @none1() #1 declare void @none2() #1 @@ -97,3 +100,4 @@ declare void @none3() #1 !12 = !{i32 10000, i64 100, i32 1} !13 = !{i32 999000, i64 100, i32 1} !14 = !{i32 999999, i64 1, i32 2} +!15 = !{!"branch_weights", i32 100}