xref: /llvm-project/llvm/test/Transforms/Util/annotation-remarks.ll (revision 211cf8a384ebb29787367c8fd5858e2a5ed3c10f)
1; RUN: opt -passes='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
4; CHECK:      --- !Analysis
5; CHECK-NEXT: Pass:            annotation-remarks
6; CHECK-NEXT: Name:            AnnotationSummary
7; CHECK-NEXT: Function:        test1
8; CHECK-NEXT: Args:
9; CHECK-NEXT:   - String:          'Annotated '
10; CHECK-NEXT:   - count:           '4'
11; CHECK-NEXT:   - String:          ' instructions with '
12; CHECK-NEXT:   - type:            _remarks1
13; CHECK-NEXT: ...
14; CHECK-NEXT: --- !Analysis
15; CHECK-NEXT: Pass:            annotation-remarks
16; CHECK-NEXT: Name:            AnnotationSummary
17; CHECK-NEXT: Function:        test1
18; CHECK-NEXT: Args:
19; CHECK-NEXT:   - String:          'Annotated '
20; CHECK-NEXT:   - count:           '3'
21; CHECK-NEXT:   - String:          ' instructions with '
22; CHECK-NEXT:   - type:            _remarks2
23; CHECK-NEXT: ...
24; CHECK-NEXT: --- !Analysis
25; CHECK-NEXT: Pass:            annotation-remarks
26; CHECK-NEXT: Name:            AnnotationSummary
27; CHECK-NEXT: Function:        test2
28; CHECK-NEXT: Args:
29; CHECK-NEXT:   - String:          'Annotated '
30; CHECK-NEXT:   - count:           '2'
31; CHECK-NEXT:   - String:          ' instructions with '
32; CHECK-NEXT:   - type:            _remarks1
33; CHECK-NEXT: ...
34
35define void @test1(ptr %a) {
36entry:
37  %a.addr = alloca ptr, align 8, !annotation !0
38  store ptr null, ptr %a.addr, align 8, !annotation !1
39  store ptr %a, ptr %a.addr, align 8, !annotation !0
40  ret void, !annotation !0
41}
42
43define void @test2(ptr %a) {
44entry:
45  %a.addr = alloca ptr, align 8, !annotation !1
46  ret void, !annotation !1
47}
48
49!0 = !{!"_remarks1", !"_remarks2"}
50!1 = !{!"_remarks1"}
51