[llvm] r271090 - [IRPGO] Set the function entry count metadata.

Sean Silva via llvm-commits llvm-commits at lists.llvm.org
Fri May 27 20:02:54 PDT 2016


Author: silvas
Date: Fri May 27 22:02:54 2016
New Revision: 271090

URL: http://llvm.org/viewvc/llvm-project?rev=271090&view=rev
Log:
[IRPGO] Set the function entry count metadata.

Modified:
    llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
    llvm/trunk/test/Transforms/PGOProfile/branch1.ll

Modified: llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp?rev=271090&r1=271089&r2=271090&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp (original)
+++ llvm/trunk/lib/Transforms/Instrumentation/PGOInstrumentation.cpp Fri May 27 22:02:54 2016
@@ -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());
 

Modified: llvm/trunk/test/Transforms/PGOProfile/branch1.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/PGOProfile/branch1.ll?rev=271090&r1=271089&r2=271090&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/PGOProfile/branch1.ll (original)
+++ llvm/trunk/test/Transforms/PGOProfile/branch1.ll Fri May 27 22:02:54 2016
@@ -21,6 +21,8 @@ target triple = "x86_64-unknown-linux-gn
 ; 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}




More information about the llvm-commits mailing list