xref: /llvm-project/llvm/test/DebugInfo/X86/double-declare.ll (revision 10b03e66629aedad79a804e22d23b575077303b3)
1; RUN: llc -mtriple=x86_64-apple-darwin -O0 -filetype=obj -o - < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s
2; RUN: llc --try-experimental-debuginfo-iterators -mtriple=x86_64-apple-darwin -O0 -filetype=obj -o - < %s | llvm-dwarfdump -v -debug-info - | FileCheck %s
3; PR33157. Don't crash on duplicate dbg.declare.
4; CHECK: DW_TAG_formal_parameter
5; CHECK: DW_AT_location [DW_FORM_exprloc]
6; CHECK-NOT: DW_AT_location
7@g = external global i32
8@h = external global i32
9
10declare void @llvm.dbg.declare(metadata, metadata, metadata)
11
12define void @f(ptr byval(i32) %p, i1 %c) !dbg !5 {
13  br i1 %c, label %x, label %y
14
15x:
16  call void @llvm.dbg.declare(metadata ptr %p, metadata !10, metadata !DIExpression()), !dbg !12
17  store i32 42, ptr @g, !dbg !12
18  br label %done
19
20y:
21  call void @llvm.dbg.declare(metadata ptr %p, metadata !10, metadata !DIExpression()), !dbg !12
22  store i32 42, ptr @h, !dbg !12
23  br label %done
24
25done:
26  ret void
27}
28
29!llvm.dbg.cu = !{!0}
30!llvm.module.flags = !{!22, !23}
31
32!0 = distinct !DICompileUnit(language: DW_LANG_ObjC, file: !1, producer: "clang version 5.0.0 ", isOptimized: true, runtimeVersion: 2, emissionKind: FullDebug)
33!1 = !DIFile(filename: "<stdin>", directory: "C:\5Csrc\5Cllvm-project\5Cbuild")
34!5 = distinct !DISubprogram(name: "f", isLocal: true, isDefinition: true, scopeLine: 37, flags: DIFlagPrototyped, isOptimized: true, unit: !0, type: !99, scope: !1)
35!6 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
36!10 = !DILocalVariable(name: "aRect", arg: 1, scope: !11, file: !1, line: 38, type: !6)
37!11 = distinct !DILexicalBlock(scope: !98, file: !1, line: 38)
38!12 = !DILocation(line: 43, scope: !11, inlinedAt: !13)
39!13 = distinct !DILocation(line: 43, scope: !5)
40!22 = !{i32 2, !"Dwarf Version", i32 4}
41!23 = !{i32 2, !"Debug Info Version", i32 3}
42!62 = !{!10}
43!98 = distinct !DISubprogram(name: "NSMaxX", scope: !1, file: !1, line: 27, isLocal: true, isDefinition: true, scopeLine: 27, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !62, type: !99)
44!99 = !DISubroutineType(types: !100)
45!100 = !{null}
46