1 ; RUN: llc -O2 < %s | FileCheck %s
2 ; RUN: llc -O2 -regalloc=basic < %s | FileCheck %s
3 ; Test to check that unused argument 'this' is not undefined in debug info.
5 target triple = "x86_64-apple-darwin10.2"
7 %struct.foo = type { i32 }
9 @llvm.used = appending global [1 x ptr] [ptr @_ZN3foo3bazEi], section "llvm.metadata"
11 ; Function Attrs: noinline nounwind optsize readnone ssp
12 define i32 @_ZN3foo3bazEi(ptr nocapture %this, i32 %x) #0 align 2 !dbg !4 {
14 ; CHECK: DEBUG_VALUE: baz:this <- $rdi{{$}}
15 tail call void @llvm.dbg.value(metadata ptr %this, i64 0, metadata !13, metadata !16), !dbg !17
16 tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !18, metadata !16), !dbg !17
17 %0 = mul nsw i32 %x, 7, !dbg !19
18 %1 = add nsw i32 %0, 1, !dbg !19
22 ; Function Attrs: nounwind readnone
23 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
25 attributes #0 = { noinline nounwind optsize readnone ssp }
26 attributes #1 = { nounwind readnone }
29 !llvm.module.flags = !{!3}
31 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "4.2.1 LLVM build", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, retainedTypes: !2)
32 !1 = !DIFile(filename: "foo.cp", directory: "/tmp/")
34 !3 = !{i32 1, !"Debug Info Version", i32 3}
35 !4 = distinct !DISubprogram(name: "baz", linkageName: "_ZN3foo3bazEi", scope: !5, file: !1, line: 15, type: !10, isLocal: false, isDefinition: true, scopeLine: 15, virtualIndex: 6, isOptimized: true, unit: !0)
36 !5 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", scope: !1, file: !1, line: 3, size: 32, align: 32, elements: !6)
38 !7 = !DIDerivedType(tag: DW_TAG_member, name: "y", scope: !5, file: !1, line: 8, baseType: !8, size: 32, align: 32)
39 !8 = !DIBasicType(name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
40 !9 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3foo3barEi", scope: !5, file: !1, line: 11, type: !10, isLocal: false, isDefinition: true, scopeLine: 11, virtualIndex: 6, isOptimized: true, unit: !0)
41 !10 = !DISubroutineType(types: !11)
43 !12 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !1, file: !1, baseType: !5, size: 64, align: 64, flags: DIFlagArtificial)
44 !13 = !DILocalVariable(name: "this", arg: 1, scope: !4, file: !1, line: 15, type: !14)
45 !14 = !DIDerivedType(tag: DW_TAG_const_type, scope: !1, file: !1, baseType: !15, size: 64, align: 64, flags: DIFlagArtificial)
46 !15 = !DIDerivedType(tag: DW_TAG_pointer_type, scope: !1, file: !1, baseType: !5, size: 64, align: 64)
48 !17 = !DILocation(line: 0, scope: !4)
49 !18 = !DILocalVariable(name: "x", arg: 2, scope: !4, file: !1, line: 15, type: !8)
50 !19 = !DILocation(line: 16, scope: !20)
51 !20 = distinct !DILexicalBlock(scope: !4, file: !1, line: 15)