1 ; RUN: llc -simplify-mir -stop-after=machine-sink < %s -o - | FileCheck %s
3 ; ModuleID = 'test-sink-debug.cpp'
4 source_filename = "test-sink-debug.cpp"
5 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
6 target triple = "x86_64-unknown-linux-gnu"
8 ; double foo(double x, double y, bool c) {
23 ; Function Attrs: nounwind readnone uwtable
24 define double @_Z3fooddb(double %x, double %y, i1 zeroext %c) local_unnamed_addr !dbg !7 {
25 tail call void @llvm.dbg.value(metadata double %x, metadata !13, metadata !DIExpression()), !dbg !16
26 tail call void @llvm.dbg.value(metadata double %y, metadata !14, metadata !DIExpression()), !dbg !16
27 tail call void @llvm.dbg.value(metadata i1 %c, metadata !15, metadata !DIExpression()), !dbg !16
28 %a = fdiv double %x, 3.000000e+00
29 %b = fdiv double %y, 5.000000e+00, !dbg !17
30 br i1 %c, label %first, label %second
32 %e = fadd double %a, 1.000000e+00
35 ; CHECK-NOT: debug-location !17
36 ; CHECK: debug-location !18
37 ; CHECK-NOT: debug-location !17
38 %f = fadd double %b, 1.000000e+00, !dbg !18
41 %cond = phi double [%e, %first], [%f, %second]
42 %d = fadd double %cond, 1.000000e+00
48 ; Function Attrs: nounwind readnone uwtable
49 define double @_Z4foo1ddb(double %x, double %y, i1 zeroext %c) local_unnamed_addr !dbg !19 {
50 tail call void @llvm.dbg.value(metadata double %x, metadata !21, metadata !DIExpression()), !dbg !24
51 tail call void @llvm.dbg.value(metadata double %y, metadata !22, metadata !DIExpression()), !dbg !24
52 tail call void @llvm.dbg.value(metadata i1 %c, metadata !23, metadata !DIExpression()), !dbg !24
53 %a = fdiv double %x, 3.000000e+00
54 %b = fdiv double %y, 5.000000e+00, !dbg !25
55 br i1 %c, label %first, label %second
57 %e = fadd double %a, 1.000000e+00
60 %f = fadd double %b, 1.000000e+00, !dbg !25
61 ; CHECK: debug-location !25
62 ; CHECK-NEXT: debug-location !25
65 %cond = phi double [%e, %first], [%f, %second]
66 %d = fadd double %cond, 1.000000e+00
71 !llvm.module.flags = !{!3, !4, !5}
74 attributes #1 = { nounwind readnone speculatable }
76 ; Function Attrs: nounwind readnone speculatable
77 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
79 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 6.0.0 (trunk 313291)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
80 !1 = !DIFile(filename: "test-sink-debug.cpp", directory: "/tmp")
82 !3 = !{i32 2, !"Dwarf Version", i32 4}
83 !4 = !{i32 2, !"Debug Info Version", i32 3}
84 !5 = !{i32 1, !"wchar_size", i32 4}
85 !6 = !{!"clang version 6.0.0 (trunk 313291)"}
86 !7 = distinct !DISubprogram(name: "foo", linkageName: "_Z3fooddb", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
87 !8 = !DISubroutineType(types: !9)
88 !9 = !{!10, !10, !10, !11}
89 !10 = !DIBasicType(name: "double", size: 64, encoding: DW_ATE_float)
90 !11 = !DIBasicType(name: "bool", size: 8, encoding: DW_ATE_boolean)
91 !12 = !{!13, !14, !15}
92 !13 = !DILocalVariable(name: "x", arg: 1, scope: !7, file: !1, line: 1, type: !10)
93 !14 = !DILocalVariable(name: "y", arg: 2, scope: !7, file: !1, line: 1, type: !10)
94 !15 = !DILocalVariable(name: "c", arg: 3, scope: !7, file: !1, line: 1, type: !11)
95 !16 = !DILocation(line: 1, column: 19, scope: !7)
96 !17 = !DILocation(line: 2, column: 26, scope: !7)
97 !18 = !DILocation(line: 3, column: 20, scope: !7)
98 !19 = distinct !DISubprogram(name: "foo1", linkageName: "_Z4foo1ddb", scope: !1, file: !1, line: 1, type: !8, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !20)
99 !20 = !{!21, !22, !23}
100 !21 = !DILocalVariable(name: "x", arg: 1, scope: !19, file: !1, line: 1, type: !10)
101 !22 = !DILocalVariable(name: "y", arg: 2, scope: !19, file: !1, line: 1, type: !10)
102 !23 = !DILocalVariable(name: "c", arg: 3, scope: !19, file: !1, line: 1, type: !11)
103 !24 = !DILocation(line: 1, column: 19, scope: !19)
104 !25 = !DILocation(line: 2, column: 26, scope: !19)