1 ; RUN: llc -mtriple=x86_64-apple-macosx <%s | FileCheck %s 2 ; Test that we don't generate empty .debug_loc entries. Originally, there were 3 ; two empty .debug_loc entries for 'a' in an otherwise empty .debug_loc list. 4 ; 5 ; CHECK: .section __DWARF,__debug_loc,regular,debug 6 ; CHECK-NEXT: Lsection_debug_loc: 7 ; CHECK-NEXT: .section __DWARF,__debug_abbrev,regular,debug 8 ; 9 ; Test that the variable stuck around. 10 ; CHECK: .section __DWARF,__debug_info,regular,debug 11 ; CHECK: DW_TAG_variable 12 ; CHECK-NOT: DW_AT_location 13 14 ; Generated using clang -cc1 with the following args: 15 ; 16 ; -triple x86_64-apple-macosx -emit-llvm -gdwarf-4 -O1 17 ; 18 ; From this testcase: 19 ; 20 ;; void fn1() { 21 ;; float a = 1; 22 ;; for (;;) 23 ;; a = 0; 24 ;; } 25 26 ; Function Attrs: noreturn nounwind readnone 27 define void @_Z3fn1v() #0 !dbg !4 { 28 entry: 29 tail call void @llvm.dbg.value(metadata float 1.000000e+00, i64 0, metadata !9, metadata !14), !dbg !15 30 br label %for.cond, !dbg !16 31 32 for.cond: ; preds = %for.cond, %entry 33 tail call void @llvm.dbg.value(metadata float 0.000000e+00, i64 0, metadata !9, metadata !14), !dbg !15 34 br label %for.cond, !dbg !17 35 } 36 37 ; Function Attrs: nounwind readnone 38 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 39 40 attributes #0 = { noreturn nounwind readnone "less-precise-fpmad"="false" "no-frame-pointer-elim"="false" "no-infs-fp-math"="false" "no-nans-fp-math"="false" "no-realign-stack" "stack-protector-buffer-size"="8" "target-features"="+sse,+sse2" "unsafe-fp-math"="false" "use-soft-float"="false" } 41 attributes #1 = { nounwind readnone } 42 43 !llvm.dbg.cu = !{!0} 44 !llvm.module.flags = !{!11, !12} 45 !llvm.ident = !{!13} 46 47 !0 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !1, producer: "clang version 3.7.0 (trunk 238517) (llvm/trunk 238524)", isOptimized: true, runtimeVersion: 0, emissionKind: 1, enums: !2, retainedTypes: !2, subprograms: !3, globals: !2, imports: !2) 48 !1 = !DIFile(filename: "<stdin>", directory: "/Users/dexonsmith/data/llvm/bootstrap/play/delta2/testcase") 49 !2 = !{} 50 !3 = !{!4} 51 !4 = distinct !DISubprogram(name: "fn1", linkageName: "_Z3fn1v", scope: !5, file: !5, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: true, variables: !8) 52 !5 = !DIFile(filename: "t.cpp", directory: "/Users/dexonsmith/data/llvm/bootstrap/play/delta2/testcase") 53 !6 = !DISubroutineType(types: !7) 54 !7 = !{null} 55 !8 = !{!9} 56 !9 = !DILocalVariable(name: "a", scope: !4, file: !5, line: 2, type: !10) 57 !10 = !DIBasicType(name: "float", size: 32, align: 32, encoding: DW_ATE_float) 58 !11 = !{i32 2, !"Dwarf Version", i32 4} 59 !12 = !{i32 2, !"Debug Info Version", i32 3} 60 !13 = !{!"clang version 3.7.0 (trunk 238517) (llvm/trunk 238524)"} 61 !14 = !DIExpression() 62 !15 = !DILocation(line: 2, scope: !4) 63 !16 = !DILocation(line: 3, scope: !4) 64 !17 = !DILocation(line: 3, scope: !18) 65 !18 = distinct !DILexicalBlock(scope: !19, file: !5, line: 3) 66 !19 = distinct !DILexicalBlock(scope: !4, file: !5, line: 3) 67