1# Check that the backend can produce a branch-on-count instruction also in 2# the presence of a DEBUG_VALUE machine instruction. 3# 4# RUN: llc %s -mtriple=s390x-linux-gnu -mcpu=z13 -start-before=postrapseudos \ 5# RUN: -o - 2>&1 | FileCheck %s 6# 7# CHECK: brctg 8 9--- | 10 11 define dso_local void @put_charge_groups_in_box() local_unnamed_addr #0 !dbg !5 { 12 bb: 13 br label %bb2 14 15 bb2: ; preds = %bb2, %bb3, %bb 16 br i1 undef, label %bb2, label %bb3.preheader 17 18 bb3.preheader: ; preds = %bb2 19 br label %bb3 20 21 bb3: ; preds = %bb3.preheader, %bb3 22 %tmp4 = phi i64 [ %tmp6, %bb3 ], [ 2, %bb3.preheader ] 23 %tmp6 = add nsw i64 %tmp4, -1 24 ; Keep the dbg metadata live by referencing it in the IR. 25 call void @llvm.dbg.value(metadata i32 0, i64 0, metadata !7, metadata !DIExpression()) 26 %tmp8 = icmp eq i64 %tmp6, 0 27 br i1 %tmp8, label %bb2, label %bb3 28 } 29 30 declare void @llvm.dbg.value(metadata, i64, metadata, metadata) #1 31 32 declare void @llvm.stackprotector(i8*, i8**) #2 33 34 attributes #0 = { "target-cpu"="z13" "use-soft-float"="false" } 35 attributes #1 = { nounwind readnone speculatable "target-cpu"="z13" } 36 attributes #2 = { nounwind } 37 38 !llvm.dbg.cu = !{!0} 39 !llvm.module.flags = !{!3, !4} 40 41 !0 = distinct !DICompileUnit(language: DW_LANG_C99, file: !1, producer: "llvm", isOptimized: false, runtimeVersion: 0, emissionKind: FullDebug, enums: !2) 42 !1 = !DIFile(filename: "test.ll", directory: "/tmp") 43 !2 = !{} 44 !3 = !{i32 2, !"Dwarf Version", i32 4} 45 !4 = !{i32 2, !"Debug Info Version", i32 3} 46 !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) 47 !6 = !DISubroutineType(types: !2) 48 !7 = !DILocalVariable(name: "in", arg: 1, scope: !5, file: !1, line: 1, type: !8) 49 !8 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 50 !9 = !DILocation(line: 1, column: 1, scope: !5) 51 52... 53--- 54name: put_charge_groups_in_box 55alignment: 16 56tracksRegLiveness: true 57frameInfo: 58 maxCallFrameSize: 0 59body: | 60 bb.0.bb: 61 renamable $r0l = LHIMux 0 62 63 bb.1.bb2: 64 liveins: $r0l 65 66 CHIMux renamable $r0l, 0, implicit-def $cc 67 BRC 14, 6, %bb.1, implicit killed $cc 68 69 bb.2.bb3.preheader: 70 liveins: $r0l 71 72 renamable $r1d = LGHI 2 73 74 bb.3.bb3: 75 successors: %bb.1(0x04000000), %bb.3(0x7c000000) 76 liveins: $r1d, $r0l 77 78 renamable $r1d = nsw AGHI killed renamable $r1d, -1, implicit-def dead $cc 79 DBG_VALUE $r1d, $noreg, !7, !DIExpression(), debug-location !9 80 CGHI renamable $r1d, 0, implicit-def $cc 81 DBG_VALUE $r1d, $noreg, !7, !DIExpression(), debug-location !9 82 BRC 14, 6, %bb.3, implicit $cc 83 J %bb.1 84 85... 86