1 ; RUN: llc %s -stop-after=livedebugvars -o %t
2 ; RUN: cat %t | FileCheck %s
4 ; Test that we can emit debug info for large values that are split
5 ; up across multiple registers by the SelectionDAG type legalizer.
7 ; // Compile with -O1 -m32.
8 ; long long foo (long long a, long long b)
10 ; long long res = b+1;
16 ; CHECK-DAG: DBG_VALUE ${{[a-z]+}}, $noreg, !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_fragment, 0, 32), debug-location !{{[0-9]+}}
17 ; CHECK-DAG: DBG_VALUE ${{[a-z]+}}, $noreg, !{{[0-9]+}}, !DIExpression(DW_OP_LLVM_fragment, 32, 32), debug-location !{{[0-9]+}}
19 ; ModuleID = 'sdagsplit-1.c'
20 target datalayout = "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128"
21 target triple = "i386"
23 ; Function Attrs: nounwind readnone
24 define i64 @foo(i64 %a, i64 %b) local_unnamed_addr #0 !dbg !8 {
26 tail call void @llvm.dbg.value(metadata i64 %a, metadata !13, metadata !16), !dbg !17
27 tail call void @llvm.dbg.value(metadata i64 %b, metadata !14, metadata !16), !dbg !18
28 %cmp = icmp eq i64 %a, %b, !dbg !20
29 %add = add nsw i64 %b, 1, !dbg !22
30 tail call void @llvm.dbg.value(metadata i64 %add, metadata !15, metadata !16), !dbg !19
31 %retval.0 = select i1 %cmp, i64 %add, i64 0, !dbg !23
32 ret i64 %retval.0, !dbg !24
35 ; Function Attrs: nounwind readnone speculatable
36 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
38 attributes #0 = { nounwind readnone }
39 attributes #1 = { nounwind readnone speculatable }
42 !llvm.module.flags = !{!3, !4, !5, !6}
45 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
46 !1 = !DIFile(filename: "sdagsplit-1.c", directory: "/X86")
48 !3 = !{i32 1, !"NumRegisterParameters", i32 0}
49 !4 = !{i32 2, !"Dwarf Version", i32 2}
50 !5 = !{i32 2, !"Debug Info Version", i32 3}
51 !6 = !{i32 1, !"wchar_size", i32 4}
52 !7 = !{!"clang version 6.0.0 "}
53 !8 = distinct !DISubprogram(name: "foo", scope: !1, file: !1, line: 2, type: !9, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !12)
54 !9 = !DISubroutineType(types: !10)
55 !10 = !{!11, !11, !11}
56 !11 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed)
57 !12 = !{!13, !14, !15}
58 !13 = !DILocalVariable(name: "a", arg: 1, scope: !8, file: !1, line: 2, type: !11)
59 !14 = !DILocalVariable(name: "b", arg: 2, scope: !8, file: !1, line: 2, type: !11)
60 !15 = !DILocalVariable(name: "res", scope: !8, file: !1, line: 4, type: !11)
62 !17 = !DILocation(line: 2, column: 26, scope: !8)
63 !18 = !DILocation(line: 2, column: 39, scope: !8)
64 !19 = !DILocation(line: 4, column: 12, scope: !8)
65 !20 = !DILocation(line: 5, column: 9, scope: !21)
66 !21 = distinct !DILexicalBlock(scope: !8, file: !1, line: 5, column: 7)
67 !22 = !DILocation(line: 4, column: 19, scope: !8)
68 !23 = !DILocation(line: 5, column: 7, scope: !8)
69 !24 = !DILocation(line: 8, column: 1, scope: !8)