blob: d652da6088d5d48b5d88527ca98757e388d1a96b [file] [log] [blame]
# RUN: llc %s -o - -run-pass=livedebugvalues \
# RUN: -experimental-debug-variable-locations \
# RUN: | FileCheck %s
#
# This test used to cause an infinite loop in InstrRefBasedLDV. Observe block
# five: on the first entry the desired variable value is in $rdx and $rcx, on
# both paths to the block. However, the block rotates values between those
# registers, and feeds a zero-value in too. Ultimately, there is no correct
# location for the variable in that block.
# This caused an infinite loop in a previous implementation of LiveDebugValues.
# Keep this around as a regression test, and check that no location is picked
# in block 5.
#
# CHECK-LABEL: bb.3:
# CHECK: DBG_INSTR_REF 7, 0
# CHECK-NEXT: DBG_VALUE $rdx
# CHECK-NEXT: $rcx = MOV64rr $rdx
# CHECK-LABEL: bb.4:
# CHECK: DBG_VALUE $rcx
# CHECK-NEXT: $rdx = MOV64rr killed $rcx
# CHECK-LABEL: bb.5:
# CHEKC-NOT: DBG_VALUE
--- |
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
; Function Attrs: nofree norecurse nosync nounwind readonly uwtable
define dso_local void @bees() local_unnamed_addr !dbg !13 {
entry:
ret void, !dbg !22
}
; Function Attrs: nofree nosync nounwind readnone speculatable willreturn
declare void @llvm.dbg.value(metadata, metadata, metadata)
!llvm.dbg.cu = !{!2}
!llvm.module.flags = !{!8, !9, !10, !11}
!llvm.ident = !{!12}
!0 = !DIGlobalVariableExpression(var: !1, expr: !DIExpression())
!1 = distinct !DIGlobalVariable(name: "xmlNormalizeURIPath_path", scope: !2, file: !3, line: 1, type: !6, isLocal: false, isDefinition: true)
!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)
!3 = !DIFile(filename: "test4.c", directory: "/tmp")
!4 = !{}
!5 = !{!0}
!6 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !7, size: 64)
!7 = !DIBasicType(name: "char", size: 8, encoding: DW_ATE_signed_char)
!8 = !{i32 7, !"Dwarf Version", i32 4}
!9 = !{i32 2, !"Debug Info Version", i32 3}
!10 = !{i32 1, !"wchar_size", i32 4}
!11 = !{i32 7, !"uwtable", i32 1}
!12 = !{!"clang version 10.0 (git@github.com:llvm/llvm-project 9d8de79d09c9560c094d90b010e8315fe2712ec2)"}
!13 = distinct !DISubprogram(name: "xmlNormalizeURIPath", scope: !3, file: !3, line: 2, type: !14, scopeLine: 2, flags: DIFlagAllCallsDescribed, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !2, retainedNodes: !16)
!14 = !DISubroutineType(types: !15)
!15 = !{null}
!16 = !{!17, !18}
!17 = !DILocalVariable(name: "cur", scope: !13, file: !3, line: 3, type: !6)
!18 = !DILocalVariable(name: "segp", scope: !19, file: !3, line: 5, type: !6)
!19 = distinct !DILexicalBlock(scope: !13, file: !3, line: 4, column: 13)
!20 = !DILocation(line: 4, column: 3, scope: !13)
!21 = !DILocation(line: 0, scope: !13)
!22 = !DILocation(line: 0, scope: !19)
!23 = !DILocation(line: 6, column: 5, scope: !19)
!24 = !DILocation(line: 6, column: 12, scope: !19)
!25 = !{!26, !26, i64 0}
!26 = !{!"omnipotent char", !27, i64 0}
!27 = !{!"Simple C/C++ TBAA"}
!28 = !DILocation(line: 6, column: 27, scope: !19)
!29 = !DILocation(line: 7, column: 7, scope: !19)
!30 = distinct !{!30, !23, !31, !32, !33}
!31 = !DILocation(line: 7, column: 9, scope: !19)
!32 = !{!"llvm.loop.mustprogress"}
!33 = !{!"llvm.loop.unroll.disable"}
...
---
name: bees
alignment: 16
tracksRegLiveness: true
frameInfo:
maxAlignment: 1
maxCallFrameSize: 0
machineFunctionInfo: {}
body: |
bb.0:
$rdx = MOV64ri 0, implicit-def $eflags
$esi = MOV32ri 0, implicit-def $eflags
bb.1:
successors: %bb.2(0x03e0f83e), %bb.1(0x7c1f07c2)
liveins: $rcx, $rdi, $rdx, $eflags
DBG_PHI $rcx, 2
DBG_INSTR_REF 2, 0, !18, !DIExpression(), debug-location !22
JCC_1 %bb.1, 4, implicit $eflags, debug-location !22
bb.2:
successors: %bb.4(0x30000000), %bb.3(0x50000000)
liveins: $rcx, $rdi, $eflags
JCC_1 %bb.4, 4, implicit $eflags, debug-location !22
bb.3:
successors: %bb.5(0x04000000)
liveins: $rcx, $rdi, $eflags
$rdx = MOV64ri 0, debug-instr-number 7, debug-location !22
DBG_INSTR_REF 7, 0, !18, !DIExpression(), debug-location !22
$rcx = MOV64rr $rdx
JMP_1 %bb.5, debug-location !22
bb.4:
liveins: $rcx, $rdi, $eflags
$rdx = MOV64rr killed $rcx, debug-location !22
bb.5:
successors: %bb.5(0x7c000000), %bb.6(0x04000000)
liveins: $rdi, $rdx, $eflags
$rcx = MOV64rr $rdx, debug-location !22
$rdx = MOV64ri 0 ; jmorse -- disabling this makes variable live-through
JCC_1 %bb.5, 6, implicit $eflags, debug-location !22
bb.6:
RET64 debug-location !22
...