1 2 # RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass machine-cp -verify-machineinstrs -o - %s | FileCheck %s 3 4 --- | 5 define i32 @copyprop1(i32 %a, i32 %b) { ret i32 %a } 6 define i32 @copyprop2(i32 %a, i32 %b) { ret i32 %a } 7 define i32 @copyprop3(i32 %a, i32 %b) { ret i32 %a } 8 define i32 @copyprop4(i32 %a, i32 %b) { ret i32 %a } 9 define i32 @copyprop5(i32 %a, i32 %b) { ret i32 %a } 10 define i32 @copyprop6(i32 %a, i32 %b) { ret i32 %a } 11 declare i32 @foo(i32) 12 ... 13 --- 14 # The first copy is dead copy which is not used. 15 # CHECK-LABEL: name: copyprop1 16 # CHECK: bb.0: 17 # CHECK-NOT: $w20 = COPY 18 name: copyprop1 19 body: | 20 bb.0: 21 liveins: $w0, $w1 22 $w20 = COPY $w1 23 BL @foo, csr_aarch64_aapcs, implicit $w0, implicit-def $w0 24 RET_ReallyLR implicit $w0 25 ... 26 --- 27 # The first copy is not a dead copy which is used in the second copy after the 28 # call. 29 # CHECK-LABEL: name: copyprop2 30 # CHECK: bb.0: 31 # CHECK: $w20 = COPY 32 name: copyprop2 33 body: | 34 bb.0: 35 liveins: $w0, $w1 36 $w20 = COPY $w1 37 BL @foo, csr_aarch64_aapcs, implicit $w0, implicit-def $w0 38 $w0 = COPY $w20 39 RET_ReallyLR implicit $w0 40 ... 41 --- 42 # Both the first and second copy are dead copies which are not used. 43 # CHECK-LABEL: name: copyprop3 44 # CHECK: bb.0: 45 # CHECK-NOT: COPY 46 name: copyprop3 47 body: | 48 bb.0: 49 liveins: $w0, $w1 50 $w20 = COPY $w1 51 BL @foo, csr_aarch64_aapcs, implicit $w0, implicit-def $w0 52 $w20 = COPY $w0 53 RET_ReallyLR implicit $w0 54 ... 55 # The second copy is removed as a NOP copy, after then the first copy become 56 # dead which should be removed as well. 57 # CHECK-LABEL: name: copyprop4 58 # CHECK: bb.0: 59 # CHECK-NOT: COPY 60 name: copyprop4 61 body: | 62 bb.0: 63 liveins: $w0, $w1 64 $w20 = COPY $w0 65 $w0 = COPY $w20 66 BL @foo, csr_aarch64_aapcs, implicit $w0, implicit-def $w0 67 RET_ReallyLR implicit $w0 68 ... 69 70 # Don't try to erase any COPY which overlaps itself. 71 # CHECK-LABEL: name: copyprop5 72 # CHECK: bb.0: 73 # CHECK: COPY killed $q26_q27_q28_q29 74 # CHECK: COPY killed $q28_q29_q30_q31 75 name: copyprop5 76 body: | 77 bb.0: 78 liveins: $q26_q27_q28_q29 79 $q28_q29_q30_q31 = COPY killed $q26_q27_q28_q29 80 $q26_q27_q28_q29 = COPY killed $q28_q29_q30_q31 81 BL @foo, csr_aarch64_aapcs, implicit killed $q26_q27_q28_q29 82 RET_ReallyLR 83 ... 84 85 # Don't try to analyze any COPY which overlaps itself. 86 # CHECK-LABEL: name: copyprop6 87 # CHECK: bb.0: 88 # CHECK: COPY killed $q26_q27_q28_q29 89 # CHECK: $q30 = COPY $q28 90 name: copyprop6 91 body: | 92 bb.0: 93 liveins: $q26_q27_q28_q29 94 $q28_q29_q30_q31 = COPY killed $q26_q27_q28_q29 95 $q30 = COPY $q28 96 BL @foo, csr_aarch64_aapcs, implicit killed $q28_q29_q30_q31 97 RET_ReallyLR 98 ... 99 100