]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - opencl/llvm.git/blob - test/DebugInfo/X86/dbg-value-const-byref.ll
IR: Make metadata typeless in assembly
[opencl/llvm.git] / test / DebugInfo / X86 / dbg-value-const-byref.ll
1 ; RUN: llc -O1 -filetype=obj -o - %s | llvm-dwarfdump -debug-dump=all - | FileCheck %s
2 ; Generated with -O1 from:
3 ; int f1();
4 ; void f2(int*);
5 ; int f3(int);
6 ;
7 ; int foo() {
8 ;   int i = 3;
9 ;   f3(i);
10 ;   i = 7;
11 ;   i = f1();
12 ;   f2(&i);
13 ;   return 0;
14 ; }
15 ;
16 ; Test that we generate valid debug info for optimized code,
17 ; particularly variables that are described as constants and passed
18 ; by reference.
19 ; rdar://problem/14874886
20 ;
21 ; CHECK: .debug_info contents:
22 ; CHECK: DW_TAG_variable
23 ; CHECK-NOT: DW_TAG
24 ; CHECK:     DW_AT_location [DW_FORM_data4]     ([[LOC:.*]])
25 ; CHECK-NOT: DW_TAG
26 ; CHECK: DW_AT_name{{.*}}"i"
27 ; CHECK: .debug_loc contents:
28 ; CHECK: [[LOC]]:
29 ;        consts 0x00000003
30 ; CHECK: Beginning address offset: 0x0000000000000{{.*}}
31 ; CHECK:    Ending address offset: [[C1:.*]]
32 ; CHECK:     Location description: 11 03
33 ;        consts 0x00000007
34 ; CHECK: Beginning address offset: [[C1]]
35 ; CHECK:    Ending address offset: [[C2:.*]]
36 ; CHECK:     Location description: 11 07
37 ;        rax, piece 0x00000004
38 ; CHECK: Beginning address offset: [[C2]]
39 ; CHECK:    Ending address offset: [[R1:.*]]
40 ; CHECK:     Location description: 50 93 04
41 ;         rdi+0
42 ; CHECK: Beginning address offset: [[R1]]
43 ; CHECK:    Ending address offset: [[R2:.*]]
44 ; CHECK:     Location description: 75 00
45 ;
46 target datalayout = "e-m:o-i64:64-f80:128-n8:16:32:64-S128"
47 target triple = "x86_64-apple-macosx10.9.0"
49 ; Function Attrs: nounwind ssp uwtable
50 define i32 @foo() #0 {
51 entry:
52   %i = alloca i32, align 4
53   call void @llvm.dbg.value(metadata i32 3, i64 0, metadata !10, metadata !{!"0x102"}), !dbg !15
54   %call = call i32 @f3(i32 3) #3, !dbg !16
55   call void @llvm.dbg.value(metadata i32 7, i64 0, metadata !10, metadata !{!"0x102"}), !dbg !18
56   %call1 = call i32 (...)* @f1() #3, !dbg !19
57   call void @llvm.dbg.value(metadata i32 %call1, i64 0, metadata !10, metadata !{!"0x102"}), !dbg !19
58   store i32 %call1, i32* %i, align 4, !dbg !19, !tbaa !20
59   call void @llvm.dbg.value(metadata i32* %i, i64 0, metadata !10, metadata !{!"0x102"}), !dbg !24
60   call void @f2(i32* %i) #3, !dbg !24
61   ret i32 0, !dbg !25
62 }
64 declare i32 @f3(i32)
66 declare i32 @f1(...)
68 declare void @f2(i32*)
70 ; Function Attrs: nounwind readnone
71 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #2
73 attributes #0 = { nounwind ssp uwtable }
74 attributes #2 = { nounwind readnone }
75 attributes #3 = { nounwind }
77 !llvm.dbg.cu = !{!0}
78 !llvm.module.flags = !{!11, !12}
79 !llvm.ident = !{!13}
81 !0 = !{!"0x11\0012\00clang version 3.5.0 \001\00\000\00\001", !1, !2, !2, !3, !2, !2} ; [ DW_TAG_compile_unit ] [dbg-value-const-byref.c] [DW_LANG_C99]
82 !1 = !{!"dbg-value-const-byref.c", !""}
83 !2 = !{}
84 !3 = !{!4}
85 !4 = !{!"0x2e\00foo\00foo\00\005\000\001\000\006\000\001\005", !1, !5, !6, null, i32 ()* @foo, null, null, !9} ; [ DW_TAG_subprogram ] [line 5] [def] [foo]
86 !5 = !{!"0x29", !1}          ; [ DW_TAG_file_type ] [dbg-value-const-byref.c]
87 !6 = !{!"0x15\00\000\000\000\000\000\000", i32 0, null, null, !7, null, null, null} ; [ DW_TAG_subroutine_type ] [line 0, size 0, align 0, offset 0] [from ]
88 !7 = !{!8}
89 !8 = !{!"0x24\00int\000\0032\0032\000\000\005", null, null} ; [ DW_TAG_base_type ] [int] [line 0, size 32, align 32, offset 0, enc DW_ATE_signed]
90 !9 = !{!10}
91 !10 = !{!"0x100\00i\006\000", !4, !5, !8} ; [ DW_TAG_auto_variable ] [i] [line 6]
92 !11 = !{i32 2, !"Dwarf Version", i32 2}
93 !12 = !{i32 1, !"Debug Info Version", i32 2}
94 !13 = !{!"clang version 3.5.0 "}
95 !14 = !{i32 3}
96 !15 = !{i32 6, i32 0, !4, null}
97 !16 = !{i32 7, i32 0, !4, null}
98 !17 = !{i32 7}
99 !18 = !{i32 8, i32 0, !4, null}
100 !19 = !{i32 9, i32 0, !4, null}
101 !20 = !{!21, !21, i64 0}
102 !21 = !{!"int", !22, i64 0}
103 !22 = !{!"omnipotent char", !23, i64 0}
104 !23 = !{!"Simple C/C++ TBAA"}
105 !24 = !{i32 10, i32 0, !4, null}
106 !25 = !{i32 11, i32 0, !4, null}