OSDN Git Service

a4f5c05770fb05b70195beb04b0af2104ca119bd
[android-x86/external-llvm.git] / test / DebugInfo / MSP430 / sdagsplit-1.ll
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: ![[MDN1:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 32, 16)
17 ; CHECK: ![[MDN2:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 48, 16)
18 ; CHECK: ![[MDN3:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 0, 16)
19 ; CHECK: ![[MDN4:[0-9]+]] = !DIExpression(DW_OP_LLVM_fragment, 16, 16)
20 ; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, ![[MDN1]], debug-location !{{[0-9]+}}
21 ; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, ![[MDN2]], debug-location !{{[0-9]+}}
22 ; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, ![[MDN3]], debug-location !{{[0-9]+}}
23 ; CHECK-DAG: DBG_VALUE debug-use %r{{[0-9]+}}, debug-use _, !{{[0-9]+}}, ![[MDN4]], debug-location !{{[0-9]+}}
24
25 ; ModuleID = 'sdagsplit-1.c'
26 target datalayout = "e-m:e-p:16:16-i32:16-i64:16-f32:16-f64:16-a:8-n8:16-S16"
27 target triple = "msp430"
28
29 ; Function Attrs: nounwind readnone
30 define i64 @foo(i64 %a, i64 %b) local_unnamed_addr #0 !dbg !7 {
31 entry:
32   tail call void @llvm.dbg.value(metadata i64 %a, metadata !12, metadata !15), !dbg !16
33   tail call void @llvm.dbg.value(metadata i64 %b, metadata !13, metadata !15), !dbg !17
34   tail call void @llvm.dbg.value(metadata i64 %add, metadata !14, metadata !15), !dbg !18
35   %cmp = icmp eq i64 %a, %b, !dbg !19
36   %add = add nsw i64 %b, 1, !dbg !21
37   %retval.0 = select i1 %cmp, i64 %add, i64 0, !dbg !22
38   ret i64 %retval.0, !dbg !23
39 }
40
41 ; Function Attrs: nounwind readnone speculatable
42 declare void @llvm.dbg.value(metadata, metadata, metadata) #1
43
44 attributes #0 = { nounwind readnone }
45 attributes #1 = { nounwind readnone speculatable }
46
47 !llvm.dbg.cu = !{!0}
48 !llvm.module.flags = !{!3, !4, !5}
49 !llvm.ident = !{!6}
50
51 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 6.0.0 ", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
52 !1 = !DIFile(filename: "sdagsplit-1.c", directory: "/MSP430")
53 !2 = !{}
54 !3 = !{i32 2, !"Dwarf Version", i32 2}
55 !4 = !{i32 2, !"Debug Info Version", i32 3}
56 !5 = !{i32 1, !"wchar_size", i32 2}
57 !6 = !{!"clang version 6.0.0 "}
58 !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, variables: !11)
59 !8 = !DISubroutineType(types: !9)
60 !9 = !{!10, !10, !10}
61 !10 = !DIBasicType(name: "long long int", size: 64, encoding: DW_ATE_signed)
62 !11 = !{!12, !13, !14}
63 !12 = !DILocalVariable(name: "a", arg: 1, scope: !7, file: !1, line: 2, type: !10)
64 !13 = !DILocalVariable(name: "b", arg: 2, scope: !7, file: !1, line: 2, type: !10)
65 !14 = !DILocalVariable(name: "res", scope: !7, file: !1, line: 4, type: !10)
66 !15 = !DIExpression()
67 !16 = !DILocation(line: 2, column: 26, scope: !7)
68 !17 = !DILocation(line: 2, column: 39, scope: !7)
69 !18 = !DILocation(line: 4, column: 12, scope: !7)
70 !19 = !DILocation(line: 5, column: 9, scope: !20)
71 !20 = distinct !DILexicalBlock(scope: !7, file: !1, line: 5, column: 7)
72 !21 = !DILocation(line: 4, column: 19, scope: !7)
73 !22 = !DILocation(line: 5, column: 7, scope: !7)
74 !23 = !DILocation(line: 8, column: 1, scope: !7)