93
93
; RUN: -r=%t/foo.o,_Z3fooR2B0j,plx \
94
94
; RUN: -r=%t/foo.o,_ZN2B03barEj.abc,plx \
95
95
; RUN: -r=%t/foo.o,_Z3xyzR2B0j, \
96
+ ; RUN: -r=%t/foo.o,_ZN2B03barEj, \
97
+ ; RUN: -r=%t/foo.o,_ZN1B3barEj, \
96
98
; RUN: -r=%t/main.o,_Z3fooR2B0j, \
97
99
; RUN: -r=%t/main.o,_Znwm, \
98
100
; RUN: -r=%t/main.o,_ZdlPvm, \
113
115
; RUN: -pass-remarks=. -save-temps \
114
116
; RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=STATS \
115
117
; RUN: --check-prefix=STATS-BE --check-prefix=REMARKS-MAIN \
116
- ; RUN: --check-prefix=REMARKS-FOO
118
+ ; RUN: --check-prefix=REMARKS-FOO --check-prefix=REMARKS-FOO-IMPORT
117
119
118
- ; RUN: llvm-dis %t.out.2.4.opt.bc -o - | FileCheck %s --check-prefix=IR
120
+ ; RUN: llvm-dis %t.out.2.4.opt.bc -o - | FileCheck %s --check-prefix=IR --check-prefix=IR-IMPORT
119
121
120
122
;; Try again but with distributed ThinLTO
121
123
; RUN: llvm-lto2 run %t/main.o %t/foo.o -enable-memprof-context-disambiguation \
124
126
; RUN: -r=%t/foo.o,_Z3fooR2B0j,plx \
125
127
; RUN: -r=%t/foo.o,_ZN2B03barEj.abc,plx \
126
128
; RUN: -r=%t/foo.o,_Z3xyzR2B0j, \
129
+ ; RUN: -r=%t/foo.o,_ZN2B03barEj, \
130
+ ; RUN: -r=%t/foo.o,_ZN1B3barEj, \
127
131
; RUN: -r=%t/main.o,_Z3fooR2B0j, \
128
132
; RUN: -r=%t/main.o,_Znwm, \
129
133
; RUN: -r=%t/main.o,_ZdlPvm, \
147
151
; RUN: -enable-memprof-indirect-call-support=true \
148
152
; RUN: -summary-file=%t/foo.o.thinlto.bc -memprof-import-summary=%t/foo.o.thinlto.bc \
149
153
; RUN: -enable-import-metadata -stats -pass-remarks=. \
150
- ; RUN: %t/foo.o -S 2>&1 | FileCheck %s --check-prefix=IR \
151
- ; RUN: --check-prefix=STATS-BE-DISTRIB --check-prefix=REMARKS-FOO
154
+ ; RUN: %t/foo.o -S 2>&1 | FileCheck %s --check-prefix=IR --check-prefix=IR-IMPORT \
155
+ ; RUN: --check-prefix=STATS-BE-DISTRIB --check-prefix=REMARKS-FOO \
156
+ ; RUN: --check-prefix=REMARKS-FOO-IMPORT
152
157
153
158
;; Retry with the ICP-disabled object file, and make sure we disable it again
154
159
;; so we don't look for the synthesized callsite records when applying imports.
159
164
; RUN: -r=%t/foo.noicp.o,_Z3fooR2B0j,plx \
160
165
; RUN: -r=%t/foo.noicp.o,_ZN2B03barEj.abc,plx \
161
166
; RUN: -r=%t/foo.noicp.o,_Z3xyzR2B0j, \
167
+ ; RUN: -r=%t/foo.noicp.o,_ZN2B03barEj, \
168
+ ; RUN: -r=%t/foo.noicp.o,_ZN1B3barEj, \
162
169
; RUN: -r=%t/main.o,_Z3fooR2B0j, \
163
170
; RUN: -r=%t/main.o,_Znwm, \
164
171
; RUN: -r=%t/main.o,_ZdlPvm, \
184
191
;; metadata.
185
192
; RUN: llvm-dis %t.noicp.out.2.4.opt.bc -o - | FileCheck %s --implicit-check-not "_Z3fooR2B0j.memprof" --implicit-check-not "!callsite"
186
193
194
+ ;; Run in-process ThinLTO again, but with importing disabled by setting the
195
+ ;; instruction limit to 0. Ensure that the existing declarations of B::bar
196
+ ;; and B0::bar are sufficient to allow for the promotion and cloning.
197
+ ; RUN: llvm-lto2 run %t/main.o %t/foo.o -enable-memprof-context-disambiguation \
198
+ ; RUN: -import-instr-limit=0 \
199
+ ; RUN: -enable-memprof-indirect-call-support=true \
200
+ ; RUN: -supports-hot-cold-new \
201
+ ; RUN: -r=%t/foo.o,_Z3fooR2B0j,plx \
202
+ ; RUN: -r=%t/foo.o,_ZN2B03barEj.abc,plx \
203
+ ; RUN: -r=%t/foo.o,_Z3xyzR2B0j, \
204
+ ; RUN: -r=%t/foo.o,_ZN2B03barEj, \
205
+ ; RUN: -r=%t/foo.o,_ZN1B3barEj, \
206
+ ; RUN: -r=%t/main.o,_Z3fooR2B0j, \
207
+ ; RUN: -r=%t/main.o,_Znwm, \
208
+ ; RUN: -r=%t/main.o,_ZdlPvm, \
209
+ ; RUN: -r=%t/main.o,_Z8externalPi, \
210
+ ; RUN: -r=%t/main.o,main,plx \
211
+ ; RUN: -r=%t/main.o,_ZN2B03barEj,plx \
212
+ ; RUN: -r=%t/main.o,_ZN1B3barEj,plx \
213
+ ; RUN: -r=%t/main.o,_ZTV1B,plx \
214
+ ; RUN: -r=%t/main.o,_ZTVN10__cxxabiv120__si_class_type_infoE,plx \
215
+ ; RUN: -r=%t/main.o,_ZTS1B,plx \
216
+ ; RUN: -r=%t/main.o,_ZTVN10__cxxabiv117__class_type_infoE,plx \
217
+ ; RUN: -r=%t/main.o,_ZTS2B0,plx \
218
+ ; RUN: -r=%t/main.o,_ZTI2B0,plx \
219
+ ; RUN: -r=%t/main.o,_ZTI1B,plx \
220
+ ; RUN: -r=%t/main.o,_ZTV2B0,plx \
221
+ ; RUN: -thinlto-threads=1 \
222
+ ; RUN: -memprof-verify-ccg -memprof-verify-nodes -stats \
223
+ ; RUN: -pass-remarks=. -save-temps \
224
+ ; RUN: -o %t.out 2>&1 | FileCheck %s --check-prefix=STATS \
225
+ ; RUN: --check-prefix=STATS-BE-NOIMPORT --check-prefix=REMARKS-MAIN \
226
+ ; RUN: --check-prefix=REMARKS-FOO
227
+
228
+ ; RUN: llvm-dis %t.out.2.4.opt.bc -o - | FileCheck %s --check-prefix=IR --check-prefix=IR-NOIMPORT
229
+
230
+ ;; Run it gain but with -memprof-require-definition-for-promotion, and confirm
231
+ ;; that no promotions occur.
232
+ ; RUN: llvm-lto2 run %t/main.o %t/foo.o -enable-memprof-context-disambiguation \
233
+ ; RUN: -import-instr-limit=0 \
234
+ ; RUN: -memprof-require-definition-for-promotion \
235
+ ; RUN: -enable-memprof-indirect-call-support=true \
236
+ ; RUN: -supports-hot-cold-new \
237
+ ; RUN: -r=%t/foo.o,_Z3fooR2B0j,plx \
238
+ ; RUN: -r=%t/foo.o,_ZN2B03barEj.abc,plx \
239
+ ; RUN: -r=%t/foo.o,_Z3xyzR2B0j, \
240
+ ; RUN: -r=%t/foo.o,_ZN2B03barEj, \
241
+ ; RUN: -r=%t/foo.o,_ZN1B3barEj, \
242
+ ; RUN: -r=%t/main.o,_Z3fooR2B0j, \
243
+ ; RUN: -r=%t/main.o,_Znwm, \
244
+ ; RUN: -r=%t/main.o,_ZdlPvm, \
245
+ ; RUN: -r=%t/main.o,_Z8externalPi, \
246
+ ; RUN: -r=%t/main.o,main,plx \
247
+ ; RUN: -r=%t/main.o,_ZN2B03barEj,plx \
248
+ ; RUN: -r=%t/main.o,_ZN1B3barEj,plx \
249
+ ; RUN: -r=%t/main.o,_ZTV1B,plx \
250
+ ; RUN: -r=%t/main.o,_ZTVN10__cxxabiv120__si_class_type_infoE,plx \
251
+ ; RUN: -r=%t/main.o,_ZTS1B,plx \
252
+ ; RUN: -r=%t/main.o,_ZTVN10__cxxabiv117__class_type_infoE,plx \
253
+ ; RUN: -r=%t/main.o,_ZTS2B0,plx \
254
+ ; RUN: -r=%t/main.o,_ZTI2B0,plx \
255
+ ; RUN: -r=%t/main.o,_ZTI1B,plx \
256
+ ; RUN: -r=%t/main.o,_ZTV2B0,plx \
257
+ ; RUN: -thinlto-threads=1 \
258
+ ; RUN: -memprof-verify-ccg -memprof-verify-nodes \
259
+ ; RUN: -pass-remarks=. \
260
+ ; RUN: -o %t.out 2>&1 | FileCheck %s --implicit-check-not Promote
261
+
187
262
; REMARKS-MAIN: call in clone main assigned to call function clone _Z3fooR2B0j.memprof.1
188
263
; REMARKS-MAIN: call in clone main assigned to call function clone _Z3fooR2B0j.memprof.1
189
264
; REMARKS-MAIN: created clone _ZN2B03barEj.memprof.1
208
283
; REMARKS-FOO: call in clone _Z3fooR2B0j promoted and assigned to call function clone _ZN2B03barEj
209
284
; REMARKS-FOO: Promote indirect call to _ZN2B03barEj with count 2 out of 2
210
285
; REMARKS-FOO: call in clone _Z3fooR2B0j.memprof.1 promoted and assigned to call function clone _ZN2B03barEj.memprof.1
211
- ; REMARKS-FOO: created clone _ZN2B03barEj.memprof.1
212
- ; REMARKS-FOO: call in clone _ZN2B03barEj marked with memprof allocation attribute notcold
213
- ; REMARKS-FOO: call in clone _ZN2B03barEj.memprof.1 marked with memprof allocation attribute cold
214
- ; REMARKS-FOO: created clone _ZN1B3barEj.memprof.1
215
- ; REMARKS-FOO: call in clone _ZN1B3barEj marked with memprof allocation attribute notcold
216
- ; REMARKS-FOO: call in clone _ZN1B3barEj.memprof.1 marked with memprof allocation attribute cold
286
+ ; REMARKS-FOO-IMPORT : created clone _ZN2B03barEj.memprof.1
287
+ ; REMARKS-FOO-IMPORT : call in clone _ZN2B03barEj marked with memprof allocation attribute notcold
288
+ ; REMARKS-FOO-IMPORT : call in clone _ZN2B03barEj.memprof.1 marked with memprof allocation attribute cold
289
+ ; REMARKS-FOO-IMPORT : created clone _ZN1B3barEj.memprof.1
290
+ ; REMARKS-FOO-IMPORT : call in clone _ZN1B3barEj marked with memprof allocation attribute notcold
291
+ ; REMARKS-FOO-IMPORT : call in clone _ZN1B3barEj.memprof.1 marked with memprof allocation attribute cold
217
292
218
293
; STATS: 4 memprof-context-disambiguation - Number of cold static allocations (possibly cloned) during whole program analysis
219
294
; STATS-BE: 8 memprof-context-disambiguation - Number of cold static allocations (possibly cloned) during ThinLTO backend
295
+ ; STATS-BE-NOIMPORT: 4 memprof-context-disambiguation - Number of cold static allocations (possibly cloned) during ThinLTO backend
220
296
; STATS: 4 memprof-context-disambiguation - Number of not cold static allocations (possibly cloned) during whole program analysis
221
297
; STATS-BE: 8 memprof-context-disambiguation - Number of not cold static allocations (possibly cloned) during ThinLTO backend
298
+ ; STATS-BE-NOIMPORT: 4 memprof-context-disambiguation - Number of not cold static allocations (possibly cloned) during ThinLTO backend
222
299
; STATS: 3 memprof-context-disambiguation - Number of function clones created during whole program analysis
223
300
; STATS-BE: 5 memprof-context-disambiguation - Number of function clones created during ThinLTO backend
301
+ ; STATS-BE-NOIMPORT: 3 memprof-context-disambiguation - Number of function clones created during ThinLTO backend
224
302
303
+ ; IR-NOIMPORT: foo
225
304
; IR: define {{.*}} @_Z3fooR2B0j(
226
- ; IR: %1 = icmp eq ptr %0, @_ZN1B3barEj
227
- ; IR: br i1 %1 , label %if.true.direct_targ, label %if.false.orig_indirect
305
+ ; IR: %[[R1:[0-9]+]] = icmp eq ptr %0, @_ZN1B3barEj
306
+ ; IR: br i1 %[[R1]] , label %if.true.direct_targ, label %if.false.orig_indirect
228
307
; IR: if.true.direct_targ:
229
- ; IR: call {{.*}} @_Znwm(i64 noundef 4) #[[NOTCOLD:[0-9]+]]
308
+ ; IR-IMPORT: call {{.*}} @_Znwm(i64 noundef 4) #[[NOTCOLD:[0-9]+]]
309
+ ; IR-NOIMPORT: call {{.*}} @_ZN1B3barEj(
230
310
; IR: if.false.orig_indirect:
231
- ; IR: %2 = icmp eq ptr %0, @_ZN2B03barEj
232
- ; IR: br i1 %2 , label %if.true.direct_targ1, label %if.false.orig_indirect2
311
+ ; IR: %[[R2:[0-9]+]] = icmp eq ptr %0, @_ZN2B03barEj
312
+ ; IR: br i1 %[[R2]] , label %if.true.direct_targ1, label %if.false.orig_indirect2
233
313
; IR: if.true.direct_targ1:
234
- ; IR: call {{.*}} @_Znwm(i64 noundef 4) #[[NOTCOLD]]
314
+ ; IR-IMPORT: call {{.*}} @_Znwm(i64 noundef 4) #[[NOTCOLD]]
315
+ ; IR-NOIMPORT: call {{.*}} @_ZN2B03barEj(
235
316
; IR: if.false.orig_indirect2:
236
317
; IR: call {{.*}} %0
237
318
238
319
; IR: define {{.*}} @_Z3fooR2B0j.memprof.1(
239
320
;; We should still compare against the original versions of bar since that is
240
321
;; what is in the vtable. However, we should have called the cloned versions
241
322
;; that perform cold allocations, which were subsequently inlined.
242
- ; IR: %1 = icmp eq ptr %0, @_ZN1B3barEj
243
- ; IR: br i1 %1 , label %if.true.direct_targ, label %if.false.orig_indirect
323
+ ; IR: %[[R3:[0-9]+]] = icmp eq ptr %0, @_ZN1B3barEj
324
+ ; IR: br i1 %[[R3]] , label %if.true.direct_targ, label %if.false.orig_indirect
244
325
; IR: if.true.direct_targ:
245
- ; IR: call {{.*}} @_Znwm(i64 noundef 4) #[[COLD:[0-9]+]]
326
+ ; IR-IMPORT: call {{.*}} @_Znwm(i64 noundef 4) #[[COLD:[0-9]+]]
327
+ ; IR-NOIMPORT: call {{.*}} @_ZN1B3barEj.memprof.1(
246
328
; IR: if.false.orig_indirect:
247
- ; IR: %2 = icmp eq ptr %0, @_ZN2B03barEj
248
- ; IR: br i1 %2 , label %if.true.direct_targ1, label %if.false.orig_indirect2
329
+ ; IR: %[[R4:[0-9]+]] = icmp eq ptr %0, @_ZN2B03barEj
330
+ ; IR: br i1 %[[R4]] , label %if.true.direct_targ1, label %if.false.orig_indirect2
249
331
; IR: if.true.direct_targ1:
250
- ; IR: call {{.*}} @_Znwm(i64 noundef 4) #[[COLD]]
332
+ ; IR-IMPORT: call {{.*}} @_Znwm(i64 noundef 4) #[[COLD]]
333
+ ; IR-NOIMPORT: call {{.*}} @_ZN2B03barEj.memprof.1(
251
334
; IR: if.false.orig_indirect2:
252
335
; IR: call {{.*}} %0
253
336
254
- ; IR: attributes #[[NOTCOLD]] = {{.*}} "memprof"="notcold"
255
- ; IR: attributes #[[COLD]] = {{.*}} "memprof"="cold"
337
+ ; IR-IMPORT : attributes #[[NOTCOLD]] = {{.*}} "memprof"="notcold"
338
+ ; IR-IMPORT : attributes #[[COLD]] = {{.*}} "memprof"="cold"
256
339
257
340
; STATS-BE-DISTRIB: 4 memprof-context-disambiguation - Number of cold static allocations (possibly cloned) during ThinLTO backend
258
341
; STATS-BE-DISTRIB: 4 memprof-context-disambiguation - Number of not cold static allocations (possibly cloned) during ThinLTO backend
@@ -272,6 +355,9 @@ define i32 @_ZN2B03barEj.abc(ptr %this, i32 %s) {
272
355
ret i32 0
273
356
}
274
357
358
+ declare i32 @_ZN2B03barEj (ptr %this , i32 %s )
359
+ declare i32 @_ZN1B3barEj (ptr %this , i32 %s )
360
+
275
361
define i32 @_Z3fooR2B0j (ptr %b ) {
276
362
entry:
277
363
%0 = load ptr , ptr %b , align 8
0 commit comments