You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

90 lines
3.1 KiB

# RUN: llc -mtriple=x86_64-unknown-unknown -run-pass=machine-sink -o - %s | FileCheck %s
# Based on machinesink.mir. Verify that the sub-register index in the DBG_VALUE
# instruction is cleared when marking the debug value undef.
--- |
target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"
@x = common local_unnamed_addr global i32 0, align 4
define void @test(i32* nocapture readonly %p) local_unnamed_addr !dbg !14 {
; Stripped
entry:
br label %block1
block1:
br label %exit
exit:
ret void
}
!llvm.dbg.cu = !{!1}
!llvm.module.flags = !{!5, !6}
!llvm.ident = !{!7}
!1 = distinct !DICompileUnit(language: DW_LANG_C99, file: !2, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !3, globals: !3)
!2 = !DIFile(filename: "t.c", directory: "")
!3 = !{}
!4 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!5 = !{i32 2, !"Dwarf Version", i32 4}
!6 = !{i32 2, !"Debug Info Version", i32 3}
!7 = !{!"clang version 4.0.0 "}
!8 = !DISubroutineType(types: !9)
!9 = !{null, !10}
!10 = !DIDerivedType(tag: DW_TAG_pointer_type, baseType: !11, size: 64)
!11 = !DIDerivedType(tag: DW_TAG_const_type, baseType: !12)
!12 = !DIBasicType(name: "unsigned int", size: 32, encoding: DW_ATE_unsigned)
!13 = !DIExpression()
!14 = distinct !DISubprogram(name: "test", scope: !2, file: !2, line: 2, type: !8, isLocal: false, isDefinition: true, scopeLine: 3, flags: DIFlagPrototyped, isOptimized: true, unit: !1, retainedNodes: !15)
!15 = !{!16}
!16 = !DILocalVariable(name: "var", scope: !14, file: !2, line: 2, type: !12)
!17 = !DILocation(line: 1, column: 1, scope: !14)
; CHECK: [[VAR:![0-9]+]] = !DILocalVariable(name: "var",
...
---
name: test
tracksRegLiveness: true
liveins:
- { reg: '$rdi', virtual-reg: '%2' }
- { reg: '$rsi', virtual-reg: '%2' }
body: |
bb.0.entry:
successors: %bb.1.block1, %bb.2.exit
liveins: $rdi, $esi
; This block should _not_ have the first DBG_VALUE sunk out from it, as it
; would pass a later DBG_VALUE of the same variable location. An undef
; DBG_VALUE should be left behind though. Verify that the sub-register
; index in the DBG_VALUE is cleared.
; CHECK-LABEL: bb.0.entry:
; CHECK: [[TEST2VREG:%[0-9]+]]:gr64 = COPY $rdi
; CHECK-NEXT: CMP32ri $esi, 0
; CHECK-NEXT: DBG_VALUE $noreg, $noreg, [[VAR]]
; CHECK-NEXT: CMP32ri $esi, 0
; CHECK-NEXT: DBG_VALUE 0, $noreg, [[VAR]]
; CHECK-NEXT: JCC_1 %bb.1, 4
; CHECK-NEXT: JMP_1
%2:gr64 = COPY $rdi
%5:gr64 = ADD64ri8 %2, 1, implicit-def dead $eflags
CMP32ri $esi, 0, implicit-def $eflags
DBG_VALUE %5.sub_32bit, $noreg, !16, !13, debug-location !17
CMP32ri $esi, 0, implicit-def $eflags
DBG_VALUE 0, $noreg, !16, !13, debug-location !17
JCC_1 %bb.1.block1, 4, implicit $eflags
JMP_1 %bb.2.exit
bb.1.block1:
successors: %bb.2.exit
%1:gr64 = ADD64ri8 %5, 4, implicit-def dead $eflags
JMP_1 %bb.2.exit
bb.2.exit:
$rax = MOV64rr %2
RET 0
...