Index: lib/Analysis/ModuleSummaryAnalysis.cpp =================================================================== --- lib/Analysis/ModuleSummaryAnalysis.cpp +++ lib/Analysis/ModuleSummaryAnalysis.cpp @@ -231,7 +231,7 @@ } // 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; Index: test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll =================================================================== --- test/Bitcode/thinlto-function-summary-callgraph-profile-summary.ll +++ 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 @@ 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 @@ 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 @@ !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}