1 ; RUN: opt -annotation-remarks -pass-remarks-missed='annotation-remarks' -disable-output -pass-remarks-output=%t.opt.yaml %s
2 ; RUN: FileCheck --input-file=%t.opt.yaml %s
3 ; RUN: opt -passes='annotation-remarks' -pass-remarks-missed='annotation-remarks' -disable-output -pass-remarks-output=%t.opt.yaml %s
4 ; RUN: FileCheck --input-file=%t.opt.yaml %s
6 ; Make sure a suitable location is used for the function start when emitting
7 ; the annotation summary remarks.
10 ; CHECK-NEXT: Pass: annotation-remarks
11 ; CHECK-NEXT: Name: AnnotationSummary
12 ; CHECK-NEXT: DebugLoc: { File: test.c, Line: 10, Column: 0 }
13 ; CHECK-NEXT: Function: test1
15 ; CHECK-NEXT: - String: 'Annotated '
16 ; CHECK-NEXT: - count: '4'
17 ; CHECK-NEXT: - String: ' instructions with '
18 ; CHECK-NEXT: - type: _remarks1
20 ; CHECK-NEXT: --- !Analysis
21 ; CHECK-NEXT: Pass: annotation-remarks
22 ; CHECK-NEXT: Name: AnnotationSummary
23 ; CHECK-NEXT: DebugLoc: { File: test.c, Line: 10, Column: 0 }
24 ; CHECK-NEXT: Function: test1
26 ; CHECK-NEXT: - String: 'Annotated '
27 ; CHECK-NEXT: - count: '3'
28 ; CHECK-NEXT: - String: ' instructions with '
29 ; CHECK-NEXT: - type: _remarks2
31 ; CHECK-NEXT: --- !Analysis
32 ; CHECK-NEXT: Pass: annotation-remarks
33 ; CHECK-NEXT: Name: AnnotationSummary
34 ; CHECK-NEXT: DebugLoc: { File: test.c, Line: 20, Column: 0 }
35 ; CHECK-NEXT: Function: test2
37 ; CHECK-NEXT: - String: 'Annotated '
38 ; CHECK-NEXT: - count: '2'
39 ; CHECK-NEXT: - String: ' instructions with '
40 ; CHECK-NEXT: - type: _remarks1
43 define void @test1(float* %a) !dbg !7 {
45 %a.addr = alloca float*, align 8, !dbg !16, !annotation !5
46 store float* null, float** %a.addr, align 8, !annotation !6
47 store float* %a, float** %a.addr, align 8, !annotation !5
48 ret void, !annotation !5
51 define void @test2(float* %a) !dbg !17 {
53 %a.addr = alloca float*, align 8, !annotation !6
54 ret void, !dbg !18, !annotation !6
58 !llvm.module.flags = !{!3, !4}
60 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
61 !1 = !DIFile(filename: "test.c", directory: "/test")
63 !3 = !{i32 2, !"Dwarf Version", i32 4}
64 !4 = !{i32 2, !"Debug Info Version", i32 3}
65 !5 = !{!"_remarks1", !"_remarks2"}
67 !7 = distinct !DISubprogram(name: "test1", scope: !1, file: !1, line: 11, type: !8, scopeLine: 10, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
68 !8 = !DISubroutineType(types: !9)
69 !9 = !{null, !10, !10, !13}
70 !10 = !DIDerivedType(tag: DW_TAG_restrict_type, baseType: !11)
71 !11 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !12, size: 32, align: 32)
72 !12 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float)
73 !13 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
75 !15 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 1, type: !10)
76 !16 = !DILocation(line: 400, column: 3, scope: !7)
77 !17 = distinct !DISubprogram(name: "test2", scope: !1, file: !1, line: 21, type: !8, scopeLine: 20, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !14)
78 !18 = !DILocation(line: 200, column: 3, scope: !17)