blob: a8023842513e62eb3d9575167ea9c60f7013ab8b [file] [log] [blame]
Timur Iskhodzhanovf166f6c2014-01-30 01:39:17 +00001; RUN: %llc_dwarf -filetype=obj < %s > %t
David Blaikie6f1a8062013-06-05 05:39:59 +00002; RUN: llvm-dwarfdump %t | FileCheck %s
3
4; IR generated from clang -O -g with the following source
5;
6; void f1(int x, int y);
7; void f3(int line);
8; void f2() {
9; f1(1, 2);
10; }
11; void f1(int x, int y) {
12; f3(y);
13; }
14
15; CHECK: DW_AT_name{{.*}}"f1"
16; CHECK: DW_TAG_formal_parameter
David Blaikie04ed1d12014-06-13 21:52:33 +000017; CHECK-NOT: DW_TAG
18; CHECK: DW_AT_name{{.*}}"x"
David Blaikie6f1a8062013-06-05 05:39:59 +000019; CHECK: DW_TAG_formal_parameter
David Blaikie04ed1d12014-06-13 21:52:33 +000020; CHECK-NOT: DW_TAG
21; CHECK: DW_AT_name{{.*}}"y"
David Blaikie6f1a8062013-06-05 05:39:59 +000022
23; Function Attrs: uwtable
Peter Collingbourned4bff302015-11-05 22:03:56 +000024define void @_Z2f2v() #0 !dbg !4 {
Adrian Prantlabe04752017-07-28 20:21:02 +000025 tail call void @llvm.dbg.value(metadata i32 undef, metadata !16, metadata !DIExpression()), !dbg !18
26 tail call void @llvm.dbg.value(metadata i32 2, metadata !20, metadata !DIExpression()), !dbg !18
David Blaikie6f1a8062013-06-05 05:39:59 +000027 tail call void @_Z2f3i(i32 2), !dbg !21
28 ret void, !dbg !22
29}
30
31; Function Attrs: uwtable
Peter Collingbourned4bff302015-11-05 22:03:56 +000032define void @_Z2f1ii(i32 %x, i32 %y) #0 !dbg !8 {
Adrian Prantlabe04752017-07-28 20:21:02 +000033 tail call void @llvm.dbg.value(metadata i32 %x, metadata !13, metadata !DIExpression()), !dbg !23
34 tail call void @llvm.dbg.value(metadata i32 %y, metadata !14, metadata !DIExpression()), !dbg !23
David Blaikie6f1a8062013-06-05 05:39:59 +000035 tail call void @_Z2f3i(i32 %y), !dbg !24
36 ret void, !dbg !25
37}
38
39declare void @_Z2f3i(i32) #1
40
41; Function Attrs: nounwind readnone
Adrian Prantlabe04752017-07-28 20:21:02 +000042declare void @llvm.dbg.value(metadata, metadata, metadata) #2
David Blaikie6f1a8062013-06-05 05:39:59 +000043
Fangrui Songa36ddf02019-12-24 16:11:33 -080044attributes #0 = { uwtable "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
45attributes #1 = { "less-precise-fpmad"="false" "frame-pointer"="none" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "unsafe-fp-math"="false" "use-soft-float"="false" }
David Blaikie6f1a8062013-06-05 05:39:59 +000046attributes #2 = { nounwind readnone }
47
48!llvm.dbg.cu = !{!0}
Manman Ren409558f2013-11-22 21:49:45 +000049!llvm.module.flags = !{!26}
David Blaikie6f1a8062013-06-05 05:39:59 +000050
Adrian Prantl75819ae2016-04-15 15:57:41 +000051!0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "clang version 3.4 ", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000052!1 = !DIFile(filename: "exp.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000053!2 = !{}
Shiva Chen2c864552018-05-09 02:40:45 +000054!4 = distinct !DISubprogram(name: "f2", linkageName: "_Z2f2v", line: 3, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 3, file: !1, scope: !5, type: !6, retainedNodes: !2)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000055!5 = !DIFile(filename: "exp.cpp", directory: "/usr/local/google/home/blaikie/dev/scratch")
56!6 = !DISubroutineType(types: !7)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000057!7 = !{null}
Shiva Chen2c864552018-05-09 02:40:45 +000058!8 = distinct !DISubprogram(name: "f1", linkageName: "_Z2f1ii", line: 6, isLocal: false, isDefinition: true, virtualIndex: 6, flags: DIFlagPrototyped, isOptimized: true, unit: !0, scopeLine: 6, file: !1, scope: !5, type: !9, retainedNodes: !12)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000059!9 = !DISubroutineType(types: !10)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000060!10 = !{null, !11, !11}
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000061!11 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000062!12 = !{!13, !14}
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000063!13 = !DILocalVariable(name: "x", line: 6, arg: 1, scope: !8, file: !5, type: !11)
64!14 = !DILocalVariable(name: "y", line: 6, arg: 2, scope: !8, file: !5, type: !11)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000065!15 = !{i32 undef}
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000066!16 = !DILocalVariable(name: "x", line: 6, arg: 1, scope: !8, file: !5, type: !11)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000067!17 = !DILocation(line: 4, scope: !4)
68!18 = !DILocation(line: 6, scope: !8, inlinedAt: !17)
Duncan P. N. Exon Smithbe7ea192014-12-15 19:07:53 +000069!19 = !{i32 2}
Duncan P. N. Exon Smithed013cd2015-07-31 18:58:39 +000070!20 = !DILocalVariable(name: "y", line: 6, arg: 2, scope: !8, file: !5, type: !11)
Duncan P. N. Exon Smitha9308c42015-04-29 16:38:44 +000071!21 = !DILocation(line: 7, scope: !8, inlinedAt: !17)
72!22 = !DILocation(line: 5, scope: !4)
73!23 = !DILocation(line: 6, scope: !8)
74!24 = !DILocation(line: 7, scope: !8)
75!25 = !DILocation(line: 8, scope: !8)
Duncan P. N. Exon Smithe2741802015-03-03 17:24:31 +000076!26 = !{i32 1, !"Debug Info Version", i32 3}