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 ; No remarks for this function, no instructions with metadata.
6 ; YAML-NOT: Function: none
10 ; Emit a remark that reports an instruction we can't analyze.
11 define void @unknown() {
12 ; CHECK: Initialization inserted by -ftrivial-auto-var-init.
13 ; YAML-LABEL: --- !Missed
14 ; YAML-NEXT: Pass: annotation-remarks
15 ; YAML-NEXT: Name: AutoInitUnknownInstruction
16 ; YAML-NEXT: DebugLoc:
17 ; YAML-NEXT: Function: unknown
19 ; YAML-NEXT: - String: Initialization inserted by -ftrivial-auto-var-init.
21 ret void, !annotation !0, !dbg !DILocation(scope: !4)
24 ; Emit a remark that reports an intrinsic call to an unknown intrinsic.
25 define void @unknown_intrinsic(ptr %dst) {
26 ; CHECK-NEXT: Initialization inserted by -ftrivial-auto-var-init.
27 ; YAML-LABEL: --- !Missed
28 ; YAML-NEXT: Pass: annotation-remarks
29 ; YAML-NEXT: Name: AutoInitUnknownInstruction
30 ; YAML-NEXT: DebugLoc:
31 ; YAML-NEXT: Function: unknown_intrinsic
32 call ptr @llvm.returnaddress(i32 0), !annotation !0, !dbg !DILocation(scope: !4)
36 declare ptr @llvm.returnaddress(i32) nounwind readnone
38 !llvm.module.flags = !{!1}
39 !0 = !{ !"auto-init" }
40 !1 = !{i32 2, !"Debug Info Version", i32 3}
41 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3)
42 !3 = !DIFile(filename: "file", directory: "")
43 !4 = distinct !DISubprogram(name: "function", scope: !3, file: !3, unit: !2)
44 !5 = !DIBasicType(name: "byte", size: 8)
45 !6 = !DILocalVariable(name: "destination", scope: !4, file: !3, type: !5)
46 !7 = !DILocalVariable(name: "destination2", scope: !4, file: !3, type: !5)