From ef7704b344d8f2142de1f2a0a7febbc13e09f989 Mon Sep 17 00:00:00 2001 From: Sean Silva Date: Sat, 28 May 2016 03:02:54 +0000 Subject: [PATCH] [IRPGO] Set the function entry count metadata. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271090 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Transforms/Instrumentation/PGOInstrumentation.cpp | 1 + test/Transforms/PGOProfile/branch1.ll | 3 +++ 2 files changed, 4 insertions(+) diff --git a/lib/Transforms/Instrumentation/PGOInstrumentation.cpp b/lib/Transforms/Instrumentation/PGOInstrumentation.cpp index 6f994eb2c7a..4c4784e2394 100644 --- a/lib/Transforms/Instrumentation/PGOInstrumentation.cpp +++ b/lib/Transforms/Instrumentation/PGOInstrumentation.cpp @@ -870,6 +870,7 @@ static bool annotateAllFunctions( auto *BFI = LookupBFI(F); PGOUseFunc Func(F, &M, BPI, BFI); setPGOCountOnFunc(Func, PGOReader.get()); + F.setEntryCount(Func.EntryCount); if (!Func.getProfileRecord().Counts.empty()) Builder.addRecord(Func.getProfileRecord()); diff --git a/test/Transforms/PGOProfile/branch1.ll b/test/Transforms/PGOProfile/branch1.ll index 380a293ca0e..b2c7bcc2c19 100644 --- a/test/Transforms/PGOProfile/branch1.ll +++ b/test/Transforms/PGOProfile/branch1.ll @@ -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" define i32 @test_br_1(i32 %i) { +; USE-LABEL: @test_br_1 +; USE-SAME: !prof ![[FUNC_ENTRY_COUNT:[0-9]+]] entry: ; GEN: entry: ; GEN-NOT: llvm.instrprof.increment @@ -44,3 +46,4 @@ if.end: } ; USE-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}} ; USE-DAG: {{![0-9]+}} = !{!"DetailedSummary", {{![0-9]+}}} +; USE-DAG: ![[FUNC_ENTRY_COUNT]] = !{!"function_entry_count", i64 3} -- 2.11.0