1 # NOTE: Assertions have been autogenerated by utils/update_mir_test_checks.py
2 # RUN: llc -mtriple=aarch64 -global-isel -run-pass=instruction-select -verify-machineinstrs %s -o - | FileCheck %s
5 define void @lr_other_block() { ret void }
6 define void @already_live_in() { ret void }
7 define void @multi_use() { ret void }
8 declare i8* @llvm.returnaddress(i32 immarg)
15 tracksRegLiveness: true
17 ; CHECK-LABEL: name: lr_other_block
19 ; CHECK: successors: %bb.1(0x80000000)
20 ; CHECK: liveins: $w0, $x0, $lr
21 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $lr
23 ; CHECK: $lr = COPY [[COPY]]
24 ; CHECK: XPACLRI implicit-def $lr, implicit $lr
25 ; CHECK: [[COPY1:%[0-9]+]]:gpr64 = COPY $lr
26 ; CHECK: $x0 = COPY [[COPY1]]
27 ; CHECK: RET_ReallyLR implicit $x0
28 ; LR should be added as a livein to the entry block.
31 ; We should have lr as a livein to bb.0, and a copy from LR.
35 %4:gpr(p0) = G_INTRINSIC intrinsic(@llvm.returnaddress), 0
37 RET_ReallyLR implicit $x0
44 tracksRegLiveness: true
46 ; CHECK-LABEL: name: already_live_in
48 ; CHECK: successors: %bb.1(0x80000000)
49 ; CHECK: liveins: $w0, $x0, $lr
50 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $lr
52 ; CHECK: $lr = COPY [[COPY]]
53 ; CHECK: XPACLRI implicit-def $lr, implicit $lr
54 ; CHECK: [[COPY1:%[0-9]+]]:gpr64 = COPY $lr
55 ; CHECK: $x0 = COPY [[COPY1]]
56 ; CHECK: RET_ReallyLR implicit $x0
57 ; We should not have LR listed as a livein twice.
60 liveins: $w0, $x0, $lr
63 %4:gpr(p0) = G_INTRINSIC intrinsic(@llvm.returnaddress), 0
65 RET_ReallyLR implicit $x0
68 # Check copies are inserted in the right places when selecting
69 # multiple uses in different blocks
75 tracksRegLiveness: true
77 ; CHECK-LABEL: name: multi_use
79 ; CHECK: successors: %bb.1(0x80000000)
80 ; CHECK: liveins: $w0, $x0, $lr
81 ; CHECK: [[COPY:%[0-9]+]]:gpr64 = COPY $lr
82 ; CHECK: $lr = COPY [[COPY]]
83 ; CHECK: XPACLRI implicit-def $lr, implicit $lr
84 ; CHECK: [[COPY1:%[0-9]+]]:gpr64 = COPY $lr
86 ; CHECK: $x0 = COPY [[COPY1]]
87 ; CHECK: $lr = COPY [[COPY]]
88 ; CHECK: XPACLRI implicit-def $lr, implicit $lr
89 ; CHECK: [[COPY2:%[0-9]+]]:gpr64 = COPY $lr
90 ; CHECK: RET_ReallyLR implicit [[COPY2]]
92 liveins: $w0, $x0, $lr
93 %0:gpr(p0) = G_INTRINSIC intrinsic(@llvm.returnaddress), 0
97 %1:gpr(p0) = G_INTRINSIC intrinsic(@llvm.returnaddress), 0
98 RET_ReallyLR implicit %1