diff options
author | Dehao Chen <dehao@google.com> | 2017-11-01 20:26:47 +0000 |
---|---|---|
committer | Dehao Chen <dehao@google.com> | 2017-11-01 20:26:47 +0000 |
commit | 2db2d47e39d2d1b07427e055ebfaeceb90794821 (patch) | |
tree | 3fc6ee69ade0da3b4ee575a9a8e291c6309828f9 /test/Transforms/SampleProfile | |
parent | 4d7894c6d831b2129c10b90ebe1c389ec1a3d758 (diff) |
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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317118 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/SampleProfile')
-rw-r--r-- | test/Transforms/SampleProfile/Inputs/function_metadata.prof (renamed from test/Transforms/SampleProfile/Inputs/import.prof) | 3 | ||||
-rw-r--r-- | test/Transforms/SampleProfile/function_metadata.ll (renamed from test/Transforms/SampleProfile/import.ll) | 23 |
2 files changed, 24 insertions, 2 deletions
diff --git a/test/Transforms/SampleProfile/Inputs/import.prof b/test/Transforms/SampleProfile/Inputs/function_metadata.prof index e09ee6bf060..4a348d9fa07 100644 --- a/test/Transforms/SampleProfile/Inputs/import.prof +++ b/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/test/Transforms/SampleProfile/import.ll b/test/Transforms/SampleProfile/function_metadata.ll index 8cc2338a048..c8661188c17 100644 --- a/test/Transforms/SampleProfile/import.ll +++ b/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) |