DI: Fold constant arguments into a single MDString
[oota-llvm.git] / test / DebugInfo / X86 / type_units_with_addresses.ll
1 ; REQUIRES: object-emission
2
3 ; RUN: llc -split-dwarf=Enable -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
4 ; RUN:     | llvm-dwarfdump - | FileCheck %s
5
6 ; RUN: llc -split-dwarf=Disable -filetype=obj -O0 -generate-type-units -mtriple=x86_64-unknown-linux-gnu < %s \
7 ; RUN:     | llvm-dwarfdump - | FileCheck --check-prefix=SINGLE %s
8
9 ; Test case built from:
10 ;int i;
11 ;
12 ;template <int *I>
13 ;struct S1 {};
14 ;
15 ;S1<&i> s1;
16 ;
17 ;template <int *I>
18 ;struct S2_1 {};
19 ;
20 ;struct S2 {
21 ;  S2_1<&i> s2_1;
22 ;};
23 ;
24 ;S2 s2;
25 ;
26 ;template <int *I>
27 ;struct S3_1 {};
28 ;
29 ;struct S3_2 {};
30 ;
31 ;struct S3 {
32 ;  S3_1<&i> s3_1;
33 ;  S3_2 s3_2;
34 ;};
35 ;
36 ;S3 s3;
37 ;
38 ;struct S4_1 {};
39 ;
40 ;template <int *T>
41 ;struct S4_2 {};
42 ;
43 ;struct S4 {
44 ;  S4_1 s4_1;
45 ;  S4_2<&::i> s4_2;
46 ;};
47 ;
48 ;S4 s4;
49
50
51 ; CHECK: .debug_info.dwo contents:
52
53 ; CHECK: DW_TAG_structure_type
54 ; CHECK-NEXT: DW_AT_name {{.*}}"S1<&i>"
55
56 ; CHECK: DW_TAG_structure_type
57 ; CHECK-NEXT: DW_AT_name {{.*}}"S2"
58 ; CHECK: DW_TAG_structure_type
59 ; CHECK-NEXT: DW_AT_name {{.*}}"S2_1<&i>"
60
61 ; CHECK: DW_TAG_structure_type
62 ; CHECK-NEXT: DW_AT_name {{.*}}"S3"
63 ; CHECK: DW_TAG_structure_type
64 ; CHECK-NEXT: DW_AT_name {{.*}}"S3_1<&i>"
65 ; CHECK: DW_TAG_structure_type
66 ; CHECK-NEXT: DW_AT_declaration
67 ; CHECK-NEXT: DW_AT_signature
68
69 ; CHECK: DW_TAG_structure_type
70 ; CHECK-NEXT: DW_AT_name {{.*}}"S4"
71 ; CHECK: DW_TAG_structure_type
72 ; CHECK-NEXT: DW_AT_declaration
73 ; CHECK-NEXT: DW_AT_signature
74 ; CHECK: DW_TAG_structure_type
75 ; CHECK-NEXT: DW_AT_name {{.*}}"S4_2<&i>"
76
77 ; SINGLE: .debug_info contents:
78
79 ; SINGLE: DW_TAG_structure_type
80 ; SINGLE-NEXT: DW_AT_declaration
81 ; SINGLE-NEXT: DW_AT_signature
82
83 ; SINGLE: DW_TAG_structure_type
84 ; SINGLE-NEXT: DW_AT_declaration
85 ; SINGLE-NEXT: DW_AT_signature
86
87 ; SINGLE: DW_TAG_structure_type
88 ; SINGLE-NEXT: DW_AT_declaration
89 ; SINGLE-NEXT: DW_AT_signature
90
91 ; SINGLE: DW_TAG_structure_type
92 ; SINGLE-NEXT: DW_AT_declaration
93 ; SINGLE-NEXT: DW_AT_signature
94
95 %struct.S1 = type { i8 }
96 %struct.S2 = type { %struct.S2_1 }
97 %struct.S2_1 = type { i8 }
98 %struct.S3 = type { %struct.S3_1, %struct.S3_2 }
99 %struct.S3_1 = type { i8 }
100 %struct.S3_2 = type { i8 }
101 %struct.S4 = type { %struct.S4_1, %struct.S4_2 }
102 %struct.S4_1 = type { i8 }
103 %struct.S4_2 = type { i8 }
104
105 @i = global i32 0, align 4
106 @a = global %struct.S1 zeroinitializer, align 1
107 @s2 = global %struct.S2 zeroinitializer, align 1
108 @s3 = global %struct.S3 zeroinitializer, align 1
109 @s4 = global %struct.S4 zeroinitializer, align 1
110
111 !llvm.dbg.cu = !{!0}
112 !llvm.module.flags = !{!34, !35}
113 !llvm.ident = !{!36}
114
115 !0 = metadata !{metadata !"0x11\004\00clang version 3.5.0 \000\00\000\00tu.dwo\001", metadata !1, metadata !2, metadata !3, metadata !2, metadata !27, metadata !2} ; [ DW_TAG_compile_unit ] [/tmp/dbginfo/tu.cpp] [DW_LANG_C_plus_plus]
116 !1 = metadata !{metadata !"tu.cpp", metadata !"/tmp/dbginfo"}
117 !2 = metadata !{}
118 !3 = metadata !{metadata !4, metadata !9, metadata !12, metadata !13, metadata !17, metadata !18, metadata !19, metadata !23, metadata !24}
119 !4 = metadata !{metadata !"0x13\00S1<&i>\004\008\008\000\000\000", metadata !1, null, null, metadata !2, null, metadata !5, metadata !"_ZTS2S1IXadL_Z1iEEE"} ; [ DW_TAG_structure_type ] [S1<&i>] [line 4, size 8, align 8, offset 0] [def] [from ]
120 !5 = metadata !{metadata !6}
121 !6 = metadata !{metadata !"0x30\00I\000\000", null, metadata !7, i32* @i, null} ; [ DW_TAG_template_value_parameter ]
122 !7 = metadata !{metadata !"0xf\00\000\0064\0064\000\000", null, null, metadata !8} ; [ DW_TAG_pointer_type ] [line 0, size 64, align 64, offset 0] [from int]
123 !8 = metadata !{metadata !"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]
124 !9 = metadata !{metadata !"0x13\00S2\0011\008\008\000\000\000", metadata !1, null, null, metadata !10, null, null, metadata !"_ZTS2S2"} ; [ DW_TAG_structure_type ] [S2] [line 11, size 8, align 8, offset 0] [def] [from ]
125 !10 = metadata !{metadata !11}
126 !11 = metadata !{metadata !"0xd\00s2_1\0012\008\008\000\000", metadata !1, metadata !"_ZTS2S2", metadata !"_ZTS4S2_1IXadL_Z1iEEE"} ; [ DW_TAG_member ] [s2_1] [line 12, size 8, align 8, offset 0] [from _ZTS4S2_1IXadL_Z1iEEE]
127 !12 = metadata !{metadata !"0x13\00S2_1<&i>\009\008\008\000\000\000", metadata !1, null, null, metadata !2, null, metadata !5, metadata !"_ZTS4S2_1IXadL_Z1iEEE"} ; [ DW_TAG_structure_type ] [S2_1<&i>] [line 9, size 8, align 8, offset 0] [def] [from ]
128 !13 = metadata !{metadata !"0x13\00S3\0022\0016\008\000\000\000", metadata !1, null, null, metadata !14, null, null, metadata !"_ZTS2S3"} ; [ DW_TAG_structure_type ] [S3] [line 22, size 16, align 8, offset 0] [def] [from ]
129 !14 = metadata !{metadata !15, metadata !16}
130 !15 = metadata !{metadata !"0xd\00s3_1\0023\008\008\000\000", metadata !1, metadata !"_ZTS2S3", metadata !"_ZTS4S3_1IXadL_Z1iEEE"} ; [ DW_TAG_member ] [s3_1] [line 23, size 8, align 8, offset 0] [from _ZTS4S3_1IXadL_Z1iEEE]
131 !16 = metadata !{metadata !"0xd\00s3_2\0024\008\008\008\000", metadata !1, metadata !"_ZTS2S3", metadata !"_ZTS4S3_2"} ; [ DW_TAG_member ] [s3_2] [line 24, size 8, align 8, offset 8] [from _ZTS4S3_2]
132 !17 = metadata !{metadata !"0x13\00S3_1<&i>\0018\008\008\000\000\000", metadata !1, null, null, metadata !2, null, metadata !5, metadata !"_ZTS4S3_1IXadL_Z1iEEE"} ; [ DW_TAG_structure_type ] [S3_1<&i>] [line 18, size 8, align 8, offset 0] [def] [from ]
133 !18 = metadata !{metadata !"0x13\00S3_2\0020\008\008\000\000\000", metadata !1, null, null, metadata !2, null, null, metadata !"_ZTS4S3_2"} ; [ DW_TAG_structure_type ] [S3_2] [line 20, size 8, align 8, offset 0] [def] [from ]
134 !19 = metadata !{metadata !"0x13\00S4\0034\0016\008\000\000\000", metadata !1, null, null, metadata !20, null, null, metadata !"_ZTS2S4"} ; [ DW_TAG_structure_type ] [S4] [line 34, size 16, align 8, offset 0] [def] [from ]
135 !20 = metadata !{metadata !21, metadata !22}
136 !21 = metadata !{metadata !"0xd\00s4_1\0035\008\008\000\000", metadata !1, metadata !"_ZTS2S4", metadata !"_ZTS4S4_1"} ; [ DW_TAG_member ] [s4_1] [line 35, size 8, align 8, offset 0] [from _ZTS4S4_1]
137 !22 = metadata !{metadata !"0xd\00s4_2\0036\008\008\008\000", metadata !1, metadata !"_ZTS2S4", metadata !"_ZTS4S4_2IXadL_Z1iEEE"} ; [ DW_TAG_member ] [s4_2] [line 36, size 8, align 8, offset 8] [from _ZTS4S4_2IXadL_Z1iEEE]
138 !23 = metadata !{metadata !"0x13\00S4_1\0029\008\008\000\000\000", metadata !1, null, null, metadata !2, null, null, metadata !"_ZTS4S4_1"} ; [ DW_TAG_structure_type ] [S4_1] [line 29, size 8, align 8, offset 0] [def] [from ]
139 !24 = metadata !{metadata !"0x13\00S4_2<&i>\0032\008\008\000\000\000", metadata !1, null, null, metadata !2, null, metadata !25, metadata !"_ZTS4S4_2IXadL_Z1iEEE"} ; [ DW_TAG_structure_type ] [S4_2<&i>] [line 32, size 8, align 8, offset 0] [def] [from ]
140 !25 = metadata !{metadata !26}
141 !26 = metadata !{metadata !"0x30\00T\000\000", null, metadata !7, i32* @i, null} ; [ DW_TAG_template_value_parameter ]
142 !27 = metadata !{metadata !28, metadata !30, metadata !31, metadata !32, metadata !33}
143 !28 = metadata !{metadata !"0x34\00i\00i\00\001\000\001", null, metadata !29, metadata !8, i32* @i, null} ; [ DW_TAG_variable ] [i] [line 1] [def]
144 !29 = metadata !{metadata !"0x29", metadata !1}         ; [ DW_TAG_file_type ] [/tmp/dbginfo/tu.cpp]
145 !30 = metadata !{metadata !"0x34\00a\00a\00\006\000\001", null, metadata !29, metadata !"_ZTS2S1IXadL_Z1iEEE", %struct.S1* @a, null} ; [ DW_TAG_variable ] [a] [line 6] [def]
146 !31 = metadata !{metadata !"0x34\00s2\00s2\00\0015\000\001", null, metadata !29, metadata !"_ZTS2S2", %struct.S2* @s2, null} ; [ DW_TAG_variable ] [s2] [line 15] [def]
147 !32 = metadata !{metadata !"0x34\00s3\00s3\00\0027\000\001", null, metadata !29, metadata !"_ZTS2S3", %struct.S3* @s3, null} ; [ DW_TAG_variable ] [s3] [line 27] [def]
148 !33 = metadata !{metadata !"0x34\00s4\00s4\00\0039\000\001", null, metadata !29, metadata !"_ZTS2S4", %struct.S4* @s4, null} ; [ DW_TAG_variable ] [s4] [line 39] [def]
149 !34 = metadata !{i32 2, metadata !"Dwarf Version", i32 4}
150 !35 = metadata !{i32 1, metadata !"Debug Info Version", i32 2}
151 !36 = metadata !{metadata !"clang version 3.5.0 "}