104 lines · plain
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,DBGVALUE4; 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,INSTRREF7 8; This is a reproducer based on the test case from PR37321.9 10; We verify that the fragment for the last DBG_VALUE is limited depending11; on the size of the original fragment (and that we do not emit more12; DBG_VALUE instructions than needed in case we cover the whole original13; fragment with just a few DBG_VALUE instructions).14 15; CHECK-LABEL: bb.{{.*}}.if.end36:16; CHECK: [[REG1:%[0-9]+]]:gr32 = PHI17; INSTRREF-SAME: debug-instr-number 118; CHECK-NEXT: [[REG2:%[0-9]+]]:gr32 = PHI19; INSTRREF-SAME: debug-instr-number 220; CHECK-NEXT: [[REG3:%[0-9]+]]:gr32 = PHI21; INSTRREF-SAME: debug-instr-number 322; INSTRREF-NEXT: DBG_INSTR_REF !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 0, 32), dbg-instr-ref(1, 0)23; INSTRREF-NEXT: DBG_INSTR_REF !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 32, 32), dbg-instr-ref(2, 0)24; INSTRREF-NEXT: DBG_INSTR_REF !13, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 64, 16), dbg-instr-ref(3, 0)25; INSTRREF-NEXT: DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 10, 32), dbg-instr-ref(1, 0)26; INSTRREF-NEXT: DBG_INSTR_REF !12, !DIExpression(DW_OP_LLVM_arg, 0, DW_OP_LLVM_fragment, 42, 13), dbg-instr-ref(2, 0)27; DBGVALUE-NEXT: DBG_VALUE [[REG1]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 0, 32)28; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 32, 32)29; DBGVALUE-NEXT: DBG_VALUE [[REG3]], $noreg, !13, !DIExpression(DW_OP_LLVM_fragment, 64, 16)30; DBGVALUE-NEXT: DBG_VALUE [[REG1]], $noreg, !12, !DIExpression(DW_OP_LLVM_fragment, 10, 32)31; DBGVALUE-NEXT: DBG_VALUE [[REG2]], $noreg, !12, !DIExpression(DW_OP_LLVM_fragment, 42, 13)32; CHECK-NOT: DBG_33 34target datalayout = "e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"35target triple = "i686-w64-windows-gnu"36 37; Function Attrs: nounwind readnone38define dso_local i64 @nextafterl(i80 %a, i1 %arg) local_unnamed_addr #0 !dbg !6 {39entry:40 br i1 %arg, label %if.else, label %if.then13, !dbg !2841 42if.then13: ; preds = %entry43 %u.sroa.0.8.insert.insert = or i80 %a, 2222, !dbg !2944 br label %if.end36, !dbg !3345 46if.else: ; preds = %entry47 br label %if.end3648 49if.end36: ; preds = %if.else, %if.then1350 %u.sroa.0.1.in = phi i80 [ %u.sroa.0.8.insert.insert, %if.then13 ], [ 1234567, %if.else ]51 call void @llvm.dbg.value(metadata i80 %u.sroa.0.1.in, metadata !13, metadata !DIExpression(DW_OP_LLVM_fragment, 0, 80)), !dbg !3452 call void @llvm.dbg.value(metadata i80 %u.sroa.0.1.in, metadata !12, metadata !DIExpression(DW_OP_LLVM_fragment, 10, 45)), !dbg !3453 %u.sroa.0.0.extract.ashr = ashr i80 %u.sroa.0.1.in, 8, !dbg !3554 %u.sroa.0.0.extract.trunc = trunc i80 %u.sroa.0.0.extract.ashr to i64, !dbg !3555 ret i64 %u.sroa.0.0.extract.trunc56}57 58; Function Attrs: nounwind readnone speculatable59declare void @llvm.dbg.value(metadata, metadata, metadata) #160 61attributes #0 = { nounwind readnone }62attributes #1 = { nounwind readnone speculatable }63 64!llvm.dbg.cu = !{!0}65!llvm.module.flags = !{!26, !27}66 67!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)68!1 = !DIFile(filename: "pr37321.c", directory: "")69!2 = !{}70!3 = !{!4}71!4 = !DIGlobalVariableExpression(var: !5, expr: !DIExpression())72!5 = distinct !DIGlobalVariable(name: "normal_bit", scope: !6, file: !1, line: 31, type: !25, isLocal: true, isDefinition: true)73!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)74!7 = !DISubroutineType(types: !8)75!8 = !{!9, !9, !9}76!9 = !DIBasicType(name: "long double", size: 96, encoding: DW_ATE_float)77!10 = !{!11, !12, !13}78!11 = !DILocalVariable(name: "x", arg: 1, scope: !6, file: !1, line: 17, type: !9)79!12 = !DILocalVariable(name: "y", arg: 2, scope: !6, file: !1, line: 17, type: !9)80!13 = !DILocalVariable(name: "u", scope: !6, file: !1, line: 27, type: !14)81!14 = distinct !DICompositeType(tag: DW_TAG_union_type, scope: !6, file: !1, line: 19, size: 128, elements: !15)82!15 = !{!16, !17}83!16 = !DIDerivedType(tag: DW_TAG_member, name: "ld", scope: !14, file: !1, line: 20, baseType: !9, size: 96)84!17 = !DIDerivedType(tag: DW_TAG_member, name: "parts", scope: !14, file: !1, line: 26, baseType: !18, size: 128)85!18 = distinct !DICompositeType(tag: DW_TAG_structure_type, scope: !14, file: !1, line: 21, size: 128, elements: !19)86!19 = !{!20, !22, !24}87!20 = !DIDerivedType(tag: DW_TAG_member, name: "mantissa", scope: !18, file: !1, line: 23, baseType: !21, size: 64)88!21 = !DIBasicType(name: "long long unsigned int", size: 64, encoding: DW_ATE_unsigned)89!22 = !DIDerivedType(tag: DW_TAG_member, name: "expn", scope: !18, file: !1, line: 24, baseType: !23, size: 16, offset: 64)90!23 = !DIBasicType(name: "unsigned short", size: 16, encoding: DW_ATE_unsigned)91!24 = !DIDerivedType(tag: DW_TAG_member, name: "pad", scope: !18, file: !1, line: 25, baseType: !23, size: 16, offset: 80)92!25 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !21)93!26 = !{i32 2, !"Debug Info Version", i32 3}94!27 = !{i32 1, !"wchar_size", i32 2}95!28 = !DILocation(line: 47, column: 7, scope: !6)96!29 = !DILocation(line: 51, column: 14, scope: !30)97!30 = distinct !DILexicalBlock(scope: !31, file: !1, line: 50, column: 11)98!31 = distinct !DILexicalBlock(scope: !32, file: !1, line: 48, column: 5)99!32 = distinct !DILexicalBlock(scope: !6, file: !1, line: 47, column: 7)100!33 = !DILocation(line: 51, column: 2, scope: !30)101!34 = !DILocation(line: 27, column: 5, scope: !6)102!35 = !DILocation(line: 63, column: 22, scope: !36)103!36 = distinct !DILexicalBlock(scope: !6, file: !1, line: 62, column: 7)104