1; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \ 2; RUN: -experimental-debug-variable-locations=false \ 3; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE 4; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \ 5; RUN: -experimental-debug-variable-locations=true \ 6; RUN: | FileCheck %s --check-prefixes=CHECK,INSTRREF 7 8; RUN: llc -start-after=codegenprepare -stop-before finalize-isel -o - %s \ 9; RUN: -experimental-debug-variable-locations=false --try-experimental-debuginfo-iterators \ 10; RUN: | FileCheck %s --check-prefixes=CHECK,DBGVALUE 11 12; This is a reproducer based on the test case from PR37321. 13 14; We verify that the fragment for the last DBG_VALUE is limited depending 15; on the size of the original fragment (and that we do not emit more 16; DBG_VALUE instructions than needed in case we cover the whole original 17; fragment with just a few DBG_VALUE instructions). 18 19; CHECK-LABEL: bb.{{.*}}.if.end36: 20; CHECK: [[REG1:%[0-9]+]]:gr32 = PHI 21; INSTRREF-SAME: debug-instr-number 1 22; CHECK-NEXT: [[REG2:%[0-9]+]]:gr32 = PHI 23; INSTRREF-SAME: debug-instr-number 2 24; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI 25; INSTRREF-SAME: debug-instr-number 3 26; INSTRREF-NEXT: DBG_INSTR_REF !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 0, 32), dbg-instr-ref(1, 0) 27; INSTRREF-NEXT: DBG_INSTR_REF !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 32, 32), dbg-instr-ref(2, 0) 28; INSTRREF-NEXT: DBG_INSTR_REF !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 64, 16), dbg-instr-ref(3, 0) 29; INSTRREF-NEXT: DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 10, 32), dbg-instr-ref(1, 0) 30; INSTRREF-NEXT: DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 42, 13), dbg-instr-ref(2, 0) 31; DBGVALUE-NEXT: DBG_VALUE [[REG1]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32) 32; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 32, 32) 33; DBGVALUE-NEXT: DBG_VALUE [[REG3]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 64, 16) 34; DBGVALUE-NEXT: DBG_VALUE [[REG1]], $noreg, !12, !DIExpression(DW_OP_LLVM_fragment, 10, 32) 35; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, !12, !DIExpression(DW_OP_LLVM_fragment, 42, 13) 36; CHECK-NOT: DBG_ 37 38target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32" 39target triple = "i686-w64-windows-gnu" 40 41; Function Attrs: nounwind readnone 42define dso_local i64 @nextafterl(i80 %a, i1 %arg) local_unnamed_addr #0 !dbg !6 { 43entry: 44 br i1 %arg, label %if.else, label %if.then13, !dbg !28 45 46if.then13: ; preds = %entry 47 %u.sroa.0.8.insert.insert = or i80 %a, 2222, !dbg !29 48 br label %if.end36, !dbg !33 49 50if.else: ; preds = %entry 51 br label %if.end36 52 53if.end36: ; preds = %if.else, %if.then13 54 %u.sroa.0.1.in = phi i80 [ %u.sroa.0.8.insert.insert, %if.then13 ], [ 1234567, %if.else ] 55 call void @llvm.dbg.value(metadata i80 %u.sroa.0.1.in, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 80)), !dbg !34 56 call void @llvm.dbg.value(metadata i80 %u.sroa.0.1.in, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 10, 45)), !dbg !34 57 %u.sroa.0.0.extract.ashr = ashr i80 %u.sroa.0.1.in, 8, !dbg !35 58 %u.sroa.0.0.extract.trunc = trunc i80 %u.sroa.0.0.extract.ashr to i64, !dbg !35 59 ret i64 %u.sroa.0.0.extract.trunc 60} 61 62; Function Attrs: nounwind readnone speculatable 63declare void @llvm.dbg.value(metadata, metadata, metadata) #1 64 65attributes #0 = { nounwind readnone } 66attributes #1 = { nounwind readnone speculatable } 67 68!llvm.dbg.cu = !{!0} 69!llvm.module.flags = !{!26, !27} 70 71!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "clang version 7.0.0 (trunk 330808) (llvm/trunk 330813)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !2, globals: !3) 72!1 = !DIFile(filename: "pr37321.c", directory: "") 73!2 = !{} 74!3 = !{!4} 75!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression()) 76!5 = distinct !DIGlobalVariable(name: "normal_bit", scope: !6, file: !1, line: 31, type: !25, isLocal: true, isDefinition: true) 77!6 = distinct !DISubprogram(name: "nextafterl", scope: !1, file: !1, line: 17, type: !7, isLocal: false, isDefinition: true, scopeLine: 18, flags: DIFlagPrototyped, isOptimized: true, unit: !0, retainedNodes: !10) 78!7 = !DISubroutineType(types: !8) 79!8 = !{!9, !9, !9} 80!9 = !DIBasicType(name: "long double", size: 96, encoding: DW_ATE_float) 81!10 = !{!11, !12, !13} 82!11 = !DILocalVariable(name: "x", arg: 1, scope: !6, file: !1, line: 17, type: !9) 83!12 = !DILocalVariable(name: "y", arg: 2, scope: !6, file: !1, line: 17, type: !9) 84!13 = !DILocalVariable(name: "u", scope: !6, file: !1, line: 27, type: !14) 85!14 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !6, file: !1, line: 19, size: 128, elements: !15) 86!15 = !{!16, !17} 87!16 = !DIDerivedType(tag: DW_TAG_member, name: "ld", scope: !14, file: !1, line: 20, baseType: !9, size: 96) 88!17 = !DIDerivedType(tag: DW_TAG_member, name: "parts", scope: !14, file: !1, line: 26, baseType: !18, size: 128) 89!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !14, file: !1, line: 21, size: 128, elements: !19) 90!19 = !{!20, !22, !24} 91!20 = !DIDerivedType(tag: DW_TAG_member, name: "mantissa", scope: !18, file: !1, line: 23, baseType: !21, size: 64) 92!21 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned) 93!22 = !DIDerivedType(tag: DW_TAG_member, name: "expn", scope: !18, file: !1, line: 24, baseType: !23, size: 16, offset: 64) 94!23 = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned) 95!24 = !DIDerivedType(tag: DW_TAG_member, name: "pad", scope: !18, file: !1, line: 25, baseType: !23, size: 16, offset: 80) 96!25 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !21) 97!26 = !{i32 2, !"Debug Info Version", i32 3} 98!27 = !{i32 1, !"wchar_size", i32 2} 99!28 = !DILocation(line: 47, column: 7, scope: !6) 100!29 = !DILocation(line: 51, column: 14, scope: !30) 101!30 = distinct !DILexicalBlock(scope: !31, file: !1, line: 50, column: 11) 102!31 = distinct !DILexicalBlock(scope: !32, file: !1, line: 48, column: 5) 103!32 = distinct !DILexicalBlock(scope: !6, file: !1, line: 47, column: 7) 104!33 = !DILocation(line: 51, column: 2, scope: !30) 105!34 = !DILocation(line: 27, column: 5, scope: !6) 106!35 = !DILocation(line: 63, column: 22, scope: !36) 107!36 = distinct !DILexicalBlock(scope: !6, file: !1, line: 62, column: 7) 108