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