1; RUN: llc -mtriple=x86_64-windows-msvc < %s | FileCheck %s
2; RUN: llc -mtriple=x86_64-windows-msvc -O0 < %s | FileCheck %s
3; RUN: llc -mtriple=i686-windows-msvc < %s | FileCheck %s
4; RUN: llc -mtriple=i686-windows-msvc -O0 < %s | FileCheck %s
5
6; Source to regenerate:
7; $ clang --target=x86_64-windows-msvc -S annotation.c  -g -gcodeview -o t.ll \
8;      -emit-llvm -O1 -Xclang -disable-llvm-passes -fms-extensions
9; void g(void);
10; void f(void) {
11;   g();
12;   __annotation(L"a1", L"a2");
13;   g();
14; }
15; void trapit() {
16;   __annotation(L"foo", L"bar");
17;   asm volatile ("int $0x2C");
18;   __builtin_unreachable();
19; }
20
21; Function Attrs: nounwind uwtable
22define dso_local void @f() #0 !dbg !8 {
23entry:
24  call void @g(), !dbg !11
25  call void @llvm.codeview.annotation(metadata !12), !dbg !13
26  call void @g(), !dbg !14
27  ret void, !dbg !15
28}
29
30declare dso_local void @g() #1
31
32
33; CHECK-LABEL: {{_?f: # @f}}
34; CHECK: {{call[ql] _?g}}
35; CHECK: {{\.?}}Lannotation0:
36; CHECK: {{call[ql] _?g}}
37; CHECK: {{ret[ql]}}
38
39
40; Function Attrs: inaccessiblememonly noduplicate nounwind
41declare void @llvm.codeview.annotation(metadata) #2
42
43; Function Attrs: nounwind uwtable
44define dso_local void @trapit() #0 !dbg !16 {
45entry:
46  call void @llvm.codeview.annotation(metadata !17), !dbg !18
47  call void asm sideeffect "int $$0x2C", "~{dirflag},~{fpsr},~{flags}"() #3, !dbg !19, !srcloc !20
48  unreachable, !dbg !21
49}
50
51
52; CHECK-LABEL: {{_?trapit: # @trapit}}
53; CHECK: {{\.?}}Lannotation1:
54; CHECK: int $44
55
56
57; CHECK-LABEL: .short  4423                    # Record kind: S_GPROC32_ID
58; CHECK:       .short  4121                    # Record kind: S_ANNOTATION
59; CHECK-NEXT:  .secrel32       {{\.?}}Lannotation0
60; CHECK-NEXT:  .secidx {{\.?}}Lannotation0
61; CHECK-NEXT:  .short  2
62; CHECK-NEXT:  .asciz  "a1"
63; CHECK-NEXT:  .asciz  "a2"
64
65; CHECK-LABEL: .short  4431                    # Record kind: S_PROC_ID_END
66
67
68; CHECK-LABEL: .short  4423                    # Record kind: S_GPROC32_ID
69; CHECK:       .short  4121                    # Record kind: S_ANNOTATION
70; CHECK-NEXT:  .secrel32       {{\.?}}Lannotation1
71; CHECK-NEXT:  .secidx {{\.?}}Lannotation1
72; CHECK-NEXT:  .short  2
73; CHECK-NEXT:  .asciz  "foo"
74; CHECK-NEXT:  .asciz  "bar"
75
76; CHECK-LABEL: .short  4431                    # Record kind: S_PROC_ID_END
77
78
79
80attributes #0 = { nounwind uwtable "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "min-legal-vector-width"="0" "frame-pointer"="none" "no-infs-fp-math"="false" "no-jump-tables"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
81attributes #1 = { "correctly-rounded-divide-sqrt-fp-math"="false" "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-signed-zeros-fp-math"="false" "no-trapping-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "unsafe-fp-math"="false" "use-soft-float"="false" }
82attributes #2 = { inaccessiblememonly noduplicate nounwind }
83attributes #3 = { nounwind }
84
85!llvm.dbg.cu = !{!0}
86!llvm.module.flags = !{!3, !4, !5, !6}
87!llvm.ident = !{!7}
88
89!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 9.0.0 (git@github.com:llvm/llvm-project.git 7f9a008a2db285aca57bfa0c09858c9527a7aa98)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, nameTableKind: None)
90!1 = !DIFile(filename: "t.c", directory: "C:\5Csrc\5Cllvm-project\5Cbuild", checksumkind: CSK_MD5, checksum: "066b1dde2a08455e4d345baa8a920b56")
91!2 = !{}
92!3 = !{i32 2, !"CodeView", i32 1}
93!4 = !{i32 2, !"Debug Info Version", i32 3}
94!5 = !{i32 1, !"wchar_size", i32 2}
95!6 = !{i32 7, !"PIC Level", i32 2}
96!7 = !{!"clang version 9.0.0 (git@github.com:llvm/llvm-project.git 7f9a008a2db285aca57bfa0c09858c9527a7aa98)"}
97!8 = distinct !DISubprogram(name: "f", scope: !1, file: !1, line: 2, type: !9, scopeLine: 2, flags: DIFlagPrototyped, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
98!9 = !DISubroutineType(types: !10)
99!10 = !{null}
100!11 = !DILocation(line: 3, scope: !8)
101!12 = !{!"a1", !"a2"}
102!13 = !DILocation(line: 4, scope: !8)
103!14 = !DILocation(line: 5, scope: !8)
104!15 = !DILocation(line: 6, scope: !8)
105!16 = distinct !DISubprogram(name: "trapit", scope: !1, file: !1, line: 7, type: !9, scopeLine: 7, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !0, retainedNodes: !2)
106!17 = !{!"foo", !"bar"}
107!18 = !DILocation(line: 8, scope: !16)
108!19 = !DILocation(line: 9, scope: !16)
109!20 = !{i32 149}
110!21 = !DILocation(line: 10, scope: !16)
111