Skip to content

Commit a8fa34b

Browse files
Address comments.
1 parent 678c2ae commit a8fa34b

File tree

1 file changed

+37
-11
lines changed

1 file changed

+37
-11
lines changed

llvm/test/Transforms/PGOProfile/memprof-undrift.test

Lines changed: 37 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,61 @@ HeapProfileRecords:
1313
- GUID: _Z3foov
1414
AllocSites:
1515
- Callstack:
16-
- { Function: _Z3foov, LineOffset: 3, Column: 30, IsInlineFrame: false }
16+
- { Function: _Z3foov, LineOffset: 10, Column: 50, IsInlineFrame: true }
17+
- { Function: _Z3barv, LineOffset: 20, Column: 30, IsInlineFrame: false }
1718
- { Function: main, LineOffset: 2, Column: 5, IsInlineFrame: false }
1819
MemInfoBlock:
19-
# With these numbers, llvm::memprof::getAllocType will determine that
20-
# the call to new is cold. See MemoryProfileInfo.cpp for details.
21-
TotalSize: 400
2220
AllocCount: 1
23-
TotalLifetimeAccessDensity: 1
21+
TotalSize: 400
2422
TotalLifetime: 1000000
23+
TotalLifetimeAccessDensity: 1
2524
CallSites: []
25+
- GUID: _Z3barv
26+
AllocSites:
27+
- Callstack:
28+
- { Function: _Z3foov, LineOffset: 10, Column: 50, IsInlineFrame: true }
29+
- { Function: _Z3barv, LineOffset: 20, Column: 30, IsInlineFrame: false }
30+
- { Function: main, LineOffset: 2, Column: 5, IsInlineFrame: false }
31+
MemInfoBlock:
32+
AllocCount: 1
33+
TotalSize: 400
34+
TotalLifetime: 1000000
35+
TotalLifetimeAccessDensity: 1
36+
CallSites:
37+
- - { Function: _Z3foov, LineOffset: 10, Column: 50, IsInlineFrame: true }
38+
- { Function: _Z3barv, LineOffset: 20, Column: 30, IsInlineFrame: false }
2639
...
2740
;--- memprof_annotate_yaml.ll
2841
define dso_local ptr @_Z3foov() !dbg !4 {
42+
; CHECK-LABEL: @_Z3foov
2943
entry:
3044
%call = call ptr @_Znam(i64 4) #0, !dbg !5
31-
; CHECK: call ptr @_Znam(i64 4) #[[ATTR:[0-9]+]],
45+
; CHECK: = call {{.*}} #[[ATTR:[0-9]+]]
3246
ret ptr %call
3347
}
3448

35-
declare ptr @_Znam(i64)
49+
declare ptr @_Znam(i64 noundef)
50+
51+
define dso_local ptr @_Z3barv() !dbg !6 {
52+
; CHECK-LABEL: @_Z3barv
53+
entry:
54+
%call.i = call ptr @_Znam(i64 4) #0, !dbg !7
55+
; CHECK: = call {{.*}} #[[ATTR]]
56+
ret ptr %call.i
57+
}
3658

3759
attributes #0 = { builtin allocsize(0) }
38-
; CHECK: attributes #[[ATTR]] = {{.*}} "memprof"="cold"
60+
; CHECK: attributes #[[ATTR]] = { builtin allocsize(0) "memprof"="cold" }
3961

62+
!llvm.dbg.cu = !{!0}
4063
!llvm.module.flags = !{!2, !3}
4164

4265
!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus_14, file: !1)
43-
!1 = !DIFile(filename: "t", directory: "/")
66+
!1 = !DIFile(filename: "undrift.cc", directory: "/")
4467
!2 = !{i32 7, !"Dwarf Version", i32 5}
4568
!3 = !{i32 2, !"Debug Info Version", i32 3}
46-
!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 1, unit: !0)
47-
!5 = !DILocation(line: 1, column: 22, scope: !4)
69+
!4 = distinct !DISubprogram(name: "foo", linkageName: "_Z3foov", scope: !1, file: !1, line: 55, unit: !0)
70+
!5 = !DILocation(line: 55, column: 53, scope: !4)
71+
!6 = distinct !DISubprogram(name: "bar", linkageName: "_Z3barv", scope: !1, file: !1, line: 56, unit: !0)
72+
!7 = !DILocation(line: 55, column: 53, scope: !4, inlinedAt: !8)
73+
!8 = distinct !DILocation(line: 56, column: 22, scope: !6)

0 commit comments

Comments
 (0)