1*9880d681SAndroid Build Coastguard Worker; RUN: llc -mtriple=x86_64-linux-gnu %s -filetype=obj -o %t 2*9880d681SAndroid Build Coastguard Worker; RUN: llvm-dwarfdump %t | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker; Reconstruct this via clang and -O2. 5*9880d681SAndroid Build Coastguard Worker; static void foo() { 6*9880d681SAndroid Build Coastguard Worker; struct X { int a; int b; } xyz; 7*9880d681SAndroid Build Coastguard Worker; } 8*9880d681SAndroid Build Coastguard Worker 9*9880d681SAndroid Build Coastguard Worker; int bar() { 10*9880d681SAndroid Build Coastguard Worker; foo(); 11*9880d681SAndroid Build Coastguard Worker; return 1; 12*9880d681SAndroid Build Coastguard Worker; } 13*9880d681SAndroid Build Coastguard Worker 14*9880d681SAndroid Build Coastguard Worker; Check that we don't have the structure type for X since its scope has 15*9880d681SAndroid Build Coastguard Worker; been optimized away. 16*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG_structure_type 17*9880d681SAndroid Build Coastguard Worker; CHECK: DW_TAG_subprogram 18*9880d681SAndroid Build Coastguard Worker; CHECK: DW_AT_name {{.*}}"bar" 19*9880d681SAndroid Build Coastguard Worker; CHECK-NOT: DW_TAG_structure_type 20*9880d681SAndroid Build Coastguard Worker 21*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone uwtable 22*9880d681SAndroid Build Coastguard Workerdefine i32 @bar() #0 !dbg !4 { 23*9880d681SAndroid Build Coastguard Workerentry: 24*9880d681SAndroid Build Coastguard Worker ret i32 1, !dbg !21 25*9880d681SAndroid Build Coastguard Worker} 26*9880d681SAndroid Build Coastguard Worker 27*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind readnone uwtable "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "stack-protector-buffer-size"="8" "unsafe-fp-math"="false" "use-soft-float"="false" } 28*9880d681SAndroid Build Coastguard Worker 29*9880d681SAndroid Build Coastguard Worker!llvm.dbg.cu = !{!0} 30*9880d681SAndroid Build Coastguard Worker!llvm.module.flags = !{!18, !19} 31*9880d681SAndroid Build Coastguard Worker!llvm.ident = !{!20} 32*9880d681SAndroid Build Coastguard Worker 33*9880d681SAndroid Build Coastguard Worker!0 = distinct !DICompileUnit(language: DW_LANG_C99, producer: "clang version 3.5.0 (trunk 209255) (llvm/trunk 209253)", isOptimized: true, emissionKind: FullDebug, file: !1, enums: !2, retainedTypes: !2, globals: !2, imports: !2) 34*9880d681SAndroid Build Coastguard Worker!1 = !DIFile(filename: "debug-dead-local-var.c", directory: "/usr/local/google/home/echristo") 35*9880d681SAndroid Build Coastguard Worker!2 = !{} 36*9880d681SAndroid Build Coastguard Worker!4 = distinct !DISubprogram(name: "bar", line: 11, isLocal: false, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 11, file: !1, scope: !5, type: !6, variables: !2) 37*9880d681SAndroid Build Coastguard Worker!5 = !DIFile(filename: "debug-dead-local-var.c", directory: "/usr/local/google/home/echristo") 38*9880d681SAndroid Build Coastguard Worker!6 = !DISubroutineType(types: !7) 39*9880d681SAndroid Build Coastguard Worker!7 = !{!8} 40*9880d681SAndroid Build Coastguard Worker!8 = !DIBasicType(tag: DW_TAG_base_type, name: "int", size: 32, align: 32, encoding: DW_ATE_signed) 41*9880d681SAndroid Build Coastguard Worker!9 = distinct !DISubprogram(name: "foo", line: 6, isLocal: true, isDefinition: true, virtualIndex: 6, isOptimized: true, unit: !0, scopeLine: 6, file: !1, scope: !5, type: !10, variables: !12) 42*9880d681SAndroid Build Coastguard Worker!10 = !DISubroutineType(types: !11) 43*9880d681SAndroid Build Coastguard Worker!11 = !{null} 44*9880d681SAndroid Build Coastguard Worker!12 = !{!13} 45*9880d681SAndroid Build Coastguard Worker!13 = !DILocalVariable(name: "xyz", line: 8, scope: !9, file: !5, type: !14) 46*9880d681SAndroid Build Coastguard Worker!14 = !DICompositeType(tag: DW_TAG_structure_type, name: "X", line: 8, size: 64, align: 32, file: !1, scope: !9, elements: !15) 47*9880d681SAndroid Build Coastguard Worker!15 = !{!16, !17} 48*9880d681SAndroid Build Coastguard Worker!16 = !DIDerivedType(tag: DW_TAG_member, name: "a", line: 8, size: 32, align: 32, file: !1, scope: !14, baseType: !8) 49*9880d681SAndroid Build Coastguard Worker!17 = !DIDerivedType(tag: DW_TAG_member, name: "b", line: 8, size: 32, align: 32, offset: 32, file: !1, scope: !14, baseType: !8) 50*9880d681SAndroid Build Coastguard Worker!18 = !{i32 2, !"Dwarf Version", i32 4} 51*9880d681SAndroid Build Coastguard Worker!19 = !{i32 2, !"Debug Info Version", i32 3} 52*9880d681SAndroid Build Coastguard Worker!20 = !{!"clang version 3.5.0 (trunk 209255) (llvm/trunk 209253)"} 53*9880d681SAndroid Build Coastguard Worker!21 = !DILocation(line: 13, scope: !4) 54