xref: /llvm-project/llvm/test/Transforms/Util/trivial-auto-var-init-unknown.ll (revision e26017d4c5a5871e75f56140b5d47da483cf8f25)
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
3
4; No remarks for this function, no instructions with metadata.
5define void @none() {
6; YAML-NOT:  Function:        none
7  ret void
8}
9
10; Emit a remark that reports an instruction we can't analyze.
11define 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
18; YAML-NEXT: Args:
19; YAML-NEXT:   - String:          Initialization inserted by -ftrivial-auto-var-init.
20; YAML-NEXT: ...
21  ret void, !annotation !0, !dbg !DILocation(scope: !4)
22}
23
24; Emit a remark that reports an intrinsic call to an unknown intrinsic.
25define 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)
33  ret void
34}
35
36declare ptr @llvm.returnaddress(i32) nounwind readnone
37
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)
47