Skip to content

Commit 95292a6

Browse files
test coverage for the subsequent patch #162349
1 parent 905b80f commit 95292a6

File tree

1 file changed

+31
-6
lines changed

1 file changed

+31
-6
lines changed

llvm/test/Transforms/PGOProfile/data-access-profile.ll

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@
1616
; RUN: opt -passes='memprof-use<profile-filename=memprof.profdata>' -memprof-annotate-static-data-prefix \
1717
; RUN: -debug-only=memprof -stats -S input.ll -o - 2>&1 | FileCheck %s --check-prefixes=LOG,IR,STAT
1818

19+
;; Tests that llc crashes on existing section prefixes.
20+
; RUN: opt -passes='memprof-use<profile-filename=memprof.profdata>' \
21+
; RUN: -memprof-annotate-static-data-prefix -S input.ll -o llc-input.ll
22+
; RUN: not llc -mtriple=x86_64-unknown-linux-gnu -partition-static-data-sections=true llc-input.ll -o - 2>&1 | FileCheck %s --check-prefix=ERR
23+
; ERR: Global variable var1 already has a section prefix hot
24+
1925
;; Run memprof without providing memprof data. Test that IR has module flag
2026
;; `EnableDataAccessProf` as 0.
2127
; RUN: opt -passes='memprof-use<profile-filename=memprof-no-dap.profdata>' -memprof-annotate-static-data-prefix \
@@ -39,10 +45,10 @@
3945
;; String literals are not annotated.
4046
; IR: @.str = unnamed_addr constant [5 x i8] c"abcde"
4147
; IR-NOT: section_prefix
42-
; IR: @var1 = global i32 123, !section_prefix !0
48+
; IR: @var1 = global i32 123, !section_prefix ![[NUM1:[0-9]+]]
4349

4450
;; @var.llvm.125 will be canonicalized to @var2 for profile look-up.
45-
; IR-NEXT: @var2.llvm.125 = global i64 0, !section_prefix !0
51+
; IR-NEXT: @var2.llvm.125 = global i64 0, !section_prefix ![[NUM1]]
4652

4753
;; @bar is not seen in hot symbol or known symbol set, so it won't get a section
4854
;; prefix. Test this by testing that there is no section_prefix between @bar and
@@ -51,7 +57,7 @@
5157
; IR-NOT: !section_prefix
5258

5359
;; @foo is unlikely.
54-
; IR-NEXT: @foo = global i8 2, !section_prefix !1
60+
; IR-NEXT: @foo = global i8 2, !section_prefix ![[NUM2:[0-9]+]]
5561

5662
; IR-NEXT: @var3 = constant [2 x i32] [i32 12345, i32 6789], section "sec1"
5763
; IR-NEXT: @var4 = constant [1 x i64] [i64 98765] #0
@@ -63,9 +69,10 @@
6369

6470
; IR: attributes #0 = { "rodata-section"="sec2" }
6571

66-
; IR: !0 = !{!"section_prefix", !"hot"}
67-
; IR-NEXT: !1 = !{!"section_prefix", !"unlikely"}
68-
; IR-NEXT: !2 = !{i32 2, !"EnableDataAccessProf", i32 1}
72+
; IR: ![[NUM1]] = !{!"section_prefix", !"hot"}
73+
; IR-NEXT: ![[NUM2]] = !{!"section_prefix", !"unlikely"}
74+
;; Profile Summary module metadata can come in the middle here.
75+
; IR: !{i32 2, !"EnableDataAccessProf", i32 1}
6976

7077
; FLAG: !{i32 2, !"EnableDataAccessProf", i32 0}
7178
; FLAGLESS-NOT: EnableDataAccessProf
@@ -134,6 +141,24 @@ declare i32 @func_taking_arbitrary_param(...)
134141

135142
attributes #0 = { "rodata-section"="sec2" }
136143

144+
!llvm.module.flags = !{!1}
145+
146+
!1 = !{i32 1, !"ProfileSummary", !2}
147+
!2 = !{!3, !4, !5, !6, !7, !8, !9, !10}
148+
!3 = !{!"ProfileFormat", !"InstrProf"}
149+
!4 = !{!"TotalCount", i64 1460183}
150+
!5 = !{!"MaxCount", i64 849024}
151+
!6 = !{!"MaxInternalCount", i64 32769}
152+
!7 = !{!"MaxFunctionCount", i64 849024}
153+
!8 = !{!"NumCounts", i64 23627}
154+
!9 = !{!"NumFunctions", i64 3271}
155+
!10 = !{!"DetailedSummary", !11}
156+
!11 = !{!12, !13}
157+
!12 = !{i32 990000, i64 166, i32 73}
158+
!13 = !{i32 999999, i64 3, i32 1443}
159+
!14 = !{!"function_entry_count", i64 100000}
160+
!15 = !{!"function_entry_count", i64 1}
161+
137162
;--- funcless-module.ll
138163

139164
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"

0 commit comments

Comments
 (0)