diff --git a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp b/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp index 87b6c0d18a0c..2a54f03f5c6f 100644 --- a/llvm/lib/Analysis/ModuleSummaryAnalysis.cpp +++ b/llvm/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/llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll b/llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll index a9f65c97610f..3a5adea202e2 100644 --- a/llvm/test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll +++ b/llvm/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}