1# RUN: llc %s -o - -run-pass=livedebugvalues \ 2# RUN: -experimental-debug-variable-locations \ 3# RUN: | FileCheck %s 4# 5# This test used to cause an infinite loop in InstrRefBasedLDV. Observe block 6# five: on the first entry the desired variable value is in $rdx and $rcx, on 7# both paths to the block. However, the block rotates values between those 8# registers, and feeds a zero-value in too. Ultimately, there is no correct 9# location for the variable in that block. 10# This caused an infinite loop in a previous implementation of LiveDebugValues. 11# Keep this around as a regression test, and check that no location is picked 12# in block 5. 13# 14# CHECK-LABEL: bb.3: 15# CHECK: DBG_INSTR_REF {{.+}}, dbg-instr-ref(7, 0) 16# CHECK-NEXT: DBG_VALUE_LIST {{.+}}, $rdx 17# CHECK-NEXT: $rcx = MOV64rr $rdx 18# CHECK-LABEL: bb.4: 19# CHECK: DBG_VALUE_LIST {{.+}}, $rcx 20# CHECK-NEXT: $rdx = MOV64rr killed $rcx 21# CHECK-LABEL: bb.5: 22# CHECK-NOT: DBG_VALUE 23--- | 24 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128" 25 target triple = "x86_64-unknown-linux-gnu" 26 27 ; Function Attrs: nofree norecurse nosync nounwind readonly uwtable 28 define dso_local void @bees() local_unnamed_addr !dbg !13 { 29 entry: 30 ret void, !dbg !22 31 } 32 33 ; Function Attrs: nofree nosync nounwind readnone speculatable willreturn 34 declare void @llvm.dbg.value(metadata, metadata, metadata) 35 36 !llvm.dbg.cu = !{!2} 37 !llvm.module.flags = !{!8, !9, !10, !11} 38 !llvm.ident = !{!12} 39 40 !0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression()) 41 !1 = distinct !DIGlobalVariable(name: "xmlNormalizeURIPath_path", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true) 42 !2 = distinct !DICompileUnit(language: DW_LANG_C99, file: !3, producer: "clang version 10.0 (git@github.com:llvm/llvm-project 9d8de79d09c9560c094d90b010e8315fe2712ec2)", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, splitDebugInlining: false, nameTableKind: None) 43 !3 = !DIFile(filename: "test4.c", directory: "/tmp") 44 !4 = !{} 45 !5 = !{!0} 46 !6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64) 47 !7 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char) 48 !8 = !{i32 7, !"Dwarf Version", i32 4} 49 !9 = !{i32 2, !"Debug Info Version", i32 3} 50 !10 = !{i32 1, !"wchar_size", i32 4} 51 !11 = !{i32 7, !"uwtable", i32 1} 52 !12 = !{!"clang version 10.0 (git@github.com:llvm/llvm-project 9d8de79d09c9560c094d90b010e8315fe2712ec2)"} 53 !13 = distinct !DISubprogram(name: "xmlNormalizeURIPath", scope: !3, file: !3, line: 2, type: !14, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !16) 54 !14 = !DISubroutineType(types: !15) 55 !15 = !{null} 56 !16 = !{!17, !18} 57 !17 = !DILocalVariable(name: "cur", scope: !13, file: !3, line: 3, type: !6) 58 !18 = !DILocalVariable(name: "segp", scope: !19, file: !3, line: 5, type: !6) 59 !19 = distinct !DILexicalBlock(scope: !13, file: !3, line: 4, column: 13) 60 !20 = !DILocation(line: 4, column: 3, scope: !13) 61 !21 = !DILocation(line: 0, scope: !13) 62 !22 = !DILocation(line: 0, scope: !19) 63 !23 = !DILocation(line: 6, column: 5, scope: !19) 64 !24 = !DILocation(line: 6, column: 12, scope: !19) 65 !25 = !{!26, !26, i64 0} 66 !26 = !{!"omnipotent char", !27, i64 0} 67 !27 = !{!"Simple C/C++ TBAA"} 68 !28 = !DILocation(line: 6, column: 27, scope: !19) 69 !29 = !DILocation(line: 7, column: 7, scope: !19) 70 !30 = distinct !{!30, !23, !31, !32, !33} 71 !31 = !DILocation(line: 7, column: 9, scope: !19) 72 !32 = !{!"llvm.loop.mustprogress"} 73 !33 = !{!"llvm.loop.unroll.disable"} 74 75... 76--- 77name: bees 78alignment: 16 79tracksRegLiveness: true 80debugInstrRef: true 81frameInfo: 82 maxAlignment: 1 83 maxCallFrameSize: 0 84machineFunctionInfo: {} 85body: | 86 bb.0: 87 $rdx = MOV64ri 0, implicit-def $eflags 88 $esi = MOV32ri 0, implicit-def $eflags 89 90 bb.1: 91 successors: %bb.2(0x03e0f83e), %bb.1(0x7c1f07c2) 92 liveins: $rcx, $rdi, $rdx, $eflags 93 94 DBG_PHI $rcx, 2 95 DBG_INSTR_REF !18, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(2, 0), debug-location !22 96 JCC_1 %bb.1, 4, implicit $eflags, debug-location !22 97 98 bb.2: 99 successors: %bb.4(0x30000000), %bb.3(0x50000000) 100 liveins: $rcx, $rdi, $eflags 101 102 JCC_1 %bb.4, 4, implicit $eflags, debug-location !22 103 104 bb.3: 105 successors: %bb.5(0x04000000) 106 liveins: $rcx, $rdi, $eflags 107 108 $rdx = MOV64ri 0, debug-instr-number 7, debug-location !22 109 DBG_INSTR_REF !18, !DIExpression(DW_OP_LLVM_arg, 0), dbg-instr-ref(7, 0), debug-location !22 110 $rcx = MOV64rr $rdx 111 JMP_1 %bb.5, debug-location !22 112 113 bb.4: 114 liveins: $rcx, $rdi, $eflags 115 116 $rdx = MOV64rr killed $rcx, debug-location !22 117 118 bb.5: 119 successors: %bb.5(0x7c000000), %bb.6(0x04000000) 120 liveins: $rdi, $rdx, $eflags 121 122 $rcx = MOV64rr $rdx, debug-location !22 123 $rdx = MOV64ri 0 ; jmorse -- disabling this makes variable live-through 124 JCC_1 %bb.5, 6, implicit $eflags, debug-location !22 125 126 bb.6: 127 RET64 debug-location !22 128 129... 130