Debian Codegraph @

llvm/test/Transforms/SampleProfile/uniqname.ll

raw
1 ; Make sure profile matching is successful if both profile and IR contain
2 ; ".__uniq." suffix, for text format or extbinary format profile.
3 ; Make sure profile matching is successful if IR contains ".__uniq." suffix
4 ; but profile doesn't contain the suffix, for extbinary format profile.
5 ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/uniqname.suffix.prof -S | FileCheck %s
6 ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/uniqname.suffix.afdo -S | FileCheck %s
7 ; RUN: opt < %s -passes=sample-profile -sample-profile-file=%S/Inputs/uniqname.nosuffix.afdo -S | FileCheck %s
8
9 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
10 target triple = "x86_64-unknown-linux-gnu"
11
12 @cond = dso_local global i8 0, align 1
13 @p = dso_local global ptr null, align 8
14
15 ; Check the callsite in inlined function with uniq suffix is annotated with
16 ; profile correctly.
17 ; CHECK-LABEL: @_Z3foov(
18 ; CHECK: call void @_Z10moo_calleev(), {{.*}} !prof ![[PROF_ID1:[0-9]+]]
19 ; CHECK: call void @_Z10noo_calleev(), {{.*}} !prof ![[PROF_ID2:[0-9]+]]
20 ; CHECK: ret void
21
22 ; Function Attrs: uwtable mustprogress
23 define dso_local void @_Z3foov() #0 !dbg !7 {
24 entry:
25 store ptr @_ZL3hoov.__uniq.334154460836426447066042049082945760258, ptr @p, align 8, !dbg !9, !tbaa !10
26 call void @_ZL3goov.__uniq.334154460836426447066042049082945760258.llvm.4206369970847378271(), !dbg !14
27 call void @_ZL3moov.__uniq.334154460836426447066042049082945760258(), !dbg !15
28 ret void, !dbg !16
29 }
30
31 ; Function Attrs: uwtable mustprogress
32 define internal void @_ZL3hoov.__uniq.334154460836426447066042049082945760258() #1 !dbg !17 {
33 entry:
34 call void @_Z10hoo_calleev(), !dbg !18
35 ret void, !dbg !19
36 }
37
38 ; Check the indirect call target with uniq suffix is promoted and the inlined
39 ; body is annotated with profile.
40 ; CHECK: define internal void @_ZL3goov.__uniq.334154460836426447066042049082945760258.llvm.4206369970847378271{{.*}} !prof ![[PROF_ID3:[0-9]+]]
41 ; CHECK: icmp eq ptr {{.*}} @_ZL3hoov.__uniq.334154460836426447066042049082945760258
42 ; CHECK: call void @_Z10hoo_calleev(), {{.*}} !prof ![[PROF_ID4:[0-9]+]]
43
44 ; Function Attrs: noinline uwtable mustprogress
45 define internal void @_ZL3goov.__uniq.334154460836426447066042049082945760258.llvm.4206369970847378271() #2 !dbg !20 {
46 entry:
47 %0 = load ptr, ptr @p, align 8, !dbg !21, !tbaa !10
48 call void %0(), !dbg !22
49 ret void, !dbg !23
50 }
51
52 ; Function Attrs: uwtable mustprogress
53 define internal void @_ZL3moov.__uniq.334154460836426447066042049082945760258() #1 !dbg !24 {
54 entry:
55 call void @_Z10moo_calleev(), !dbg !25
56 %0 = load volatile i8, ptr @cond, align 1, !dbg !26, !tbaa !27, !range !29
57 %tobool.not = icmp eq i8 %0, 0, !dbg !26
58 br i1 %tobool.not, label %if.end, label %if.then, !dbg !26
59
60 if.then: ; preds = %entry
61 call void @_ZL3noov.__uniq.334154460836426447066042049082945760258(), !dbg !30
62 br label %if.end, !dbg !30
63
64 if.end: ; preds = %if.then, %entry
65 ret void, !dbg !31
66 }
67
68 declare !dbg !32 dso_local void @_Z10hoo_calleev()
69
70 declare !dbg !33 dso_local void @_Z10moo_calleev()
71
72 ; Function Attrs: uwtable mustprogress
73 define internal void @_ZL3noov.__uniq.334154460836426447066042049082945760258() #1 !dbg !34 {
74 entry:
75 %0 = load volatile i8, ptr @cond, align 1, !dbg !35, !tbaa !27, !range !29
76 %tobool.not = icmp eq i8 %0, 0, !dbg !35
77 br i1 %tobool.not, label %if.end, label %if.then, !dbg !35
78
79 if.then: ; preds = %entry
80 call void @_Z10noo_calleev(), !dbg !36
81 br label %if.end, !dbg !36
82
83 if.end: ; preds = %if.then, %entry
84 ret void, !dbg !37
85 }
86
87 declare !dbg !38 dso_local void @_Z10noo_calleev()
88
89 attributes #0 = { uwtable mustprogress "use-sample-profile" }
90 attributes #1 = { uwtable mustprogress "use-sample-profile" "sample-profile-suffix-elision-policy"="selected" }
91 attributes #2 = { noinline uwtable mustprogress "use-sample-profile" "sample-profile-suffix-elision-policy"="selected" }
92
93 ; CHECK: ![[PROF_ID1]] = !{!"branch_weights", i32 5931}
94 ; CHECK: ![[PROF_ID2]] = !{!"branch_weights", i32 2000}
95 ; CHECK: ![[PROF_ID3]] = !{!"function_entry_count", i64 5861}
96 ; CHECK: ![[PROF_ID4]] = !{!"branch_weights", i32 5000}
97
98 !llvm.dbg.cu = !{!0}
99 !llvm.module.flags = !{!3, !4, !5}
100 !llvm.ident = !{!6}
101
102 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1, producer: "clang version 12.0.0 (https://github.com/llvm/llvm-project.git e42c17446a2e5cbf9eebc752beafadad3fac7f63)", isOptimized: true, runtimeVersion: 0, emissionKind: LineTablesOnly, enums: !2, splitDebugInlining: false, debugInfoForProfiling: true, nameTableKind: None)
103 !1 = !DIFile(filename: "1.cc", directory: "/usr/local/google/home/wmi/workarea/llvm/build/splitprofile")
104 !2 = !{}
105 !3 = !{i32 7, !"Dwarf Version", i32 4}
106 !4 = !{i32 2, !"Debug Info Version", i32 3}
107 !5 = !{i32 1, !"wchar_size", i32 4}
108 !6 = !{!"clang version 12.0.0 (https://github.com/llvm/llvm-project.git e42c17446a2e5cbf9eebc752beafadad3fac7f63)"}
109 !7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 28, type: !8, scopeLine: 28, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
110 !8 = !DISubroutineType(types: !2)
111 !9 = !DILocation(line: 29, column: 5, scope: !7)
112 !10 = !{!11, !11, i64 0}
113 !11 = !{!"any pointer", !12, i64 0}
114 !12 = !{!"omnipotent char", !13, i64 0}
115 !13 = !{!"Simple C++ TBAA"}
116 !14 = !DILocation(line: 30, column: 3, scope: !7)
117 !15 = !DILocation(line: 31, column: 3, scope: !7)
118 !16 = !DILocation(line: 32, column: 3, scope: !7)
119 !17 = distinct !DISubprogram(name: "hoo", linkageName: "_ZL3hoov.__uniq.334154460836426447066042049082945760258", scope: !1, file: !1, line: 17, type: !8, scopeLine: 17, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
120 !18 = !DILocation(line: 18, column: 3, scope: !17)
121 !19 = !DILocation(line: 19, column: 1, scope: !17)
122 !20 = distinct !DISubprogram(name: "goo", linkageName: "_ZL3goov.__uniq.334154460836426447066042049082945760258.llvm.4206369970847378271", scope: !1, file: !1, line: 24, type: !8, scopeLine: 24, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
123 !21 = !DILocation(line: 25, column: 5, scope: !20)
124 !22 = !DILocation(line: 25, column: 3, scope: !20)
125 !23 = !DILocation(line: 26, column: 1, scope: !20)
126 !24 = distinct !DISubprogram(name: "moo", linkageName: "_ZL3moov.__uniq.334154460836426447066042049082945760258", scope: !1, file: !1, line: 11, type: !8, scopeLine: 11, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
127 !25 = !DILocation(line: 12, column: 3, scope: !24)
128 !26 = !DILocation(line: 13, column: 7, scope: !24)
129 !27 = !{!28, !28, i64 0}
130 !28 = !{!"bool", !12, i64 0}
131 !29 = !{i8 0, i8 2}
132 !30 = !DILocation(line: 14, column: 5, scope: !24)
133 !31 = !DILocation(line: 15, column: 1, scope: !24)
134 !32 = !DISubprogram(name: "hoo_callee", linkageName: "_Z10hoo_calleev", scope: !1, file: !1, line: 3, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
135 !33 = !DISubprogram(name: "moo_callee", linkageName: "_Z10moo_calleev", scope: !1, file: !1, line: 2, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)
136 !34 = distinct !DISubprogram(name: "noo", linkageName: "_ZL3noov.__uniq.334154460836426447066042049082945760258", scope: !1, file: !1, line: 6, type: !8, scopeLine: 6, flags: DIFlagPrototyped | DIFlagAllCallsDescribed, spFlags: DISPFlagLocalToUnit | DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
137 !35 = !DILocation(line: 7, column: 7, scope: !34)
138 !36 = !DILocation(line: 8, column: 5, scope: !34)
139 !37 = !DILocation(line: 9, column: 1, scope: !34)
140 !38 = !DISubprogram(name: "noo_callee", linkageName: "_Z10noo_calleev", scope: !1, file: !1, line: 1, type: !8, flags: DIFlagPrototyped, spFlags: DISPFlagOptimized, retainedNodes: !2)