[llvm] r273745 - Hookup ProfileSummary with SampleProfilerLoader
Dehao Chen via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 24 15:57:07 PDT 2016
Author: dehao
Date: Fri Jun 24 17:57:06 2016
New Revision: 273745
URL: http://llvm.org/viewvc/llvm-project?rev=273745&view=rev
Log:
Hookup ProfileSummary with SampleProfilerLoader
Summary: Set ProfileSummary in SampleProfilerLoader.
Reviewers: davidxl, eraman
Subscribers: llvm-commits
Differential Revision: http://reviews.llvm.org/D21702
Added:
llvm/trunk/test/Transforms/SampleProfile/Inputs/summary.prof
llvm/trunk/test/Transforms/SampleProfile/summary.ll
Modified:
llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
Modified: llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp?rev=273745&r1=273744&r2=273745&view=diff
==============================================================================
--- llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp (original)
+++ llvm/trunk/lib/Transforms/IPO/SampleProfile.cpp Fri Jun 24 17:57:06 2016
@@ -1275,6 +1275,7 @@ bool SampleProfileLoader::runOnModule(Mo
clearFunctionData();
retval |= runOnFunction(F);
}
+ M.setProfileSummary(Reader->getSummary().getMD(M.getContext()));
return retval;
}
Added: llvm/trunk/test/Transforms/SampleProfile/Inputs/summary.prof
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/Inputs/summary.prof?rev=273745&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/Inputs/summary.prof (added)
+++ llvm/trunk/test/Transforms/SampleProfile/Inputs/summary.prof Fri Jun 24 17:57:06 2016
@@ -0,0 +1,4 @@
+bar:100:3
+ 1: 100
+foo:200:1
+ 1: 200
Added: llvm/trunk/test/Transforms/SampleProfile/summary.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/SampleProfile/summary.ll?rev=273745&view=auto
==============================================================================
--- llvm/trunk/test/Transforms/SampleProfile/summary.ll (added)
+++ llvm/trunk/test/Transforms/SampleProfile/summary.ll Fri Jun 24 17:57:06 2016
@@ -0,0 +1,14 @@
+; Test that we annotate entire program's summary to IR.
+; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/summary.prof -S | FileCheck %s
+
+define i32 @bar() #0 !dbg !1 {
+entry:
+ ret i32 1, !dbg !2
+}
+
+; CHECK-DAG: {{![0-9]+}} = !{i32 1, !"ProfileSummary", {{![0-9]+}}}
+; CHECK-DAG: {{![0-9]+}} = !{!"NumFunctions", i64 2}
+; CHECK-DAG: {{![0-9]+}} = !{!"MaxFunctionCount", i64 3}
+
+!1 = distinct !DISubprogram(name: "bar")
+!2 = !DILocation(line: 2, scope: !2)
More information about the llvm-commits
mailing list