Commit 421e8a7
committed
[memprof] Print alloc site matches immediately
Without this patch, we buffer alloc site matches in
FullStackIdToAllocMatchInfo and then print them out at the end of
MemProfUsePass.
This practice is problematic when we have multiple matches per alloc
site. Consider:
char *f1() { return new char[3]; }
char *f2() { return f1(); }
__attribute__((noinline)) char *f3() { return f2(); }
In this example, f1 contains an alloc site, of course, but so do f2
and f3 via inlining. When something like this happens,
FullStackIdToAllocMatchInfo gets updated multiple times for the same
full stack ID at:
FullStackIdToAllocMatchInfo[FullStackId] = { ... };
with different InlinedCallStack.size() each time.
This patch changes the behavior by immediately printing out alloc site
matches, potentially printing out multiple matches for the same
FullStackId. It is up to the consumer of the message to figure out
the length of the longest matches for example.
For the test, this test adjusts an existing one,
memprof-dump-matched-alloc-site.ll. Specifically, this patch
"restores" the IR and corresponding profile for f2 and f1 so that the
compiler generates a "MemProf notcold" message for each of f1, f2, and
f3.1 parent f1886b1 commit 421e8a7
File tree
3 files changed
+76
-48
lines changed- llvm
- lib/Transforms/Instrumentation
- test/Transforms/PGOProfile
3 files changed
+76
-48
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
820 | 813 | | |
821 | 814 | | |
822 | 815 | | |
| |||
952 | 945 | | |
953 | 946 | | |
954 | 947 | | |
955 | | - | |
956 | | - | |
957 | | - | |
958 | | - | |
959 | | - | |
960 | | - | |
961 | | - | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
962 | 954 | | |
963 | 955 | | |
964 | 956 | | |
| |||
1146 | 1138 | | |
1147 | 1139 | | |
1148 | 1140 | | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
| 1141 | + | |
| 1142 | + | |
| 1143 | + | |
| 1144 | + | |
| 1145 | + | |
1152 | 1146 | | |
1153 | 1147 | | |
1154 | 1148 | | |
| |||
1258 | 1252 | | |
1259 | 1253 | | |
1260 | 1254 | | |
1261 | | - | |
1262 | | - | |
1263 | | - | |
1264 | | - | |
1265 | | - | |
1266 | 1255 | | |
1267 | 1256 | | |
1268 | 1257 | | |
| |||
1273 | 1262 | | |
1274 | 1263 | | |
1275 | 1264 | | |
1276 | | - | |
1277 | | - | |
| 1265 | + | |
| 1266 | + | |
1278 | 1267 | | |
1279 | 1268 | | |
1280 | 1269 | | |
1281 | | - | |
1282 | | - | |
1283 | | - | |
1284 | | - | |
1285 | | - | |
1286 | | - | |
1287 | 1270 | | |
1288 | 1271 | | |
1289 | 1272 | | |
| |||
Lines changed: 59 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
34 | 64 | | |
35 | 65 | | |
36 | 66 | | |
37 | | - | |
38 | | - | |
| 67 | + | |
| 68 | + | |
39 | 69 | | |
40 | 70 | | |
41 | 71 | | |
| |||
47 | 77 | | |
48 | 78 | | |
49 | 79 | | |
50 | | - | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
51 | 83 | | |
52 | 84 | | |
53 | 85 | | |
54 | 86 | | |
55 | | - | |
| 87 | + | |
56 | 88 | | |
57 | | - | |
58 | | - | |
| 89 | + | |
| 90 | + | |
59 | 91 | | |
60 | 92 | | |
61 | 93 | | |
62 | 94 | | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
63 | 107 | | |
64 | 108 | | |
65 | 109 | | |
66 | 110 | | |
67 | 111 | | |
68 | 112 | | |
69 | | - | |
70 | | - | |
| 113 | + | |
| 114 | + | |
71 | 115 | | |
72 | 116 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
116 | 114 | | |
117 | | - | |
118 | | - | |
119 | 115 | | |
120 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| |||
0 commit comments