# NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
# RUN: llc -mtriple=aarch64-unknown-unknown -run-pass=machine-outliner -verify-machineinstrs %s -o - | FileCheck %s
# Verify that we save + restore LR around calls to outlined functions from
# noreturn parents. LR isn't actually used, but debuggers need LR in this case
# to get a backtrace.
--- |
define void @save_lr_1() #0 { ret void }
define void @save_lr_2() #0 { ret void }
define void @save_lr_3() #0 { ret void }
define void @save_lr_4() #0 { ret void }
attributes #0 = { noredzone noreturn }
...
---
name: save_lr_1
alignment: 4
tracksRegLiveness: true
frameInfo:
maxAlignment: 1
maxCallFrameSize: 0
machineFunctionInfo: {}
body: |
bb.0:
liveins: $lr
; CHECK-LABEL: name: save_lr_1
; CHECK: liveins: $lr
; CHECK: $x0 = ORRXrs $xzr, $lr, 0
; CHECK: BL @OUTLINED_FUNCTION_0, implicit-def $lr, implicit $sp, implicit-def $lr, implicit-def $w3, implicit-def $w4, implicit-def $w5, implicit-def $w6, implicit $sp, implicit $wzr, implicit $xzr, implicit $x0
; CHECK: $lr = ORRXrs $xzr, $x0, 0
$w3 = ORRWri $wzr, 1
$w4 = ORRWri $wzr, 1
HINT 0
$w5 = ORRWri $wzr, 1
$w6 = ORRWri $wzr, 1
...
---
name: save_lr_2
alignment: 4
tracksRegLiveness: true
frameInfo:
maxAlignment: 1
maxCallFrameSize: 0
machineFunctionInfo: {}
body: |
bb.0:
liveins: $lr
; CHECK-LABEL: name: save_lr_2
; CHECK: liveins: $lr
; CHECK: $x0 = ORRXrs $xzr, $lr, 0
; CHECK: BL @OUTLINED_FUNCTION_0, implicit-def $lr, implicit $sp, implicit-def $lr, implicit-def $w3, implicit-def $w4, implicit-def $w5, implicit-def $w6, implicit $sp, implicit $wzr, implicit $xzr, implicit $x0
; CHECK: $lr = ORRXrs $xzr, $x0, 0
$w3 = ORRWri $wzr, 1
$w4 = ORRWri $wzr, 1
HINT 0
$w5 = ORRWri $wzr, 1
$w6 = ORRWri $wzr, 1
...
---
name: save_lr_3
alignment: 4
tracksRegLiveness: true
frameInfo:
maxAlignment: 1
maxCallFrameSize: 0
machineFunctionInfo: {}
body: |
bb.0:
liveins: $lr
; CHECK-LABEL: name: save_lr_3
; CHECK: liveins: $lr
; CHECK: $x0 = ORRXrs $xzr, $lr, 0
; CHECK: BL @OUTLINED_FUNCTION_0, implicit-def $lr, implicit $sp, implicit-def $lr, implicit-def $w3, implicit-def $w4, implicit-def $w5, implicit-def $w6, implicit $sp, implicit $wzr, implicit $xzr, implicit $x0
; CHECK: $lr = ORRXrs $xzr, $x0, 0
$w3 = ORRWri $wzr, 1
$w4 = ORRWri $wzr, 1
HINT 0
$w5 = ORRWri $wzr, 1
$w6 = ORRWri $wzr, 1
...
---
name: save_lr_4
alignment: 4
tracksRegLiveness: true
frameInfo:
maxAlignment: 1
maxCallFrameSize: 0
machineFunctionInfo: {}
body: |
bb.0:
liveins: $lr
; CHECK-LABEL: name: save_lr_4
; CHECK: liveins: $lr
; CHECK: $x0 = ORRXrs $xzr, $lr, 0
; CHECK: BL @OUTLINED_FUNCTION_0, implicit-def $lr, implicit $sp, implicit-def $lr, implicit-def $w3, implicit-def $w4, implicit-def $w5, implicit-def $w6, implicit $sp, implicit $wzr, implicit $xzr, implicit $x0
; CHECK: $lr = ORRXrs $xzr, $x0, 0
$w3 = ORRWri $wzr, 1
$w4 = ORRWri $wzr, 1
HINT 0
$w5 = ORRWri $wzr, 1
$w6 = ORRWri $wzr, 1
...