1; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -O0 < %s | FileCheck --check-prefix=X86 %s
2; RUN: llc -mcpu=core2 -mtriple=i686-pc-win32 -o - -O0 < %s | llvm-mc -triple=i686-pc-win32 -filetype=obj | llvm-readobj -s -sr -codeview -section-symbols | FileCheck --check-prefix=OBJ32 %s
3; RUN: llc -mcpu=core2 -mtriple=x86_64-pc-win32 -O0 < %s | FileCheck --check-prefix=X64 %s
4; RUN: llc -mcpu=core2 -mtriple=x86_64-pc-win32 -o - -O0 < %s | llvm-mc -triple=x86_64-pc-win32 -filetype=obj | llvm-readobj -s -sr -codeview -section-symbols | FileCheck --check-prefix=OBJ64 %s
5
6; This LL file was generated by running clang on the following code:
7; D:\input.c:
8;  1 void g(void);
9;  2
10;  3 void f(void) {
11;  4 #line 1 "one.c"
12;  5   g();
13;  6 #line 2 "two.c"
14;  7   g();
15;  8 #line 7 "one.c"
16;  9   g();
17; 10 }
18
19; X86-LABEL: _f:
20; X86:      # BB
21; X86-NEXT: [[CALL_LINE_1:.*]]:{{$}}
22; X86:      calll   _g
23; X86-NEXT: [[CALL_LINE_2:.*]]:{{$}}
24; X86:      calll   _g
25; X86-NEXT: [[CALL_LINE_3:.*]]:{{$}}
26; X86:      calll   _g
27; X86-NEXT: [[RETURN_STMT:.*]]:
28; X86:      ret
29; X86-NEXT: L{{.*}}:
30; X86-NEXT: [[END_OF_F:.*]]:
31;
32; X86-LABEL: .section        .debug$S,"dr"
33; X86-NEXT: .long   4
34; Symbol subsection
35; X86-NEXT: .long   241
36; X86-NEXT: .long [[F1_END:.*]]-[[F1_START:.*]]
37; X86-NEXT: [[F1_START]]:
38; X86-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]]
39; X86-NEXT: [[PROC_SEGMENT_START]]:
40; X86-NEXT: .short  4423
41; X86-NEXT: .zero   12
42; X86-NEXT: .long [[END_OF_F]]-_f
43; X86-NEXT: .zero   12
44; X86-NEXT: .secrel32 _f
45; X86-NEXT: .secidx _f
46; X86-NEXT: .byte   0
47; X86-NEXT: .byte   102
48; X86-NEXT: .byte   0
49; X86-NEXT: [[PROC_SEGMENT_END]]:
50; X86-NEXT: .short  2
51; X86-NEXT: .short  4431
52; X86-NEXT: [[F1_END]]:
53; Padding
54; X86-NEXT: .zero   3
55; Line table
56; X86-NEXT: .long   242
57; X86-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
58; X86-NEXT: [[F2_START]]:
59; X86-NEXT: .secrel32 _f
60; X86-NEXT: .secidx _f
61; X86-NEXT: .short 0
62; X86-NEXT: .long [[END_OF_F]]-_f
63; Segment for file 'D:\\one.c' begins
64; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
65; X86-NEXT: .long   0
66; X86-NEXT: .long   1
67; X86-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
68; X86-NEXT: .long [[CALL_LINE_1]]-_f
69; X86-NEXT: .long   1
70; X86-NEXT: [[FILE_SEGMENT_END]]:
71; Segment for file 'D:\\two.c' begins
72; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
73; X86-NEXT: .long   8
74; X86-NEXT: .long   1
75; X86-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
76; X86-NEXT: .long [[CALL_LINE_2]]-_f
77; X86-NEXT: .long   2
78; X86-NEXT: [[FILE_SEGMENT_END]]:
79; A new segment for file 'D:\\one.c' begins
80; X86-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
81; X86-NEXT: .long   0
82; X86-NEXT: .long   2
83; X86-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
84; X86-NEXT: .long [[CALL_LINE_3]]-_f
85; X86-NEXT: .long   7
86; X86-NEXT: .long [[RETURN_STMT]]-_f
87; X86-NEXT: .long   8
88; X86-NEXT: [[FILE_SEGMENT_END]]:
89; X86-NEXT: [[F2_END]]:
90; File index to string table offset subsection
91; X86-NEXT: .long   244
92; X86-NEXT: .long   16
93; X86-NEXT: .long   1
94; X86-NEXT: .long   0
95; X86-NEXT: .long   10
96; X86-NEXT: .long   0
97; String table
98; X86-NEXT: .long   243
99; X86-NEXT: .long   19
100; X86-NEXT: .byte   0
101; X86-NEXT: .ascii  "D:\\one.c"
102; X86-NEXT: .byte   0
103; X86-NEXT: .ascii  "D:\\two.c"
104; X86-NEXT: .byte   0
105; X86-NEXT: .zero   1
106
107; OBJ32:    Section {
108; OBJ32:      Name: .debug$S (2E 64 65 62 75 67 24 53)
109; OBJ32:      Characteristics [ (0x42100040)
110; OBJ32:      ]
111; OBJ32:      Relocations [
112; OBJ32-NEXT:   0x2C IMAGE_REL_I386_SECREL _f
113; OBJ32-NEXT:   0x30 IMAGE_REL_I386_SECTION _f
114; OBJ32-NEXT:   0x44 IMAGE_REL_I386_SECREL _f
115; OBJ32-NEXT:   0x48 IMAGE_REL_I386_SECTION _f
116; OBJ32-NEXT: ]
117; OBJ32:      Subsection [
118; OBJ32-NEXT:   Type: 0xF1
119; OBJ32-NOT:    ]
120; OBJ32:        ProcStart {
121; OBJ32-NEXT:     DisplayName: f
122; OBJ32-NEXT:     Section: _f
123; OBJ32-NEXT:     CodeSize: 0x10
124; OBJ32-NEXT:   }
125; OBJ32-NEXT:   ProcEnd
126; OBJ32-NEXT: ]
127; OBJ32:      FunctionLineTable [
128; OBJ32-NEXT:   Name: _f
129; OBJ32-NEXT:   CodeSize: 0x10
130; OBJ32-NEXT:   FilenameSegment [
131; OBJ32-NEXT:     Filename: D:\one.c
132; OBJ32-NEXT:     +0x0: 1
133; OBJ32-NEXT:   ]
134; OBJ32-NEXT:   FilenameSegment [
135; OBJ32-NEXT:     Filename: D:\two.c
136; OBJ32-NEXT:     +0x5: 2
137; OBJ32-NEXT:   ]
138; OBJ32-NEXT:   FilenameSegment [
139; OBJ32-NEXT:     Filename: D:\one.c
140; OBJ32-NEXT:     +0xA: 7
141; OBJ32-NEXT:     +0xF: 8
142; OBJ32-NEXT:   ]
143; OBJ32-NEXT: ]
144; OBJ32:    }
145
146; X64-LABEL: f:
147; X64-NEXT: .L{{.*}}:{{$}}
148; X64-NEXT: [[START:.*]]:{{$}}
149; X64:      # BB
150; X64:      subq    $40, %rsp
151; X64-NEXT: [[CALL_LINE_1:.*]]:{{$}}
152; X64:      callq   g
153; X64-NEXT: [[CALL_LINE_2:.*]]:{{$}}
154; X64:      callq   g
155; X64-NEXT: [[CALL_LINE_3:.*]]:{{$}}
156; X64:      callq   g
157; X64-NEXT: [[EPILOG_AND_RET:.*]]:
158; X64:      addq    $40, %rsp
159; X64-NEXT: ret
160; X64-NEXT: .L{{.*}}:
161; X64-NEXT: [[END_OF_F:.*]]:
162;
163; X64-LABEL: .section        .debug$S,"dr"
164; X64-NEXT: .long   4
165; Symbol subsection
166; X64-NEXT: .long   241
167; X64-NEXT: .long [[F1_END:.*]]-[[F1_START:.*]]
168; X64-NEXT: [[F1_START]]:
169; X64-NEXT: .short [[PROC_SEGMENT_END:.*]]-[[PROC_SEGMENT_START:.*]]
170; X64-NEXT: [[PROC_SEGMENT_START]]:
171; X64-NEXT: .short  4423
172; X64-NEXT: .zero   12
173; X64-NEXT: .long [[END_OF_F]]-f
174; X64-NEXT: .zero   12
175; X64-NEXT: .secrel32 f
176; X64-NEXT: .secidx f
177; X64-NEXT: .byte   0
178; X64-NEXT: .byte   102
179; X64-NEXT: .byte   0
180; X64-NEXT: [[PROC_SEGMENT_END]]:
181; X64-NEXT: .short  2
182; X64-NEXT: .short  4431
183; X64-NEXT: [[F1_END]]:
184; Padding
185; X64-NEXT: .zero   3
186; Line table
187; X64-NEXT: .long   242
188; X64-NEXT: .long [[F2_END:.*]]-[[F2_START:.*]]
189; X64-NEXT: [[F2_START]]:
190; X64-NEXT: .secrel32 f
191; X64-NEXT: .secidx f
192; X64-NEXT: .short 0
193; X64-NEXT: .long [[END_OF_F]]-f
194; Segment for file 'D:\\input.c' begins
195; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
196; X64-NEXT: .long   0
197; X64-NEXT: .long   1
198; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
199; X64-NEXT: .long [[START]]-f
200; X64-NEXT: .long   3
201; X64-NEXT: [[FILE_SEGMENT_END]]:
202; Segment for file 'D:\\one.c' begins
203; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
204; X64-NEXT: .long   8
205; X64-NEXT: .long   1
206; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
207; X64-NEXT: .long [[CALL_LINE_1]]-f
208; X64-NEXT: .long   1
209; X64-NEXT: [[FILE_SEGMENT_END]]:
210; Segment for file 'D:\\two.c' begins
211; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
212; X64-NEXT: .long   16
213; X64-NEXT: .long   1
214; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
215; X64-NEXT: .long [[CALL_LINE_2]]-f
216; X64-NEXT: .long   2
217; X64-NEXT: [[FILE_SEGMENT_END]]:
218; A new segment for file 'D:\\one.c' begins
219; X64-NEXT: [[FILE_SEGMENT_START:[^:]*]]:
220; X64-NEXT: .long   8
221; X64-NEXT: .long   2
222; X64-NEXT: .long [[FILE_SEGMENT_END:.*]]-[[FILE_SEGMENT_START]]
223; X64-NEXT: .long [[CALL_LINE_3]]-f
224; X64-NEXT: .long   7
225; X64-NEXT: .long [[EPILOG_AND_RET]]-f
226; X64-NEXT: .long   8
227; X64-NEXT: [[FILE_SEGMENT_END]]:
228; X64-NEXT: [[F2_END]]:
229; File index to string table offset subsection
230; X64-NEXT: .long   244
231; X64-NEXT: .long   24
232; X64-NEXT: .long   1
233; X64-NEXT: .long   0
234; X64-NEXT: .long   12
235; X64-NEXT: .long   0
236; X64-NEXT: .long   21
237; X64-NEXT: .long   0
238; String table
239; X64-NEXT: .long   243
240; X64-NEXT: .long   30
241; X64-NEXT: .byte   0
242; X64-NEXT: .ascii  "D:\\input.c"
243; X64-NEXT: .byte   0
244; X64-NEXT: .ascii  "D:\\one.c"
245; X64-NEXT: .byte   0
246; X64-NEXT: .ascii  "D:\\two.c"
247; X64-NEXT: .byte   0
248; X64-NEXT: .zero   2
249
250; OBJ64:    Section {
251; OBJ64:      Name: .debug$S (2E 64 65 62 75 67 24 53)
252; OBJ64:      Characteristics [ (0x42100040)
253; OBJ64:      ]
254; OBJ64:      Relocations [
255; OBJ64-NEXT:   0x2C IMAGE_REL_AMD64_SECREL f
256; OBJ64-NEXT:   0x30 IMAGE_REL_AMD64_SECTION f
257; OBJ64-NEXT:   0x44 IMAGE_REL_AMD64_SECREL f
258; OBJ64-NEXT:   0x48 IMAGE_REL_AMD64_SECTION f
259; OBJ64-NEXT: ]
260; OBJ64:      Subsection [
261; OBJ64-NEXT:   Type: 0xF1
262; OBJ64-NOT:    ]
263; OBJ64:        ProcStart {
264; OBJ64-NEXT:     DisplayName: f
265; OBJ64-NEXT:     Section: f
266; OBJ64-NEXT:     CodeSize: 0x18
267; OBJ64-NEXT:   }
268; OBJ64-NEXT:   ProcEnd
269; OBJ64-NEXT: ]
270; OBJ64:      FunctionLineTable [
271; OBJ64-NEXT:   Name: f
272; OBJ64-NEXT:   CodeSize: 0x18
273; OBJ64-NEXT:   FilenameSegment [
274; OBJ64-NEXT:     Filename: D:\input.c
275; OBJ64-NEXT:     +0x0: 3
276; OBJ64-NEXT:   ]
277; OBJ64-NEXT:   FilenameSegment [
278; OBJ64-NEXT:     Filename: D:\one.c
279; OBJ64-NEXT:     +0x4: 1
280; OBJ64-NEXT:   ]
281; OBJ64-NEXT:   FilenameSegment [
282; OBJ64-NEXT:     Filename: D:\two.c
283; OBJ64-NEXT:     +0x9: 2
284; OBJ64-NEXT:   ]
285; OBJ64-NEXT:   FilenameSegment [
286; OBJ64-NEXT:     Filename: D:\one.c
287; OBJ64-NEXT:     +0xE: 7
288; OBJ64-NEXT:     +0x13: 8
289; OBJ64-NEXT:   ]
290; OBJ64-NEXT: ]
291; OBJ64:    }
292
293; Function Attrs: nounwind
294define void @f() #0 {
295entry:
296  call void @g(), !dbg !12
297  call void @g(), !dbg !15
298  call void @g(), !dbg !18
299  ret void, !dbg !19
300}
301
302declare void @g() #1
303
304attributes #0 = { nounwind "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
305attributes #1 = { "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" }
306
307!llvm.dbg.cu = !{!0}
308!llvm.module.flags = !{!9, !10}
309!llvm.ident = !{!11}
310
311!0 = !MDCompileUnit(language: DW_LANG_C99, producer: "clang version 3.5 ", isOptimized: false, emissionKind: 0, file: !1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2)
312!1 = !MDFile(filename: "<unknown>", directory: "D:\5C")
313!2 = !{}
314!3 = !{!4}
315!4 = !MDSubprogram(name: "f", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: false, scopeLine: 3, file: !5, scope: !6, type: !7, function: void ()* @f, variables: !2)
316!5 = !MDFile(filename: "input.c", directory: "D:\5C")
317!6 = !MDFile(filename: "input.c", directory: "D:C")
318!7 = !MDSubroutineType(types: !8)
319!8 = !{null}
320!9 = !{i32 2, !"Dwarf Version", i32 4}
321!10 = !{i32 1, !"Debug Info Version", i32 3}
322!11 = !{!"clang version 3.5 "}
323!12 = !MDLocation(line: 1, scope: !13)
324!13 = !MDLexicalBlockFile(discriminator: 0, file: !14, scope: !4)
325!14 = !MDFile(filename: "one.c", directory: "D:\5C")
326!15 = !MDLocation(line: 2, scope: !16)
327!16 = !MDLexicalBlockFile(discriminator: 0, file: !17, scope: !4)
328!17 = !MDFile(filename: "two.c", directory: "D:\5C")
329!18 = !MDLocation(line: 7, scope: !13)
330!19 = !MDLocation(line: 8, scope: !13)
331