1; RUN: llc -mtriple=x86_64-windows-msvc < %s -filetype=obj | llvm-readobj --codeview - | FileCheck %s --check-prefix=OBJ
2
3; This LL file was generated by running 'clang -g -gcodeview' on the
4; following code:
5; void useint(int);
6; void constant_var() {
7;   int x = 42;
8;   useint(x);
9;   useint(x);
10; }
11
12; FIXME: Find a way to describe variables optimized to constants.
13
14; OBJ:        {{.*}}Proc{{.*}}Sym {
15; OBJ:           DisplayName: constant_var
16; OBJ:         }
17; OBJ:         LocalSym {
18; OBJ-NEXT:      Kind:
19; OBJ-NEXT:      Type: int (0x74)
20; OBJ-NEXT:      Flags [ (0x100)
21; OBJ-NEXT:        IsOptimizedOut (0x100)
22; OBJ-NEXT:      ]
23; OBJ-NEXT:      VarName: x
24; OBJ-NEXT:    }
25; OBJ-NOT:     DefRange
26; OBJ:         ProcEnd
27
28; ModuleID = 't.cpp'
29target datalayout = "e-m:w-i64:64-f80:128-n8:16:32:64-S128"
30target triple = "x86_64-pc-windows-msvc18.0.0"
31
32; Function Attrs: nounwind uwtable
33define void @"\01?constant_var@@YAXXZ"() #0 !dbg !4 {
34entry:
35  tail call void @llvm.dbg.value(metadata i32 42, metadata !8, metadata !14), !dbg !15
36  tail call void @"\01?useint@@YAXH@Z"(i32 42) #3, !dbg !16
37  tail call void @"\01?useint@@YAXH@Z"(i32 42) #3, !dbg !17
38  ret void, !dbg !18
39}
40
41declare void @"\01?useint@@YAXH@Z"(i32) #1
42
43; Function Attrs: nounwind readnone
44declare void @llvm.dbg.value(metadata, metadata, metadata) #2
45
46attributes #0 = { nounwind uwtable "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
47attributes #1 = { "disable-tail-calls"="false" "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+fxsr,+mmx,+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" }
48attributes #2 = { nounwind readnone }
49attributes #3 = { nounwind }
50
51!llvm.dbg.cu = !{!0}
52!llvm.module.flags = !{!10, !11, !12}
53!llvm.ident = !{!13}
54
55!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.9.0 (trunk 260957)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
56!1 = !DIFile(filename: "t.cpp", directory: "D:\5Csrc\5Cllvm\5Cbuild")
57!2 = !{}
58!4 = distinct !DISubprogram(name: "constant_var", linkageName: "\01?constant_var@@YAXXZ", scope: !1, file: !1, line: 2, type: !5, isLocal: false, isDefinition: true, scopeLine: 2, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !7)
59!5 = !DISubroutineType(types: !6)
60!6 = !{null}
61!7 = !{!8}
62!8 = !DILocalVariable(name: "x", scope: !4, file: !1, line: 3, type: !9)
63!9 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
64!10 = !{i32 2, !"CodeView", i32 1}
65!11 = !{i32 2, !"Debug Info Version", i32 3}
66!12 = !{i32 1, !"PIC Level", i32 2}
67!13 = !{!"clang version 3.9.0 (trunk 260957)"}
68!14 = !DIExpression()
69!15 = !DILocation(line: 3, column: 7, scope: !4)
70!16 = !DILocation(line: 4, column: 3, scope: !4)
71!17 = !DILocation(line: 5, column: 3, scope: !4)
72!18 = !DILocation(line: 6, column: 1, scope: !4)
73