OSDN Git Service

[IRPGO] Set the function entry count metadata.
authorSean Silva <chisophugis@gmail.com>
Sat, 28 May 2016 03:02:54 +0000 (03:02 +0000)
committerSean Silva <chisophugis@gmail.com>
Sat, 28 May 2016 03:02:54 +0000 (03:02 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@271090 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Transforms/Instrumentation/PGOInstrumentation.cpp
test/Transforms/PGOProfile/branch1.ll

index 6f994eb..4c4784e 100644 (file)
@@ -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());
 
index 380a293..b2c7bcc 100644 (file)
@@ -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}