mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +01:00
93d80a543f
When sampleFDO is enabled, people may expect they can use -fno-profile-sample-use to opt-out using sample profile for a certain file. That could be either for debugging purpose or for performance tuning purpose. However, when thinlto is enabled, if a function in file A compiled with -fno-profile-sample-use is imported to another file B compiled with -fprofile-sample-use, the inlined copy of the function in file B may still get its profile annotated. The inconsistency may even introduce profile unused warning because if the target is not compiled with explicit debug information flag, the function in file A won't have its debug information enabled (debug information will be enabled implicitly only when -fprofile-sample-use is used). After it is imported into file B which is compiled with -fprofile-sample-use, profile annotation for the outline copy of the function will fail because the function has no debug information, and that will trigger profile unused warning. We add a new attribute use-sample-profile to control whether a function will use its sample profile no matter for its outline or inline copies. That will make the behavior of -fno-profile-sample-use consistent. Differential Revision: https://reviews.llvm.org/D79959
34 lines
1.4 KiB
LLVM
34 lines
1.4 KiB
LLVM
; RUN: opt < %s -sample-profile -sample-profile-file=%S/Inputs/entry_counts.prof -S | FileCheck %s
|
|
; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/entry_counts.prof -S | FileCheck %s
|
|
|
|
; According to the profile, function empty() was called 13,293 times.
|
|
; CHECK: {{.*}} = !{!"function_entry_count", i64 13294}
|
|
|
|
define void @empty() #0 !dbg !4 {
|
|
entry:
|
|
ret void, !dbg !9
|
|
}
|
|
|
|
; This function does not have profile, check if function_entry_count is -1
|
|
; CHECK: {{.*}} = !{!"function_entry_count", i64 -1}
|
|
define void @no_profile() #0 {
|
|
entry:
|
|
ret void
|
|
}
|
|
|
|
attributes #0 = {"use-sample-profile"}
|
|
|
|
!llvm.dbg.cu = !{!0}
|
|
!llvm.module.flags = !{!6, !7}
|
|
!llvm.ident = !{!8}
|
|
|
|
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.7.0 (trunk 237249) (llvm/trunk 237261)", isOptimized: false, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
|
|
!1 = !DIFile(filename: "entry_counts.c", directory: ".")
|
|
!2 = !{}
|
|
!4 = distinct !DISubprogram(name: "empty", scope: !1, file: !1, line: 1, type: !5, isLocal: false, isDefinition: true, scopeLine: 1, isOptimized: false, unit: !0, retainedNodes: !2)
|
|
!5 = !DISubroutineType(types: !2)
|
|
!6 = !{i32 2, !"Dwarf Version", i32 4}
|
|
!7 = !{i32 2, !"Debug Info Version", i32 3}
|
|
!8 = !{!"clang version 3.7.0 (trunk 237249) (llvm/trunk 237261)"}
|
|
!9 = !DILocation(line: 1, column: 15, scope: !4)
|