1# RUN: llc %s -run-pass=postra-machine-sink -o - | FileCheck %s 2--- | 3 ; Module stripped of everything, MIR below is what's interesting 4 ; ModuleID = '<stdin>' 5 source_filename = "justacall.cpp" 6 target datalayout = "e-m:e-i64:64-f80:128-n8:16:32:64-S128" 7 target triple = "x86_64-unknown-linux-gnu" 8 9 ; Function Attrs: noinline norecurse nounwind uwtable 10 define dso_local i32 @main(i32 %argc, ptr nocapture readnone %argv) local_unnamed_addr #0 { 11 entry: 12 br label %if.end 13 if.end: 14 br label %return 15 return: 16 ret i32 0 17 } 18 19 !0 = !{!"dummy metadata"} 20 !2 = distinct !DICompileUnit(language: DW_LANG_C_plus_plus, file: !3, producer: "clang", isOptimized: true, runtimeVersion: 0, emissionKind: FullDebug, enums: !4, globals: !5, nameTableKind: None) 21 !3 = !DIFile(filename: "justacall.cpp", directory: "/tmp") 22 !4 = !{} 23 !5 = !{!0} 24 !7 = !DIBasicType(name: "int", size: 32, encoding: DW_ATE_signed) 25 !14 = distinct !DISubprogram(name: "main", scope: !3, file: !3, line: 7, type: !15, isLocal: false, isDefinition: true, scopeLine: 8, flags: DIFlagPrototyped, isOptimized: true, unit: !2, retainedNodes: !20) 26 !15 = !DISubroutineType(types: !16) 27 !16 = !{!7, !7} 28 !20 = !{!21} 29 !21 = !DILocalVariable(name: "argc", arg: 1, scope: !14, file: !3, line: 7, type: !7) 30 31... 32--- 33name: main 34alignment: 16 35exposesReturnsTwice: false 36legalized: false 37regBankSelected: false 38selected: false 39failedISel: false 40tracksRegLiveness: true 41hasWinCFI: false 42registers: 43liveins: 44 - { reg: '$edi', virtual-reg: '' } 45frameInfo: 46 isFrameAddressTaken: false 47 isReturnAddressTaken: false 48 hasStackMap: false 49 hasPatchPoint: false 50 stackSize: 0 51 offsetAdjustment: 0 52 maxAlignment: 0 53 adjustsStack: false 54 hasCalls: true 55 stackProtector: '' 56 maxCallFrameSize: 4294967295 57 cvBytesOfCalleeSavedRegisters: 0 58 hasOpaqueSPAdjustment: false 59 hasVAStart: false 60 hasMustTailInVarArgFunc: false 61 localFrameSize: 0 62 savePoint: '' 63 restorePoint: '' 64fixedStack: 65stack: 66constants: 67body: | 68 bb.0.entry: 69 successors: %bb.2(0x40000000), %bb.1(0x40000000) 70 liveins: $edi 71 72 ; Test that the DBG_VALUE on ebx below is sunk with the def of ebx, despite 73 ; not being adjacent to the def, see PR38952 74 75 DBG_VALUE $edi, $noreg 76 renamable $ebx = COPY $edi 77 renamable $eax = MOV32r0 implicit-def dead $eflags 78 DBG_VALUE $ebx, $noreg 79 CMP32ri $edi, 255, implicit-def $eflags 80 JCC_1 %bb.2, 15, implicit killed $eflags 81 JMP_1 %bb.1 82 83 bb.1.if.end: 84 ; CHECK-LABEL: bb.1.if.end 85 successors: %bb.2(0x80000000) 86 liveins: $ebx 87 88 ; CHECK: $ebx = COPY $edi 89 ; CHECK-NEXT: DBG_VALUE $ebx 90 renamable $rdx = MOVSX64rr32 renamable $ebx 91 renamable $rdx = nsw SHL64ri killed renamable $rdx, 2, implicit-def dead $eflags 92 ADJCALLSTACKDOWN64 0, 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp 93 $rdi = MOV32ri64 0 94 $esi = MOV32r0 implicit-def dead $eflags 95 CALL64pcrel32 &memset, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit killed $esi, implicit $rdx, implicit-def $rsp, implicit-def $ssp, implicit-def dead $rax 96 ADJCALLSTACKUP64 0, 0, implicit-def dead $rsp, implicit-def dead $eflags, implicit-def dead $ssp, implicit $rsp, implicit $ssp 97 98 bb.2.return: 99 liveins: $eax 100 101 RET 0, $eax 102 103... 104