1 ; RUN: opt -passes=annotation-remarks -o /dev/null -S -pass-remarks-output=%t.opt.yaml %s -pass-remarks-missed=annotation-remarks 2>&1 | FileCheck %s
2 ; RUN: cat %t.opt.yaml | FileCheck -check-prefix=YAML %s
4 ; Emit remarks for memcpy, memmove, memset, bzero.
5 define void @known_call(ptr %src, ptr %dst, i64 %size) {
6 ; CHECK: Call to memset inserted by -ftrivial-auto-var-init.
7 ; YAML-LABEL: --- !Missed
8 ; YAML-NEXT: Pass: annotation-remarks
9 ; YAML-NEXT: Name: AutoInitIntrinsic
10 ; YAML-NEXT: DebugLoc:
11 ; YAML-NEXT: Function: known_call
13 ; YAML-NEXT: - String: 'Call to '
14 ; YAML-NEXT: - Callee: memset
15 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
16 ; YAML-NEXT: - String: ' Inlined: '
17 ; YAML-NEXT: - StoreInlined: 'false'
18 ; YAML-NEXT: - String: .
19 ; YAML-NEXT: - String: ' Volatile: '
20 ; YAML-NEXT: - StoreVolatile: 'false'
21 ; YAML-NEXT: - String: .
22 ; YAML-NEXT: - String: ' Atomic: '
23 ; YAML-NEXT: - StoreAtomic: 'false'
24 ; YAML-NEXT: - String: .
26 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
27 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init.
28 ; YAML-LABEL: --- !Missed
29 ; YAML-NEXT: Pass: annotation-remarks
30 ; YAML-NEXT: Name: AutoInitIntrinsic
31 ; YAML-NEXT: DebugLoc:
32 ; YAML-NEXT: Function: known_call
34 ; YAML-NEXT: - String: 'Call to '
35 ; YAML-NEXT: - Callee: memcpy
36 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
37 ; YAML-NEXT: - String: ' Inlined: '
38 ; YAML-NEXT: - StoreInlined: 'false'
39 ; YAML-NEXT: - String: .
40 ; YAML-NEXT: - String: ' Volatile: '
41 ; YAML-NEXT: - StoreVolatile: 'false'
42 ; YAML-NEXT: - String: .
43 ; YAML-NEXT: - String: ' Atomic: '
44 ; YAML-NEXT: - StoreAtomic: 'false'
45 ; YAML-NEXT: - String: .
47 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
48 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init.
49 ; YAML-LABEL: --- !Missed
50 ; YAML-NEXT: Pass: annotation-remarks
51 ; YAML-NEXT: Name: AutoInitIntrinsic
52 ; YAML-NEXT: DebugLoc:
53 ; YAML-NEXT: Function: known_call
55 ; YAML-NEXT: - String: 'Call to '
56 ; YAML-NEXT: - Callee: memmove
57 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
58 ; YAML-NEXT: - String: ' Inlined: '
59 ; YAML-NEXT: - StoreInlined: 'false'
60 ; YAML-NEXT: - String: .
61 ; YAML-NEXT: - String: ' Volatile: '
62 ; YAML-NEXT: - StoreVolatile: 'false'
63 ; YAML-NEXT: - String: .
64 ; YAML-NEXT: - String: ' Atomic: '
65 ; YAML-NEXT: - StoreAtomic: 'false'
66 ; YAML-NEXT: - String: .
68 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
69 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init.
70 ; YAML-LABEL: --- !Missed
71 ; YAML-NEXT: Pass: annotation-remarks
72 ; YAML-NEXT: Name: AutoInitCall
73 ; YAML-NEXT: DebugLoc:
74 ; YAML-NEXT: Function: known_call
76 ; YAML-NEXT: - String: 'Call to '
77 ; YAML-NEXT: - Callee: bzero
78 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
80 call void @bzero(ptr %dst, i64 %size), !annotation !0, !dbg !DILocation(scope: !4)
81 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init.
82 ; YAML-LABEL: --- !Missed
83 ; YAML-NEXT: Pass: annotation-remarks
84 ; YAML-NEXT: Name: AutoInitCall
85 ; YAML-NEXT: DebugLoc:
86 ; YAML-NEXT: Function: known_call
88 ; YAML-NEXT: - String: 'Call to '
89 ; YAML-NEXT: - Callee: memset
90 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
91 ; YAML-NEXT: - String: ' Memory operation size: '
92 ; YAML-NEXT: - StoreSize: '32'
93 ; YAML-NEXT: - String: ' bytes.'
95 call ptr @memset(ptr %dst, i32 0, i64 32), !annotation !0, !dbg !DILocation(scope: !4)
99 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes.
100 define void @known_call_with_size(ptr %src, ptr %dst) {
101 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.
102 ; YAML-LABEL: --- !Missed
103 ; YAML-NEXT: Pass: annotation-remarks
104 ; YAML-NEXT: Name: AutoInitIntrinsic
105 ; YAML-NEXT: DebugLoc:
106 ; YAML-NEXT: Function: known_call_with_size
108 ; YAML-NEXT: - String: 'Call to '
109 ; YAML-NEXT: - Callee: memset
110 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
111 ; YAML-NEXT: - String: ' Memory operation size: '
112 ; YAML-NEXT: - StoreSize: '32'
113 ; YAML-NEXT: - String: ' bytes.'
114 ; YAML-NEXT: - String: ' Inlined: '
115 ; YAML-NEXT: - StoreInlined: 'false'
116 ; YAML-NEXT: - String: .
117 ; YAML-NEXT: - String: ' Volatile: '
118 ; YAML-NEXT: - StoreVolatile: 'false'
119 ; YAML-NEXT: - String: .
120 ; YAML-NEXT: - String: ' Atomic: '
121 ; YAML-NEXT: - StoreAtomic: 'false'
122 ; YAML-NEXT: - String: .
124 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
125 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.
126 ; YAML-LABEL: --- !Missed
127 ; YAML-NEXT: Pass: annotation-remarks
128 ; YAML-NEXT: Name: AutoInitIntrinsic
129 ; YAML-NEXT: DebugLoc:
130 ; YAML-NEXT: Function: known_call_with_size
132 ; YAML-NEXT: - String: 'Call to '
133 ; YAML-NEXT: - Callee: memcpy
134 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
135 ; YAML-NEXT: - String: ' Memory operation size: '
136 ; YAML-NEXT: - StoreSize: '32'
137 ; YAML-NEXT: - String: ' bytes.'
138 ; YAML-NEXT: - String: ' Inlined: '
139 ; YAML-NEXT: - StoreInlined: 'false'
140 ; YAML-NEXT: - String: .
141 ; YAML-NEXT: - String: ' Volatile: '
142 ; YAML-NEXT: - StoreVolatile: 'false'
143 ; YAML-NEXT: - String: .
144 ; YAML-NEXT: - String: ' Atomic: '
145 ; YAML-NEXT: - StoreAtomic: 'false'
146 ; YAML-NEXT: - String: .
148 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
149 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.
150 ; YAML-LABEL: --- !Missed
151 ; YAML-NEXT: Pass: annotation-remarks
152 ; YAML-NEXT: Name: AutoInitIntrinsic
153 ; YAML-NEXT: DebugLoc:
154 ; YAML-NEXT: Function: known_call_with_size
156 ; YAML-NEXT: - String: 'Call to '
157 ; YAML-NEXT: - Callee: memmove
158 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
159 ; YAML-NEXT: - String: ' Memory operation size: '
160 ; YAML-NEXT: - StoreSize: '32'
161 ; YAML-NEXT: - String: ' bytes.'
162 ; YAML-NEXT: - String: ' Inlined: '
163 ; YAML-NEXT: - StoreInlined: 'false'
164 ; YAML-NEXT: - String: .
165 ; YAML-NEXT: - String: ' Volatile: '
166 ; YAML-NEXT: - StoreVolatile: 'false'
167 ; YAML-NEXT: - String: .
168 ; YAML-NEXT: - String: ' Atomic: '
169 ; YAML-NEXT: - StoreAtomic: 'false'
170 ; YAML-NEXT: - String: .
172 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 32, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
173 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 32 bytes.
174 ; YAML-LABEL: --- !Missed
175 ; YAML-NEXT: Pass: annotation-remarks
176 ; YAML-NEXT: Name: AutoInitCall
177 ; YAML-NEXT: DebugLoc:
178 ; YAML-NEXT: Function: known_call_with_size
180 ; YAML-NEXT: - String: 'Call to '
181 ; YAML-NEXT: - Callee: bzero
182 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
183 ; YAML-NEXT: - String: ' Memory operation size: '
184 ; YAML-NEXT: - StoreSize: '32'
185 ; YAML-NEXT: - String: ' bytes.'
187 call void @bzero(ptr %dst, i64 32), !annotation !0, !dbg !DILocation(scope: !4)
192 ; Emit remarks for memcpy, memmove, memset marked volatile.
193 define void @known_call_volatile(ptr %src, ptr %dst, i64 %size) {
194 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Volatile: true.
195 ; YAML-LABEL: --- !Missed
196 ; YAML-NEXT: Pass: annotation-remarks
197 ; YAML-NEXT: Name: AutoInitIntrinsic
198 ; YAML-NEXT: DebugLoc:
199 ; YAML-NEXT: Function: known_call_volatile
201 ; YAML-NEXT: - String: 'Call to '
202 ; YAML-NEXT: - Callee: memset
203 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
204 ; YAML-NEXT: - String: ' Volatile: '
205 ; YAML-NEXT: - StoreVolatile: 'true'
206 ; YAML-NEXT: - String: .
207 ; YAML-NEXT: - String: ' Inlined: '
208 ; YAML-NEXT: - StoreInlined: 'false'
209 ; YAML-NEXT: - String: .
210 ; YAML-NEXT: - String: ' Atomic: '
211 ; YAML-NEXT: - StoreAtomic: 'false'
212 ; YAML-NEXT: - String: .
214 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)
215 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Volatile: true.
216 ; YAML-LABEL: --- !Missed
217 ; YAML-NEXT: Pass: annotation-remarks
218 ; YAML-NEXT: Name: AutoInitIntrinsic
219 ; YAML-NEXT: DebugLoc:
220 ; YAML-NEXT: Function: known_call_volatile
222 ; YAML-NEXT: - String: 'Call to '
223 ; YAML-NEXT: - Callee: memcpy
224 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
225 ; YAML-NEXT: - String: ' Volatile: '
226 ; YAML-NEXT: - StoreVolatile: 'true'
227 ; YAML-NEXT: - String: .
228 ; YAML-NEXT: - String: ' Inlined: '
229 ; YAML-NEXT: - StoreInlined: 'false'
230 ; YAML-NEXT: - String: .
231 ; YAML-NEXT: - String: ' Atomic: '
232 ; YAML-NEXT: - StoreAtomic: 'false'
233 ; YAML-NEXT: - String: .
235 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)
236 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Volatile: true.
237 ; YAML-LABEL: --- !Missed
238 ; YAML-NEXT: Pass: annotation-remarks
239 ; YAML-NEXT: Name: AutoInitIntrinsic
240 ; YAML-NEXT: DebugLoc:
241 ; YAML-NEXT: Function: known_call_volatile
243 ; YAML-NEXT: - String: 'Call to '
244 ; YAML-NEXT: - Callee: memmove
245 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
246 ; YAML-NEXT: - String: ' Volatile: '
247 ; YAML-NEXT: - StoreVolatile: 'true'
248 ; YAML-NEXT: - String: .
249 ; YAML-NEXT: - String: ' Inlined: '
250 ; YAML-NEXT: - StoreInlined: 'false'
251 ; YAML-NEXT: - String: .
252 ; YAML-NEXT: - String: ' Atomic: '
253 ; YAML-NEXT: - StoreAtomic: 'false'
254 ; YAML-NEXT: - String: .
256 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 %size, i1 true), !annotation !0, !dbg !DILocation(scope: !4)
260 ; Emit remarks for memcpy, memmove, memset marked atomic.
261 define void @known_call_atomic(ptr %src, ptr %dst, i64 %size) {
262 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Atomic: true.
263 ; YAML-LABEL: --- !Missed
264 ; YAML-NEXT: Pass: annotation-remarks
265 ; YAML-NEXT: Name: AutoInitIntrinsic
266 ; YAML-NEXT: DebugLoc:
267 ; YAML-NEXT: Function: known_call_atomic
269 ; YAML-NEXT: - String: 'Call to '
270 ; YAML-NEXT: - Callee: memset
271 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
272 ; YAML-NEXT: - String: ' Atomic: '
273 ; YAML-NEXT: - StoreAtomic: 'true'
274 ; YAML-NEXT: - String: .
275 ; YAML-NEXT: - String: ' Inlined: '
276 ; YAML-NEXT: - StoreInlined: 'false'
277 ; YAML-NEXT: - String: .
278 ; YAML-NEXT: - String: ' Volatile: '
279 ; YAML-NEXT: - StoreVolatile: 'false'
280 ; YAML-NEXT: - String: .
282 call void @llvm.memset.element.unordered.atomic.p0.i64(ptr align 1 %dst, i8 0, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)
283 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Atomic: true.
284 ; YAML-LABEL: --- !Missed
285 ; YAML-NEXT: Pass: annotation-remarks
286 ; YAML-NEXT: Name: AutoInitIntrinsic
287 ; YAML-NEXT: DebugLoc:
288 ; YAML-NEXT: Function: known_call_atomic
290 ; YAML-NEXT: - String: 'Call to '
291 ; YAML-NEXT: - Callee: memcpy
292 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
293 ; YAML-NEXT: - String: ' Atomic: '
294 ; YAML-NEXT: - StoreAtomic: 'true'
295 ; YAML-NEXT: - String: .
296 ; YAML-NEXT: - String: ' Inlined: '
297 ; YAML-NEXT: - StoreInlined: 'false'
298 ; YAML-NEXT: - String: .
299 ; YAML-NEXT: - String: ' Volatile: '
300 ; YAML-NEXT: - StoreVolatile: 'false'
301 ; YAML-NEXT: - String: .
303 call void @llvm.memcpy.element.unordered.atomic.p0.p0.i64(ptr align 1 %dst, ptr align 1 %src, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)
304 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Atomic: true.
305 ; YAML-LABEL: --- !Missed
306 ; YAML-NEXT: Pass: annotation-remarks
307 ; YAML-NEXT: Name: AutoInitIntrinsic
308 ; YAML-NEXT: DebugLoc:
309 ; YAML-NEXT: Function: known_call_atomic
311 ; YAML-NEXT: - String: 'Call to '
312 ; YAML-NEXT: - Callee: memmove
313 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
314 ; YAML-NEXT: - String: ' Atomic: '
315 ; YAML-NEXT: - StoreAtomic: 'true'
316 ; YAML-NEXT: - String: .
317 ; YAML-NEXT: - String: ' Inlined: '
318 ; YAML-NEXT: - StoreInlined: 'false'
319 ; YAML-NEXT: - String: .
320 ; YAML-NEXT: - String: ' Volatile: '
321 ; YAML-NEXT: - StoreVolatile: 'false'
322 ; YAML-NEXT: - String: .
324 call void @llvm.memmove.element.unordered.atomic.p0.p0.i64(ptr align 1 %dst, ptr align 1 %src, i64 %size, i32 1), !annotation !0, !dbg !DILocation(scope: !4)
328 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
330 define void @known_call_with_size_alloca(ptr %src) {
331 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
332 ; CHECK-NEXT: Variables: dst (1 bytes).
333 ; YAML-LABEL: --- !Missed
334 ; YAML-NEXT: Pass: annotation-remarks
335 ; YAML-NEXT: Name: AutoInitIntrinsic
336 ; YAML-NEXT: DebugLoc:
337 ; YAML-NEXT: Function: known_call_with_size_alloca
339 ; YAML-NEXT: - String: 'Call to '
340 ; YAML-NEXT: - Callee: memset
341 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
342 ; YAML-NEXT: - String: ' Memory operation size: '
343 ; YAML-NEXT: - StoreSize: '1'
344 ; YAML-NEXT: - String: ' bytes.'
345 ; YAML-NEXT: - String: "\n Written Variables: "
346 ; YAML-NEXT: - WVarName: dst
347 ; YAML-NEXT: - String: ' ('
348 ; YAML-NEXT: - WVarSize: '1'
349 ; YAML-NEXT: - String: ' bytes)'
350 ; YAML-NEXT: - String: .
351 ; YAML-NEXT: - String: ' Inlined: '
352 ; YAML-NEXT: - StoreInlined: 'false'
353 ; YAML-NEXT: - String: .
354 ; YAML-NEXT: - String: ' Volatile: '
355 ; YAML-NEXT: - StoreVolatile: 'false'
356 ; YAML-NEXT: - String: .
357 ; YAML-NEXT: - String: ' Atomic: '
358 ; YAML-NEXT: - StoreAtomic: 'false'
359 ; YAML-NEXT: - String: .
362 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
363 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
364 ; CHECK-NEXT: Variables: dst (1 bytes).
365 ; YAML-LABEL: --- !Missed
366 ; YAML-NEXT: Pass: annotation-remarks
367 ; YAML-NEXT: Name: AutoInitIntrinsic
368 ; YAML-NEXT: DebugLoc:
369 ; YAML-NEXT: Function: known_call_with_size_alloca
371 ; YAML-NEXT: - String: 'Call to '
372 ; YAML-NEXT: - Callee: memcpy
373 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
374 ; YAML-NEXT: - String: ' Memory operation size: '
375 ; YAML-NEXT: - StoreSize: '1'
376 ; YAML-NEXT: - String: ' bytes.'
377 ; YAML-NEXT: - String: "\n Written Variables: "
378 ; YAML-NEXT: - WVarName: dst
379 ; YAML-NEXT: - String: ' ('
380 ; YAML-NEXT: - WVarSize: '1'
381 ; YAML-NEXT: - String: ' bytes)'
382 ; YAML-NEXT: - String: .
383 ; YAML-NEXT: - String: ' Inlined: '
384 ; YAML-NEXT: - StoreInlined: 'false'
385 ; YAML-NEXT: - String: .
386 ; YAML-NEXT: - String: ' Volatile: '
387 ; YAML-NEXT: - StoreVolatile: 'false'
388 ; YAML-NEXT: - String: .
389 ; YAML-NEXT: - String: ' Atomic: '
390 ; YAML-NEXT: - StoreAtomic: 'false'
391 ; YAML-NEXT: - String: .
393 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
394 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
395 ; CHECK-NEXT: Variables: dst (1 bytes).
396 ; YAML-LABEL: --- !Missed
397 ; YAML-NEXT: Pass: annotation-remarks
398 ; YAML-NEXT: Name: AutoInitIntrinsic
399 ; YAML-NEXT: DebugLoc:
400 ; YAML-NEXT: Function: known_call_with_size_alloca
402 ; YAML-NEXT: - String: 'Call to '
403 ; YAML-NEXT: - Callee: memmove
404 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
405 ; YAML-NEXT: - String: ' Memory operation size: '
406 ; YAML-NEXT: - StoreSize: '1'
407 ; YAML-NEXT: - String: ' bytes.'
408 ; YAML-NEXT: - String: "\n Written Variables: "
409 ; YAML-NEXT: - WVarName: dst
410 ; YAML-NEXT: - String: ' ('
411 ; YAML-NEXT: - WVarSize: '1'
412 ; YAML-NEXT: - String: ' bytes)'
413 ; YAML-NEXT: - String: .
414 ; YAML-NEXT: - String: ' Inlined: '
415 ; YAML-NEXT: - StoreInlined: 'false'
416 ; YAML-NEXT: - String: .
417 ; YAML-NEXT: - String: ' Volatile: '
418 ; YAML-NEXT: - StoreVolatile: 'false'
419 ; YAML-NEXT: - String: .
420 ; YAML-NEXT: - String: ' Atomic: '
421 ; YAML-NEXT: - StoreAtomic: 'false'
422 ; YAML-NEXT: - String: .
424 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
425 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
426 ; CHECK-NEXT: Variables: dst (1 bytes).
427 ; YAML-LABEL: --- !Missed
428 ; YAML-NEXT: Pass: annotation-remarks
429 ; YAML-NEXT: Name: AutoInitCall
430 ; YAML-NEXT: DebugLoc:
431 ; YAML-NEXT: Function: known_call_with_size_alloca
433 ; YAML-NEXT: - String: 'Call to '
434 ; YAML-NEXT: - Callee: bzero
435 ; YAML-NEXT: - String: ' inserted by -ftrivial-auto-var-init.'
436 ; YAML-NEXT: - String: ' Memory operation size: '
437 ; YAML-NEXT: - StoreSize: '1'
438 ; YAML-NEXT: - String: ' bytes.'
439 ; YAML-NEXT: - String: "\n Written Variables: "
440 ; YAML-NEXT: - WVarName: dst
441 ; YAML-NEXT: - String: ' ('
442 ; YAML-NEXT: - WVarSize: '1'
443 ; YAML-NEXT: - String: ' bytes)'
444 ; YAML-NEXT: - String: .
446 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
451 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
452 ; an alloca through a GEP.
453 define void @known_call_with_size_alloca_gep(ptr %src) {
454 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
455 ; CHECK-NEXT: Variables: dst (1 bytes).
457 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
458 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
459 ; CHECK-NEXT: Variables: dst (1 bytes).
460 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
461 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
462 ; CHECK-NEXT: Variables: dst (1 bytes).
463 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
464 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
465 ; CHECK-NEXT: Variables: dst (1 bytes).
466 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
470 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
471 ; an alloca through a GEP in an array.
472 define void @known_call_with_size_alloca_gep_array(ptr %src) {
473 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
474 ; CHECK-NEXT: Variables: dst (2 bytes).
475 %dst = alloca [2 x i8]
476 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
477 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
478 ; CHECK-NEXT: Variables: dst (2 bytes).
479 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
480 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
481 ; CHECK-NEXT: Variables: dst (2 bytes).
482 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
483 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
484 ; CHECK-NEXT: Variables: dst (2 bytes).
485 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
489 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
490 ; an alloca through a bitcast.
491 define void @known_call_with_size_alloca_bitcast(ptr %src) {
492 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
493 ; CHECK-NEXT: Variables: dst (2 bytes).
494 %dst = alloca [2 x i8]
495 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
496 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
497 ; CHECK-NEXT: Variables: dst (2 bytes).
498 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
499 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
500 ; CHECK-NEXT: Variables: dst (2 bytes).
501 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
502 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
503 ; CHECK-NEXT: Variables: dst (2 bytes).
504 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
508 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to an alloca that has a DILocalVariable attached.
509 define void @known_call_with_size_alloca_di(ptr %src) {
510 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
511 ; CHECK-NEXT: Variables: destination (1 bytes).
513 call void @llvm.dbg.declare(metadata ptr %dst, metadata !6, metadata !DIExpression()), !dbg !DILocation(scope: !4)
514 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
515 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
516 ; CHECK-NEXT: Variables: destination (1 bytes).
517 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
518 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
519 ; CHECK-NEXT: Variables: destination (1 bytes).
520 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
521 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
522 ; CHECK-NEXT: Variables: destination (1 bytes).
523 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
527 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
528 ; an alloca that has more than one DILocalVariable attached.
529 define void @known_call_with_size_alloca_di_multiple(ptr %src) {
530 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
531 ; CHECK-NEXT: Variables: destination (1 bytes).
533 call void @llvm.dbg.declare(metadata ptr %dst, metadata !6, metadata !DIExpression()), !dbg !DILocation(scope: !4)
534 call void @llvm.memset.p0.i64(ptr %dst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
535 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
536 ; CHECK-NEXT: Variables: destination (1 bytes).
537 call void @llvm.memcpy.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
538 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
539 ; CHECK-NEXT: Variables: destination (1 bytes).
540 call void @llvm.memmove.p0.p0.i64(ptr %dst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
541 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
542 ; CHECK-NEXT: Variables: destination (1 bytes).
543 call void @bzero(ptr %dst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
547 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
548 ; a PHI node that can be two different allocas.
549 define void @known_call_with_size_alloca_phi(ptr %src) {
550 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
551 ; CHECK-NEXT: Variables: dst2 (1 bytes), dst (1 bytes).
555 %cmp = icmp eq i32 undef, undef
556 br i1 %cmp, label %l0, label %l1
562 %phidst = phi ptr [ %dst, %l0 ], [ %dst2, %l1 ]
563 call void @llvm.memset.p0.i64(ptr %phidst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
564 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
565 ; CHECK-NEXT: Variables: dst2 (1 bytes), dst (1 bytes).
566 call void @llvm.memcpy.p0.p0.i64(ptr %phidst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
567 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
568 ; CHECK-NEXT: Variables: dst2 (1 bytes), dst (1 bytes).
569 call void @llvm.memmove.p0.p0.i64(ptr %phidst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
570 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
571 ; CHECK-NEXT: Variables: dst2 (1 bytes), dst (1 bytes).
572 call void @bzero(ptr %phidst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
576 ; Emit remarks for memcpy, memmove, memset, bzero with known constant sizes to
577 ; a PHI node that can be two different allocas, where one of it has multiple
579 define void @known_call_with_size_alloca_phi_di_multiple(ptr %src) {
580 ; CHECK-NEXT: Call to memset inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
581 ; CHECK-NEXT: Variables: dst2 (1 bytes), destination2 (1 bytes), destination (1 bytes).
585 call void @llvm.dbg.declare(metadata ptr %dst, metadata !6, metadata !DIExpression()), !dbg !DILocation(scope: !4)
586 call void @llvm.dbg.declare(metadata ptr %dst, metadata !7, metadata !DIExpression()), !dbg !DILocation(scope: !4)
587 %cmp = icmp eq i32 undef, undef
588 br i1 %cmp, label %l0, label %l1
594 %phidst = phi ptr [ %dst, %l0 ], [ %dst2, %l1 ]
595 call void @llvm.memset.p0.i64(ptr %phidst, i8 0, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
596 ; CHECK-NEXT: Call to memcpy inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
597 ; CHECK-NEXT: Variables: dst2 (1 bytes), destination2 (1 bytes), destination (1 bytes).
598 call void @llvm.memcpy.p0.p0.i64(ptr %phidst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
599 ; CHECK-NEXT: Call to memmove inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
600 ; CHECK-NEXT: Variables: dst2 (1 bytes), destination2 (1 bytes), destination (1 bytes).
601 call void @llvm.memmove.p0.p0.i64(ptr %phidst, ptr %src, i64 1, i1 false), !annotation !0, !dbg !DILocation(scope: !4)
602 ; CHECK-NEXT: Call to bzero inserted by -ftrivial-auto-var-init. Memory operation size: 1 bytes.
603 ; CHECK-NEXT: Variables: dst2 (1 bytes), destination2 (1 bytes), destination (1 bytes).
604 call void @bzero(ptr %phidst, i64 1), !annotation !0, !dbg !DILocation(scope: !4)
608 declare void @llvm.dbg.declare(metadata, metadata, metadata) nounwind readnone speculatable willreturn
609 declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) argmemonly nounwind willreturn writeonly
610 declare void @llvm.memmove.p0.p0.i64(ptr nocapture, ptr nocapture readonly, i64, i1 immarg) argmemonly nounwind willreturn
611 declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) argmemonly nounwind willreturn
613 declare void @llvm.memset.element.unordered.atomic.p0.i64(ptr nocapture writeonly, i8, i64, i32 immarg) argmemonly nounwind willreturn writeonly
614 declare void @llvm.memcpy.element.unordered.atomic.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i32 immarg) argmemonly nounwind willreturn
615 declare void @llvm.memmove.element.unordered.atomic.p0.p0.i64(ptr nocapture writeonly, ptr nocapture readonly, i64, i32 immarg) argmemonly nounwind willreturn
617 declare void @bzero(ptr nocapture, i64) nofree nounwind
618 declare ptr @memset(ptr, i32, i64)
620 !llvm.module.flags = !{!1}
621 !0 = !{ !"auto-init" }
622 !1 = !{i32 2, !"Debug Info Version", i32 3}
623 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3)
624 !3 = !DIFile(filename: "file", directory: "")
625 !4 = distinct !DISubprogram(name: "function", scope: !3, file: !3, unit: !2)
626 !5 = !DIBasicType(name: "byte", size: 8)
627 !6 = !DILocalVariable(name: "destination", scope: !4, file: !3, type: !5)
628 !7 = !DILocalVariable(name: "destination2", scope: !4, file: !3, type: !5)