forked from OSchip/llvm-project
[IRPGO] Set the function entry count metadata.
llvm-svn: 271090
This commit is contained in:
parent
2a73019f3e
commit
7884633c5b
|
@ -870,6 +870,7 @@ static bool annotateAllFunctions(
|
||||||
auto *BFI = LookupBFI(F);
|
auto *BFI = LookupBFI(F);
|
||||||
PGOUseFunc Func(F, &M, BPI, BFI);
|
PGOUseFunc Func(F, &M, BPI, BFI);
|
||||||
setPGOCountOnFunc(Func, PGOReader.get());
|
setPGOCountOnFunc(Func, PGOReader.get());
|
||||||
|
F.setEntryCount(Func.EntryCount);
|
||||||
if (!Func.getProfileRecord().Counts.empty())
|
if (!Func.getProfileRecord().Counts.empty())
|
||||||
Builder.addRecord(Func.getProfileRecord());
|
Builder.addRecord(Func.getProfileRecord());
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ target triple = "x86_64-unknown-linux-gnu"
|
||||||
; GEN: @__profn_test_br_1 = private constant [9 x i8] c"test_br_1"
|
; GEN: @__profn_test_br_1 = private constant [9 x i8] c"test_br_1"
|
||||||
|
|
||||||
define i32 @test_br_1(i32 %i) {
|
define i32 @test_br_1(i32 %i) {
|
||||||
|
; USE-LABEL: @test_br_1
|
||||||
|
; USE-SAME: !prof ![[FUNC_ENTRY_COUNT:[0-9]+]]
|
||||||
entry:
|
entry:
|
||||||
; GEN: entry:
|
; GEN: entry:
|
||||||
; GEN-NOT: llvm.instrprof.increment
|
; GEN-NOT: llvm.instrprof.increment
|
||||||
|
@ -44,3 +46,4 @@ if.end:
|
||||||
}
|
}
|
||||||
; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}}
|
; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}}
|
||||||
; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}}
|
; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}}
|
||||||
|
; USE-DAG: ![[FUNC_ENTRY_COUNT]] = !{!"function_entry_count", i64 3}
|
||||||
|
|
Loading…
Reference in New Issue