109 lines · plain
1# RUN: llc %s --start-before=branch-folder --stop-after=branch-folder -o - \2# RUN: | FileCheck %s --implicit-check-not=DBG_PHI3 4## Common instructions are hoisted. Check that trailing debug instructions in5## the range are also hoisted, and don't cause a crash.6##7## Note the MIR doesn't match the IR as it's modified from:8## /home/och/dev/llvm-project/llvm/test/DebugInfo/X86/branch-folder-dbg.mir9 10# CHECK: bb.011# CHECK: CALL64pcrel32 @f, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax12## --- Start splice from bb.2.if.else (and debug instructions from bb.1.if.then) ---13# CHECK-NEXT: $edi = MOV32r0 implicit-def dead $eflags, debug-location !DILocation(line: 0, scope: ![[#]])14# CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[#]], !DIExpression(), debug-location15# CHECK-NEXT: DBG_VALUE $noreg, $noreg, ![[#]], !DIExpression(), debug-location16## --- End splice ------------------------------------------------------------------17# CHECK-NEXT: TEST64rr killed renamable $rax, renamable $rax, implicit-def $eflags18# CHECK-NEXT: JCC_1 %bb.2, 8, implicit $eflags19# CHECK: bb.120 21--- |22 target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"23 target triple = "x86_64-unknown-linux-gnu"24 25 declare dso_local noundef i64 @f() local_unnamed_addr26 27 define dso_local noundef i32 @g() local_unnamed_addr !dbg !7 {28 %call = tail call noundef i64 @f()29 %cmp1 = icmp sgt i64 0, %call30 %conv2 = trunc i64 0 to i3231 br i1 %cmp1, label %if.then, label %if.else32 33 if.then: ; preds = %034 tail call void @_Z3fooii(i32 noundef %conv2, i32 noundef 0), !dbg !1435 br label %if.end, !dbg !1536 37 if.else: ; preds = %038 tail call void @_Z3barii(i32 noundef %conv2, i32 noundef 1), !dbg !1639 br label %if.end, !dbg !1740 41 if.end: ; preds = %if.else, %if.then42 ret i32 243 }44 45 declare void @_Z3fooii(i32 noundef, i32 noundef) local_unnamed_addr46 47 declare void @_Z3barii(i32 noundef, i32 noundef) local_unnamed_addr48 49 !llvm.module.flags = !{!0, !1}50 !llvm.ident = !{!2}51 !llvm.dbg.cu = !{!3}52 !llvm.debugify = !{!5, !6}53 54 !0 = !{i32 7, !"Dwarf Version", i32 5}55 !1 = !{i32 2, !"Debug Info Version", i32 3}56 !2 = !{!"clang version 21.0.0"}57 !3 = distinct !DICompileUnit(language: DW_LANG_C, file: !4, producer: "debugify", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug)58 !4 = !DIFile(filename: "test.nodbg.ll", directory: "/")59 !5 = !{i32 15}60 !6 = !{i32 7}61 !7 = distinct !DISubprogram(name: "g", linkageName: "g", scope: null, file: !4, line: 1, type: !8, scopeLine: 1, spFlags: DISPFlagDefinition | DISPFlagOptimized, unit: !3, retainedNodes: !10)62 !8 = !DISubroutineType(types: !9)63 !9 = !{}64 !10 = !{!11}65 !11 = !DILocalVariable(name: "1", scope: !7, file: !4, line: 3, type: !12)66 !12 = !DIBasicType(name: "ty64", size: 64, encoding: DW_ATE_unsigned)67 !13 = !DILocation(line: 3, column: 1, scope: !7)68 !14 = !DILocation(line: 9, column: 1, scope: !7)69 !15 = !DILocation(line: 10, column: 1, scope: !7)70 !16 = !DILocation(line: 11, column: 1, scope: !7)71 !17 = !DILocation(line: 12, column: 1, scope: !7)72...73---74name: g75tracksRegLiveness: true76isSSA: false77body: |78 bb.0 (%ir-block.0):79 successors: %bb.1(0x40000000), %bb.2(0x40000000)80 81 frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp82 frame-setup CFI_INSTRUCTION def_cfa_offset 1683 CALL64pcrel32 @f, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax84 TEST64rr killed renamable $rax, renamable $rax, implicit-def $eflags85 JCC_1 %bb.2, 9, implicit killed $eflags86 JMP_1 %bb.187 88 bb.1.if.then:89 successors: %bb.3(0x80000000)90 91 $edi = MOV32r0 implicit-def dead $eflags, debug-location !1492 DBG_VALUE $edi, $noreg, !11, !DIExpression(), debug-location !1393 94 bb.3.if.end:95 $eax = MOV32ri 296 $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp97 frame-destroy CFI_INSTRUCTION def_cfa_offset 898 RET 0, $eax99 100 bb.2.if.else:101 successors: %bb.3(0x80000000)102 103 $edi = MOV32r0 implicit-def dead $eflags, debug-location !16104 DBG_VALUE $edi, $noreg, !11, !DIExpression(), debug-location !13105 CALL64pcrel32 target-flags(x86-plt) @_Z3barii, csr_64, implicit $rsp, implicit $ssp, implicit killed $edi, implicit killed $edi, implicit-def $rsp, implicit-def $ssp, debug-location !16106 JMP_1 %bb.3, debug-location !15107 108...109