xref: /aosp_15_r20/external/llvm/test/CodeGen/X86/2010-06-01-DeadArg-DbgInfo.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -O2 < %s | FileCheck %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -O2 -regalloc=basic < %s | FileCheck %s
3*9880d681SAndroid Build Coastguard Worker; Test to check that unused argument 'this' is not undefined in debug info.
4*9880d681SAndroid Build Coastguard Worker
5*9880d681SAndroid Build Coastguard Workertarget triple = "x86_64-apple-darwin10.2"
6*9880d681SAndroid Build Coastguard Worker%struct.foo = type { i32 }
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker@llvm.used = appending global [1 x i8*] [i8* bitcast (i32 (%struct.foo*, i32)* @_ZN3foo3bazEi to i8*)], section "llvm.metadata" ; <[1 x i8*]*> [#uses=0]
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Workerdefine i32 @_ZN3foo3bazEi(%struct.foo* nocapture %this, i32 %x) nounwind readnone optsize noinline ssp align 2 !dbg !8 {
11*9880d681SAndroid Build Coastguard Worker;CHECK: DEBUG_VALUE: baz:this <- %RDI{{$}}
12*9880d681SAndroid Build Coastguard Workerentry:
13*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata %struct.foo* %this, i64 0, metadata !15, metadata !DIExpression()), !dbg !DILocation(scope: !8)
14*9880d681SAndroid Build Coastguard Worker  tail call void @llvm.dbg.value(metadata i32 %x, i64 0, metadata !16, metadata !DIExpression()), !dbg !DILocation(scope: !8)
15*9880d681SAndroid Build Coastguard Worker  %0 = mul nsw i32 %x, 7, !dbg !29                ; <i32> [#uses=1]
16*9880d681SAndroid Build Coastguard Worker  %1 = add nsw i32 %0, 1, !dbg !29                ; <i32> [#uses=1]
17*9880d681SAndroid Build Coastguard Worker  ret i32 %1, !dbg !29
18*9880d681SAndroid Build Coastguard Worker}
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Workerdeclare void @llvm.dbg.value(metadata, i64, metadata, metadata) nounwind readnone
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!4}
23*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!34}
24*9880d681SAndroid Build Coastguard Worker!llvm.dbg.lv = !{!0, !14, !15, !16, !17, !24, !25, !28}
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker!0 = !DILocalVariable(name: "this", line: 11, arg: 1, scope: !1, file: !3, type: !12)
27*9880d681SAndroid Build Coastguard Worker!1 = distinct !DISubprogram(name: "bar", linkageName: "_ZN3foo3barEi", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4, scopeLine: 11, file: !31, scope: !2, type: !9)
28*9880d681SAndroid Build Coastguard Worker!2 = !DICompositeType(tag: DW_TAG_structure_type, name: "foo", line: 3, size: 32, align: 32, file: !31, scope: !3, elements: !5)
29*9880d681SAndroid Build Coastguard Worker!3 = !DIFile(filename: "foo.cp", directory: "/tmp/")
30*9880d681SAndroid Build Coastguard Worker!4 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, producer: "4.2.1 LLVM build", isOptimized: true, emissionKind: FullDebug, file: !31, enums: !32, retainedTypes: !32)
31*9880d681SAndroid Build Coastguard Worker!5 = !{!6, !1, !8}
32*9880d681SAndroid Build Coastguard Worker!6 = !DIDerivedType(tag: DW_TAG_member, name: "y", line: 8, size: 32, align: 32, file: !31, scope: !2, baseType: !7)
33*9880d681SAndroid Build Coastguard Worker!7 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed)
34*9880d681SAndroid Build Coastguard Worker!8 = distinct !DISubprogram(name: "baz", linkageName: "_ZN3foo3bazEi", line: 15, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4, scopeLine: 15, file: !31, scope: !2, type: !9)
35*9880d681SAndroid Build Coastguard Worker!9 = !DISubroutineType(types: !10)
36*9880d681SAndroid Build Coastguard Worker!10 = !{!7, !11, !7}
37*9880d681SAndroid Build Coastguard Worker!11 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, flags: DIFlagArtificial, file: !31, scope: !3, baseType: !2)
38*9880d681SAndroid Build Coastguard Worker!12 = !DIDerivedType(tag: DW_TAG_const_type, size: 64, align: 64, flags: DIFlagArtificial, file: !31, scope: !3, baseType: !13)
39*9880d681SAndroid Build Coastguard Worker!13 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !2)
40*9880d681SAndroid Build Coastguard Worker!14 = !DILocalVariable(name: "x", line: 11, arg: 2, scope: !1, file: !3, type: !7)
41*9880d681SAndroid Build Coastguard Worker!15 = !DILocalVariable(name: "this", line: 15, arg: 1, scope: !8, file: !3, type: !12)
42*9880d681SAndroid Build Coastguard Worker!16 = !DILocalVariable(name: "x", line: 15, arg: 2, scope: !8, file: !3, type: !7)
43*9880d681SAndroid Build Coastguard Worker!17 = !DILocalVariable(name: "argc", line: 19, arg: 1, scope: !18, file: !3, type: !7)
44*9880d681SAndroid Build Coastguard Worker!18 = distinct !DISubprogram(name: "main", linkageName: "main", line: 19, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !4, scopeLine: 19, file: !31, scope: !3, type: !19)
45*9880d681SAndroid Build Coastguard Worker!19 = !DISubroutineType(types: !20)
46*9880d681SAndroid Build Coastguard Worker!20 = !{!7, !7, !21}
47*9880d681SAndroid Build Coastguard Worker!21 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !22)
48*9880d681SAndroid Build Coastguard Worker!22 = !DIDerivedType(tag: DW_TAG_pointer_type, size: 64, align: 64, file: !31, scope: !3, baseType: !23)
49*9880d681SAndroid Build Coastguard Worker!23 = !DIBasicType(tag: DW_TAG_base_type, name: "char", size: 8, align: 8, encoding: DW_ATE_signed_char)
50*9880d681SAndroid Build Coastguard Worker!24 = !DILocalVariable(name: "argv", line: 19, arg: 2, scope: !18, file: !3, type: !21)
51*9880d681SAndroid Build Coastguard Worker!25 = !DILocalVariable(name: "a", line: 20, scope: !26, file: !3, type: !2)
52*9880d681SAndroid Build Coastguard Worker!26 = distinct !DILexicalBlock(line: 19, column: 0, file: !31, scope: !27)
53*9880d681SAndroid Build Coastguard Worker!27 = distinct !DILexicalBlock(line: 19, column: 0, file: !31, scope: !18)
54*9880d681SAndroid Build Coastguard Worker!28 = !DILocalVariable(name: "b", line: 21, scope: !26, file: !3, type: !7)
55*9880d681SAndroid Build Coastguard Worker!29 = !DILocation(line: 16, scope: !30)
56*9880d681SAndroid Build Coastguard Worker!30 = distinct !DILexicalBlock(line: 15, column: 0, file: !31, scope: !8)
57*9880d681SAndroid Build Coastguard Worker!31 = !DIFile(filename: "foo.cp", directory: "/tmp/")
58*9880d681SAndroid Build Coastguard Worker!32 = !{}
59*9880d681SAndroid Build Coastguard Worker!34 = !{i32 1, !"Debug Info Version", i32 3}
60