| 1 |
; RUN: opt < %s -passes='require<profile-summary>,cgscc(inline)' -S | FileCheck %s |
| 2 |
|
| 3 |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" |
| 4 |
target triple = "x86_64-unknown-linux-gnu" |
| 5 |
|
| 6 |
@p = dso_local global ptr null, align 8 |
| 7 |
|
| 8 |
; After _Z3goov is inlined into _Z3foov, the value profile of the indirect |
| 9 |
; call in _Z3goov and _Z3foov need to be scaled. The test is to make sure |
| 10 |
; the magic number NOMORE_ICP_MAGICNUM used for prevent recursive indirect |
| 11 |
; call will be kept during the scaling. |
| 12 |
; |
| 13 |
; CHECK-LABEL: @_Z3goov( |
| 14 |
; CHECK: call void %t0(), {{.*}} !prof ![[PROF_ID1:[0-9]+]] |
| 15 |
; CHECK-NEXT: ret void |
| 16 |
; |
| 17 |
; CHECK-LABEL: @_Z3foov( |
| 18 |
; CHECK: call void %t0.i(), {{.*}} !prof ![[PROF_ID2:[0-9]+]] |
| 19 |
; CHECK-NEXT: ret void |
| 20 |
; |
| 21 |
; Function Attrs: uwtable mustprogress |
| 22 |
define dso_local void @_Z3goov() #0 !dbg !11 !prof !23 { |
| 23 |
entry: |
| 24 |
%t0 = load ptr, ptr @p, align 8, !dbg !12, !tbaa !13 |
| 25 |
call void %t0(), !dbg !17, !prof !22 |
| 26 |
ret void, !dbg !18 |
| 27 |
} |
| 28 |
|
| 29 |
; Function Attrs: uwtable mustprogress |
| 30 |
define dso_local void @_Z3foov() #0 !dbg !19 { |
| 31 |
entry: |
| 32 |
call void @_Z3goov(), !dbg !20, !prof !24 |
| 33 |
ret void, !dbg !21 |
| 34 |
} |
| 35 |
|
| 36 |
attributes #0 = { uwtable mustprogress "use-sample-profile" } |
| 37 |
|
| 38 |
!llvm.dbg.cu = !{!0} |
| 39 |
!llvm.module.flags = !{!3, !4, !5, !25} |
| 40 |
!llvm.ident = !{!6} |
| 41 |
|
| 42 |
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None) |
| 43 |
!1 = !DIFile(filename: "1.cc", directory: "") |
| 44 |
!2 = !{} |
| 45 |
!3 = !{i32 7, !"Dwarf Version", i32 4} |
| 46 |
!4 = !{i32 2, !"Debug Info Version", i32 3} |
| 47 |
!5 = !{i32 1, !"wchar_size", i32 4} |
| 48 |
!6 = !{!""} |
| 49 |
!8 = !DISubroutineType(types: !2) |
| 50 |
!11 = distinct !DISubprogram(name: "goo", linkageName: "_Z3goov", scope: !1, file: !1, line: 6, type: !8, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) |
| 51 |
!12 = !DILocation(line: 7, column: 5, scope: !11) |
| 52 |
!13 = !{!14, !14, i64 0} |
| 53 |
!14 = !{!"any pointer", !15, i64 0} |
| 54 |
!15 = !{!"omnipotent char", !16, i64 0} |
| 55 |
!16 = !{!"Simple C++ TBAA"} |
| 56 |
!17 = !DILocation(line: 7, column: 3, scope: !11) |
| 57 |
!18 = !DILocation(line: 8, column: 1, scope: !11) |
| 58 |
!19 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 10, type: !8, scopeLine: 10, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2) |
| 59 |
!20 = !DILocation(line: 11, column: 3, scope: !19) |
| 60 |
!21 = !DILocation(line: 12, column: 3, scope: !19) |
| 61 |
; CHECK: ![[PROF_ID1]] = !{!"VP", i32 0, i64 7200, i64 -7383239051784516332, i64 -1, i64 -3834823603621627078, i64 7200} |
| 62 |
; CHECK: ![[PROF_ID2]] = !{!"VP", i32 0, i64 800, i64 -7383239051784516332, i64 -1, i64 -3834823603621627078, i64 800} |
| 63 |
!22 = !{!"VP", i32 0, i64 8000, i64 -7383239051784516332, i64 -1, i64 125292384912345234234, i64 8000} |
| 64 |
!23 = !{!"function_entry_count", i64 1000} |
| 65 |
!24 = !{!"branch_weights", i32 100} |
| 66 |
!25 = !{i32 1, !"ProfileSummary", !26} |
| 67 |
!26 = !{!27, !28, !29, !30, !31, !32, !33, !34} |
| 68 |
!27 = !{!"ProfileFormat", !"SampleProfile"} |
| 69 |
!28 = !{!"TotalCount", i64 10000} |
| 70 |
!29 = !{!"MaxCount", i64 1000} |
| 71 |
!30 = !{!"MaxInternalCount", i64 1} |
| 72 |
!31 = !{!"MaxFunctionCount", i64 1000} |
| 73 |
!32 = !{!"NumCounts", i64 3} |
| 74 |
!33 = !{!"NumFunctions", i64 3} |
| 75 |
!34 = !{!"DetailedSummary", !35} |
| 76 |
!35 = !{!36, !37, !38} |
| 77 |
!36 = !{i32 10000, i64 100, i32 1} |
| 78 |
!37 = !{i32 999000, i64 100, i32 1} |
| 79 |
!38 = !{i32 999999, i64 1, i32 2} |