1 # RUN: llc %s -run-pass=postra-machine-sink -o - | FileCheck %s
3 ; Module stripped of everything, MIR below is what's interesting
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"
9 ; Function Attrs: noinline norecurse nounwind uwtable
10 define dso_local i32 @main(i32 %argc, ptr nocapture readnone %argv) local_unnamed_addr #0 {
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")
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)
29 !21 = !DILocalVariable(name: "argc", arg: 1, scope: !14, file: !3, line: 7, type: !7)
35 exposesReturnsTwice: false
37 regBankSelected: false
40 tracksRegLiveness: true
44 - { reg: '$edi', virtual-reg: '' }
46 isFrameAddressTaken: false
47 isReturnAddressTaken: false
56 maxCallFrameSize: 4294967295
57 cvBytesOfCalleeSavedRegisters: 0
58 hasOpaqueSPAdjustment: false
60 hasMustTailInVarArgFunc: false
69 successors: %bb.2(0x40000000), %bb.1(0x40000000)
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
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
84 ; CHECK-LABEL: bb.1.if.end
85 successors: %bb.2(0x80000000)
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
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