[PATCH] D36637: Import all inlined indirect call targets for SamplePGO.
Dehao Chen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 19 13:39:27 PDT 2017
danielcdh updated this revision to Diff 115894.
danielcdh added a comment.
update
https://reviews.llvm.org/D36637
Files:
lib/Transforms/IPO/SampleProfile.cpp
test/Transforms/SampleProfile/Inputs/import.prof
test/Transforms/SampleProfile/import.ll
Index: test/Transforms/SampleProfile/import.ll
===================================================================
--- test/Transforms/SampleProfile/import.ll
+++ test/Transforms/SampleProfile/import.ll
@@ -5,14 +5,19 @@
declare void @foo()
-define void @main() !dbg !7 {
+define void @test(void ()*) !dbg !7 {
+ %2 = alloca void ()*
+ store void ()* %0, void ()** %2
+ %3 = load void ()*, void ()** %2
+ ; CHECK: call {{.*}}, !prof ![[PROF:[0-9]+]]
call void @foo(), !dbg !18
+ call void %3(), !dbg !19
ret void
}
-; GUIDs of foo and bar should be included in the metadata to make sure hot
-; inline stacks are imported.
-; CHECK: !{!"function_entry_count", i64 1, i64 6699318081062747564, i64 -2012135647395072713}
+; GUIDs of foo, bar, foo1 and foo2 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 -2012135647395072713}
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!8, !9}
@@ -22,10 +27,11 @@
!1 = !DIFile(filename: "calls.cc", directory: ".")
!2 = !{}
!6 = !DISubroutineType(types: !2)
-!7 = distinct !DISubprogram(name: "main", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !1, type: !6, variables: !2)
+!7 = distinct !DISubprogram(name: "test", line: 7, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, unit: !0, scopeLine: 7, file: !1, scope: !1, type: !6, variables: !2)
!8 = !{i32 2, !"Dwarf Version", i32 4}
!9 = !{i32 1, !"Debug Info Version", i32 3}
!10 = !{!"clang version 3.5 "}
!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)
Index: test/Transforms/SampleProfile/Inputs/import.prof
===================================================================
--- test/Transforms/SampleProfile/Inputs/import.prof
+++ test/Transforms/SampleProfile/Inputs/import.prof
@@ -1,4 +1,8 @@
-main:10000:0
+test:10000:0
3: foo:1000
3: bar:200
4: baz:10
+ 4: foo1:1000
+ 1: 1000
+ 4: foo2:1000
+ 1: 1000
Index: lib/Transforms/IPO/SampleProfile.cpp
===================================================================
--- lib/Transforms/IPO/SampleProfile.cpp
+++ lib/Transforms/IPO/SampleProfile.cpp
@@ -756,9 +756,10 @@
continue;
}
if (!CalledFunction || !CalledFunction->getSubprogram()) {
- findCalleeFunctionSamples(*I)->findImportedFunctions(
- ImportGUIDs, F.getParent(),
- Samples->getTotalSamples() * SampleProfileHotThreshold / 100);
+ for (const FunctionSamples *FS : findIndirectCallFunctionSamples(*I))
+ FS->findImportedFunctions(
+ ImportGUIDs, F.getParent(),
+ Samples->getTotalSamples() * SampleProfileHotThreshold / 100);
continue;
}
assert(isa<CallInst>(DI) || isa<InvokeInst>(DI));
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36637.115894.patch
Type: text/x-patch
Size: 3134 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170919/a91bcd12/attachment.bin>
More information about the llvm-commits
mailing list