|
16 | 16 | ; RUN: opt -passes='memprof-use<profile-filename=memprof.profdata>' -memprof-annotate-static-data-prefix \ |
17 | 17 | ; RUN: -debug-only=memprof -stats -S input.ll -o - 2>&1 | FileCheck %s --check-prefixes=LOG,IR,STAT |
18 | 18 |
|
| 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 | + |
19 | 25 | ;; Run memprof without providing memprof data. Test that IR has module flag |
20 | 26 | ;; `EnableDataAccessProf` as 0. |
21 | 27 | ; RUN: opt -passes='memprof-use<profile-filename=memprof-no-dap.profdata>' -memprof-annotate-static-data-prefix \ |
|
39 | 45 | ;; String literals are not annotated. |
40 | 46 | ; IR: @.str = unnamed_addr constant [5 x i8] c"abcde" |
41 | 47 | ; IR-NOT: section_prefix |
42 | | -; IR: @var1 = global i32 123, !section_prefix !0 |
| 48 | +; IR: @var1 = global i32 123, !section_prefix ![[NUM1:[0-9]+]] |
43 | 49 |
|
44 | 50 | ;; @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]] |
46 | 52 |
|
47 | 53 | ;; @bar is not seen in hot symbol or known symbol set, so it won't get a section |
48 | 54 | ;; prefix. Test this by testing that there is no section_prefix between @bar and |
|
51 | 57 | ; IR-NOT: !section_prefix |
52 | 58 |
|
53 | 59 | ;; @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]+]] |
55 | 61 |
|
56 | 62 | ; IR-NEXT: @var3 = constant [2 x i32] [i32 12345, i32 6789], section "sec1" |
57 | 63 | ; IR-NEXT: @var4 = constant [1 x i64] [i64 98765] #0 |
|
63 | 69 |
|
64 | 70 | ; IR: attributes #0 = { "rodata-section"="sec2" } |
65 | 71 |
|
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} |
69 | 76 |
|
70 | 77 | ; FLAG: !{i32 2, !"EnableDataAccessProf", i32 0} |
71 | 78 | ; FLAGLESS-NOT: EnableDataAccessProf |
@@ -134,6 +141,24 @@ declare i32 @func_taking_arbitrary_param(...) |
134 | 141 |
|
135 | 142 | attributes #0 = { "rodata-section"="sec2" } |
136 | 143 |
|
| 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 | + |
137 | 162 | ;--- funcless-module.ll |
138 | 163 |
|
139 | 164 | 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