summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms/SampleProfile
diff options
context:
space:
mode:
authorDehao Chen <dehao@google.com>2017-11-01 20:26:47 +0000
committerDehao Chen <dehao@google.com>2017-11-01 20:26:47 +0000
commitc6c051f2ea7bdc0780190be15928daa96e0f19b6 (patch)
tree464c96c95f409dda2cdcc88cee9d84e32df29f4b /llvm/test/Transforms/SampleProfile
parent9cbe7c7f9348762c59c42fcad54df742180786bd (diff)
downloadbcm5719-llvm-c6c051f2ea7bdc0780190be15928daa96e0f19b6.tar.gz
bcm5719-llvm-c6c051f2ea7bdc0780190be15928daa96e0f19b6.zip
Include GUIDs from the same module when computing GUIDs that needs to be imported.
Summary: In the compile phase of SamplePGO+ThinLTO, ICP is not invoked. Instead, indirect call targets will be included as function metadata for ThinIndex to buidl the call graph. This should not only include functions defined in other modules, but also functions defined in the same module, otherwise ThinIndex may find the callee dead and eliminate it, while ICP in backend will revive the symbol, which leads to undefined symbol. Reviewers: tejohnson Reviewed By: tejohnson Subscribers: sanjoy, llvm-commits, mehdi_amini Differential Revision: https://reviews.llvm.org/D39480 llvm-svn: 317118
Diffstat (limited to 'llvm/test/Transforms/SampleProfile')
-rw-r--r--llvm/test/Transforms/SampleProfile/Inputs/function_metadata.prof (renamed from llvm/test/Transforms/SampleProfile/Inputs/import.prof)3
-rw-r--r--llvm/test/Transforms/SampleProfile/function_metadata.ll (renamed from llvm/test/Transforms/SampleProfile/import.ll)23
2 files changed, 24 insertions, 2 deletions
diff --git a/llvm/test/Transforms/SampleProfile/Inputs/import.prof b/llvm/test/Transforms/SampleProfile/Inputs/function_metadata.prof
index e09ee6bf060..4a348d9fa07 100644
--- a/llvm/test/Transforms/SampleProfile/Inputs/import.prof
+++ b/llvm/test/Transforms/SampleProfile/Inputs/function_metadata.prof
@@ -6,3 +6,6 @@ test:10000:0
1: 1000
4: foo2:1000
1: 1000 foo3:1000
+test_liveness:10000:0
+ 1: foo:1000
+ 1: foo_available:1000
diff --git a/llvm/test/Transforms/SampleProfile/import.ll b/llvm/test/Transforms/SampleProfile/function_metadata.ll
index 8cc2338a048..c8661188c17 100644
--- a/llvm/test/Transforms/SampleProfile/import.ll
+++ b/llvm/test/Transforms/SampleProfile/function_metadata.ll
@@ -1,10 +1,15 @@
-; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=new-pm-pgo-sample-use-pipeline -profile-file=%S/Inputs/import.prof -S | FileCheck %s
+; RUN: opt < %s -passes='thinlto-pre-link<O2>' -pgo-kind=new-pm-pgo-sample-use-pipeline -profile-file=%S/Inputs/function_metadata.prof -S | FileCheck %s
; Tests whether the functions in the inline stack are added to the
; function_entry_count metadata.
declare void @foo()
+define void @foo_available() !dbg !11 {
+ ret void
+}
+
+; CHECK: define void @test({{.*}} !prof ![[ENTRY_TEST:[0-9]+]]
define void @test(void ()*) !dbg !7 {
%2 = alloca void ()*
store void ()* %0, void ()** %2
@@ -15,9 +20,20 @@ define void @test(void ()*) !dbg !7 {
ret void
}
+; CHECK: define void @test_liveness({{.*}} !prof ![[ENTRY_TEST_LIVENESS:[0-9]+]]
+define void @test_liveness() !dbg !12 {
+ call void @foo(), !dbg !20
+ ret void
+}
+
; GUIDs of foo, bar, foo1, foo2 and foo3 should be included in the metadata to
; make sure hot inline stacks are imported.
-; CHECK: !{!"function_entry_count", i64 1, i64 2494702099028631698, i64 6699318081062747564, i64 7682762345278052905, i64 -7908226060800700466, i64 -2012135647395072713}
+; CHECK: ![[ENTRY_TEST]] = !{!"function_entry_count", i64 1, i64 2494702099028631698, i64 6699318081062747564, i64 7682762345278052905, i64 -7908226060800700466, i64 -2012135647395072713}
+
+; Check GUIDs for both foo and foo_available are included in the metadata to
+; make sure the liveness analysis can capture the dependency from test_liveness
+; to foo_available.
+; CHECK: ![[ENTRY_TEST_LIVENESS]] = !{!"function_entry_count", i64 1, i64 4005816710939881937, i64 6699318081062747564}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!8, !9}
@@ -31,7 +47,10 @@ define void @test(void ()*) !dbg !7 {
!8 = !{i32 2, !"Dwarf Version", i32 4}
!9 = !{i32 1, !"Debug Info Version", i32 3}
!10 = !{!"clang version 3.5 "}
+!11 = distinct !DISubprogram(name: "foo_available", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !1, type: !6, variables: !2)
+!12 = distinct !DISubprogram(name: "test_liveness", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !1, type: !6, variables: !2)
!15 = !DILexicalBlockFile(discriminator: 1, file: !1, scope: !7)
!17 = distinct !DILexicalBlock(line: 10, column: 0, file: !1, scope: !7)
!18 = !DILocation(line: 10, scope: !17)
!19 = !DILocation(line: 11, scope: !17)
+!20 = !DILocation(line: 8, scope: !12)
OpenPOWER on IntegriCloud