| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 161
 162
 163
 
 | # RUN: llc -o - -run-pass=x86-pseudo -verify-machineinstrs %s | FileCheck %s
--- |
  target datalayout = "e-m:o-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128"
  target triple = "x86_64-apple-macosx11.0.0"
  declare ptr @objc_retainAutoreleasedReturnValue(ptr)
  declare ptr @objc_unsafeClaimAutoreleasedReturnValue(ptr)
  declare ptr @fn()
  define void @test_objc_retainAutoreleaseReturnedValue() {
    ret void
  }
  define void @test_objc_unsafeClaimAutoreleasedReturnValue() {
    ret void
  }
  define void @test_objc_unsafeClaimAutoreleasedReturnValue_2_args() {
    ret void
  }
  define void @test_ret_void() {
    ret void
  }
...
---
# CHECK-LABEL: name: test_objc_retainAutoreleaseReturnedValue
# CHECK:      bb.0
# CHECK-NEXT:   frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
# CHECK-NEXT:   CFI_INSTRUCTION def_cfa_offset 16
# CHECK-NEXT:   BUNDLE
# CHECK-NEXT:     CALL64pcrel32 @fn, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
# CHECK-NEXT:     $rdi = MOV64rr internal $rax
# CHECK-NEXT:     CALL64pcrel32 @objc_retainAutoreleasedReturnValue, csr_64, implicit internal $rsp, implicit internal $ssp, implicit-def $rax
# CHECK-NEXT:   }
# CHECK-NEXT:   $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
# CHECK-NEXT:   RET64
#
name:            test_objc_retainAutoreleaseReturnedValue
alignment:       16
tracksRegLiveness: true
frameInfo:
  stackSize:       8
  offsetAdjustment: -8
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  bb.0 (%ir-block.0):
    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
    CFI_INSTRUCTION def_cfa_offset 16
    CALL64pcrel32_RVMARKER @objc_retainAutoreleasedReturnValue, @fn, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
    RET 0, $rax
...
---
# CHECK-LABEL: name: test_objc_unsafeClaimAutoreleasedReturnValue
# CHECK:      bb.0
# CHECK-NEXT:   frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
# CHECK-NEXT:   CFI_INSTRUCTION def_cfa_offset 16
# CHECK-NEXT:   BUNDLE
# CHECK-NEXT:     CALL64pcrel32 @fn, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
# CHECK-NEXT:     $rdi = MOV64rr internal $rax
# CHECK-NEXT:     CALL64pcrel32 @objc_unsafeClaimAutoreleasedReturnValue, csr_64, implicit internal $rsp, implicit internal $ssp, implicit-def $rax
# CHECK-NEXT:   }
# CHECK-NEXT:   $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
# CHECK-NEXT:   RET64
#
name:            test_objc_unsafeClaimAutoreleasedReturnValue
alignment:       16
tracksRegLiveness: true
frameInfo:
  stackSize:       8
  offsetAdjustment: -8
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  bb.0 (%ir-block.0):
    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
    CFI_INSTRUCTION def_cfa_offset 16
    CALL64pcrel32_RVMARKER @objc_unsafeClaimAutoreleasedReturnValue, @fn, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
    $rcx = frame-destroy POP64r implicit-def $rsp, implicit $rsp
    RET 0, $rax
...
---
# CHECK-LABEL: name: test_objc_unsafeClaimAutoreleasedReturnValue_2_args
# CHECK:      bb.0
# CHECK:        frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
# CHECK-NEXT:   $rax = MOV64rr $rdi
# CHECK-NEXT:   $rdi = MOV64rr killed $rdx
# CHECK-NEXT:   $rdx = MOV64rr killed $rax
# CHECK-NEXT:   BUNDLE
# CHECK-NEXT:     CALL64pcrel32 @fn, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit $rdx, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
# CHECK-NEXT:     $rdi = MOV64rr internal $rax
# CHECK-NEXT:     CALL64pcrel32 @objc_retainAutoreleasedReturnValue, csr_64, implicit internal $rsp, implicit internal $ssp, implicit-def dead $rax
# CHECK-NEXT:  }
# CHECK-NEXT:   $rax = frame-destroy POP64r implicit-def $rsp, implicit $rsp
# CHECK-NEXT:   RET64
#
name:            test_objc_unsafeClaimAutoreleasedReturnValue_2_args
alignment:       16
tracksRegLiveness: true
frameInfo:
  stackSize:       8
  offsetAdjustment: -8
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  bb.0 (%ir-block.0):
    liveins: $rdi, $rdx, $rsi
    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
    $rax = MOV64rr $rdi
    $rdi = MOV64rr killed $rdx
    $rdx = MOV64rr killed $rax
    CALL64pcrel32_RVMARKER @objc_retainAutoreleasedReturnValue, @fn, csr_64, implicit $rsp, implicit $ssp, implicit $rdi, implicit $rsi, implicit $rdx, implicit-def $rsp, implicit-def $ssp, implicit-def dead $rax
    $rax = frame-destroy POP64r implicit-def $rsp, implicit $rsp
    RET 0, $rax
...
# CHECK-LABEL: name: test_ret_void
# CHECK:      bb.0
# CHECK-NEXT:   frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
# CHECK-NEXT:   CFI_INSTRUCTION def_cfa_offset 16
# CHECK-NEXT:   BUNDLE
# CHECK-NEXT:     CALL64pcrel32 @fn, csr_64, implicit $rsp, implicit $ssp, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def $rax
# CHECK-NEXT:     $rdi = MOV64rr internal $rax
# CHECK-NEXT:     CALL64pcrel32 @objc_retainAutoreleasedReturnValue, csr_64, implicit internal $rsp, implicit internal $ssp, implicit-def dead $rax
# CHECK-NEXT:  }
# CHECK-NEXT:   $rax = frame-destroy POP64r implicit-def $rsp, implicit $rsp
# CHECK-NEXT:   RET64
#
name:            test_ret_void
alignment:       16
tracksRegLiveness: true
frameInfo:
  stackSize:       8
  offsetAdjustment: -8
  maxAlignment:    1
  adjustsStack:    true
  hasCalls:        true
  maxCallFrameSize: 0
machineFunctionInfo: {}
body:             |
  bb.0 (%ir-block.0):
    frame-setup PUSH64r undef $rax, implicit-def $rsp, implicit $rsp
    CFI_INSTRUCTION def_cfa_offset 16
    CALL64pcrel32_RVMARKER @objc_retainAutoreleasedReturnValue, @fn, csr_64, implicit $rsp, implicit $ssp, implicit-def $rsp, implicit-def $ssp, implicit-def dead $rax
    $rax = frame-destroy POP64r implicit-def $rsp, implicit $rsp
    RET 0
 |