# Check that the backend can produce a branch-on-count instruction also in
# the presence of a DEBUG_VALUE machine instruction.
#
# RUN: llc %s -mtriple=s390x-linux-gnu -mcpu=z13 -start-before=postrapseudos \
# RUN: -o - 2>&1 | FileCheck %s
#
# CHECK: brctg
--- |
define dso_local void @put_charge_groups_in_box() local_unnamed_addr #0 !dbg !5 {
bb:
br label %bb2
bb2: ; preds = %bb2, %bb3, %bb
br i1 undef, label %bb2, label %bb3.preheader
bb3.preheader: ; preds = %bb2
br label %bb3
bb3: ; preds = %bb3.preheader, %bb3
%tmp4 = phi i64 [ %tmp6, %bb3 ], [ 2, %bb3.preheader ]
%tmp6 = add nsw i64 %tmp4, -1
; Keep the dbg metadata live by referencing it in the IR.
call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !DIExpression())
%tmp8 = icmp eq i64 %tmp6, 0
br i1 %tmp8, label %bb2, label %bb3
}
declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1
declare void @llvm.stackprotector(ptr, ptr) #2
attributes #0 = { "target-cpu"="z13" "use-soft-float"="false" }
attributes #1 = { nounwind readnone speculatable "target-cpu"="z13" }
attributes #2 = { nounwind }
!llvm.dbg.cu = !{!0}
!llvm.module.flags = !{!3, !4}
!0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "llvm", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2)
!1 = !DIFile(filename: "test.ll", directory: "/tmp")
!2 = !{}
!3 = !{i32 2, !"Dwarf Version", i32 4}
!4 = !{i32 2, !"Debug Info Version", i32 3}
!5 = distinct !DISubprogram(name: "test_dbg_value", scope: !1, file: !1, line: 1, type: !6, isLocal: false, isDefinition: true, scopeLine: 1, flags: DIFlagPrototyped, isOptimized: false, unit: !0, retainedNodes: !2)
!6 = !DISubroutineType(types: !2)
!7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8)
!8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed)
!9 = !DILocation(line: 1, column: 1, scope: !5)
...
---
name: put_charge_groups_in_box
alignment: 16
tracksRegLiveness: true
frameInfo:
maxCallFrameSize: 0
body: |
bb.0.bb:
renamable $r0l = LHIMux 0
bb.1.bb2:
liveins: $r0l
CHIMux renamable $r0l, 0, implicit-def $cc
BRC 14, 6, %bb.1, implicit killed $cc
bb.2.bb3.preheader:
liveins: $r0l
renamable $r1d = LGHI 2
bb.3.bb3:
successors: %bb.1(0x04000000), %bb.3(0x7c000000)
liveins: $r1d, $r0l
renamable $r1d = nsw AGHI killed renamable $r1d, -1, implicit-def dead $cc
DBG_VALUE $r1d, $noreg, !7, !DIExpression(), debug-location !9
CGHI renamable $r1d, 0, implicit-def $cc
DBG_VALUE $r1d, $noreg, !7, !DIExpression(), debug-location !9
BRC 14, 6, %bb.3, implicit $cc
J %bb.1
...