1# This test generates too many debug location entries to fit into 65KB required 2# by DWARF < 5. Check that the location is set to 0 instead of crashing. 3# 4# RUN: %python %s 5750 | llc -mtriple=x86_64-apple-darwin -filetype=obj -o - \ 5# RUN: | llvm-dwarfdump - | FileCheck %s 6# 7# CHECK: 0x0000004d: DW_TAG_formal_parameter 8# CHECK-NEXT: DW_AT_location (0x00000000 9# CHECK-NEXT: [0x0000000000000000, 0x0000000000000008): <empty>) 10# CHECK-NEXT: DW_AT_name ("self") 11 12import sys 13 14SKELETON = """define void @test() !dbg !24 {{ 15 {} 16 call void @foo(), !dbg !34 17 ret void, !dbg !34 18}} 19 20; Function Attrs: nounwind readnone speculatable 21declare void @llvm.dbg.value(metadata, metadata, metadata) #0 22 23declare void @foo() 24 25attributes #0 = {{ nounwind readnone speculatable }} 26 27!llvm.dbg.cu = !{{!0}} 28!llvm.module.flags = !{{!22}} 29 30!0 = distinct !DICompileUnit(language: DW_LANG_C, file: !1, producer: "clang", isOptimized: true, runtimeVersion: 4, emissionKind: FullDebug) 31!1 = !DIFile(filename: "asdf.c", directory: "bar") 32!2 = !{{}} 33!6 = !DIModule(scope: null, name: "dag", includePath: "/") 34!8 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !6, file: !1, line: 36, size: 2384384, elements: !2, runtimeLang: DW_LANG_C) 35!22 = !{{i32 2, !"Debug Info Version", i32 3}} 36!24 = distinct !DISubprogram(name: "main", linkageName: "main", scope: !6, file: !1, line: 1, type: !25, spFlags: DISPFlagDefinition, unit: !0, retainedNodes: !2) 37!25 = !DISubroutineType(types: !2) 38!30 = !DILocalVariable(name: "self", arg: 1, scope: !24, file: !1, line: 12, type: !8, flags: DIFlagArtificial) 39!34 = !DILocation(line: 12, column: 8, scope: !24) 40""" 41 42CALL = "call void @llvm.dbg.value(metadata i64 {0}, metadata !30, metadata !DIExpression(DW_OP_LLVM_fragment, {1}, 8)), !dbg !34" 43 44if __name__ == '__main__': 45 N = int(sys.argv[1]) 46 calls = [] 47 for i in range(0, N): 48 calls.append(CALL.format(i * 10**12, i*8)) 49 print(SKELETON.format('\n'.join(calls))) 50