1; RUN: llc %s -stop-after=livedebugvalues -o - | FileCheck --check-prefix=SANITY %s
2; RUN: llc < %s -filetype=obj | llvm-dwarfdump -v - | FileCheck %s
3; Test debug_loc support for floating point constants.
4;
5; Created from clang -O1:
6;   void barrier();
7;   void foo() {
8;     float f;
9;     long double ld;
10;     barrier();
11;     f = 3.14;
12;     ld = 3.14;
13;     barrier();
14;   }
15;
16; SANITY: CALL{{.*}} @barrier
17; SANITY: DBG_VALUE x86_fp80 0xK4000C8F5C28F5C28F800
18; SANITY: DBG_VALUE float 0x40091EB860000000
19; SANITY: TAILJMP{{.*}} @barrier
20;
21; CHECK: .debug_info contents:
22; CHECK: DW_TAG_variable
23; CHECK-NEXT:  DW_AT_name {{.*}}"ld"
24; CHECK: DW_TAG_variable
25; CHECK-NEXT:  DW_AT_location {{.*}} (
26; CHECK-NEXT:    [0x{{.*}}, 0x{{.*}}): DW_OP_constu 0x4048f5c3)
27; CHECK-NEXT:  DW_AT_name {{.*}}"f"
28
29source_filename = "test.c"
30target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
31target triple = "x86_64-apple-macosx10.11.0"
32
33; Function Attrs: nounwind ssp uwtable
34define void @foo() #0 !dbg !4 {
35entry:
36  tail call void (...) @barrier() #3, !dbg !16
37  tail call void @llvm.dbg.value(metadata float 0x40091EB860000000, metadata !8, metadata !17), !dbg !18
38  tail call void @llvm.dbg.value(metadata x86_fp80 0xK4000C8F5C28F5C28F800, metadata !10, metadata !17), !dbg !19
39  tail call void (...) @barrier() #3, !dbg !20
40  ret void, !dbg !21
41}
42
43declare void @barrier(...)
44
45; Function Attrs: nounwind readnone
46declare void @llvm.dbg.value(metadata, metadata, metadata) #2
47
48attributes #0 = { nounwind ssp uwtable }
49attributes #2 = { nounwind readnone }
50attributes #3 = { nounwind }
51
52!llvm.dbg.cu = !{!0}
53!llvm.module.flags = !{!12, !13, !14}
54!llvm.ident = !{!15}
55
56!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 3.9.0 (trunk 265328) (llvm/trunk 265330)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
57!1 = !DIFile(filename: "test.c", directory: "/Volumes/Data/radar/25448338")
58!2 = !{}
59!4 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 3, type: !5, isLocal: false, isDefinition: true, scopeLine: 4, isOptimized: true, unit: !0, retainedNodes: !7)
60!5 = !DISubroutineType(types: !6)
61!6 = !{null}
62!7 = !{!8, !10}
63!8 = !DILocalVariable(name: "f", scope: !4, file: !1, line: 5, type: !9)
64!9 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float)
65!10 = !DILocalVariable(name: "ld", scope: !4, file: !1, line: 6, type: !11)
66!11 = !DIBasicType(name: "long double", size: 128, align: 128, encoding: DW_ATE_float)
67!12 = !{i32 2, !"Dwarf Version", i32 2}
68!13 = !{i32 2, !"Debug Info Version", i32 3}
69!14 = !{i32 1, !"PIC Level", i32 2}
70!15 = !{!"clang version 3.9.0 (trunk 265328) (llvm/trunk 265330)"}
71!16 = !DILocation(line: 7, column: 3, scope: !4)
72!17 = !DIExpression()
73!18 = !DILocation(line: 5, column: 9, scope: !4)
74!19 = !DILocation(line: 6, column: 15, scope: !4)
75!20 = !DILocation(line: 10, column: 3, scope: !4)
76!21 = !DILocation(line: 11, column: 1, scope: !4)
77