1*9880d681SAndroid Build Coastguard Worker 2*9880d681SAndroid Build Coastguard Worker# RUN: llc -mtriple=aarch64-none-linux-gnu -run-pass machine-cp -verify-machineinstrs -o - %s | FileCheck %s 3*9880d681SAndroid Build Coastguard Worker 4*9880d681SAndroid Build Coastguard Worker--- | 5*9880d681SAndroid Build Coastguard Worker define i32 @copyprop1(i32 %a, i32 %b) { ret i32 %a } 6*9880d681SAndroid Build Coastguard Worker define i32 @copyprop2(i32 %a, i32 %b) { ret i32 %a } 7*9880d681SAndroid Build Coastguard Worker define i32 @copyprop3(i32 %a, i32 %b) { ret i32 %a } 8*9880d681SAndroid Build Coastguard Worker define i32 @copyprop4(i32 %a, i32 %b) { ret i32 %a } 9*9880d681SAndroid Build Coastguard Worker declare i32 @foo(i32) 10*9880d681SAndroid Build Coastguard Worker... 11*9880d681SAndroid Build Coastguard Worker--- 12*9880d681SAndroid Build Coastguard Worker# The first copy is dead copy which is not used. 13*9880d681SAndroid Build Coastguard Worker# CHECK-LABEL: name: copyprop1 14*9880d681SAndroid Build Coastguard Worker# CHECK: bb.0: 15*9880d681SAndroid Build Coastguard Worker# CHECK-NOT: %w20 = COPY 16*9880d681SAndroid Build Coastguard Workername: copyprop1 17*9880d681SAndroid Build Coastguard WorkerallVRegsAllocated: true 18*9880d681SAndroid Build Coastguard Workerbody: | 19*9880d681SAndroid Build Coastguard Worker bb.0: 20*9880d681SAndroid Build Coastguard Worker liveins: %w0, %w1 21*9880d681SAndroid Build Coastguard Worker %w20 = COPY %w1 22*9880d681SAndroid Build Coastguard Worker BL @foo, csr_aarch64_aapcs, implicit %w0, implicit-def %w0 23*9880d681SAndroid Build Coastguard Worker RET_ReallyLR implicit %w0 24*9880d681SAndroid Build Coastguard Worker... 25*9880d681SAndroid Build Coastguard Worker--- 26*9880d681SAndroid Build Coastguard Worker# The first copy is not a dead copy which is used in the second copy after the 27*9880d681SAndroid Build Coastguard Worker# call. 28*9880d681SAndroid Build Coastguard Worker# CHECK-LABEL: name: copyprop2 29*9880d681SAndroid Build Coastguard Worker# CHECK: bb.0: 30*9880d681SAndroid Build Coastguard Worker# CHECK: %w20 = COPY 31*9880d681SAndroid Build Coastguard Workername: copyprop2 32*9880d681SAndroid Build Coastguard WorkerallVRegsAllocated: true 33*9880d681SAndroid Build Coastguard Workerbody: | 34*9880d681SAndroid Build Coastguard Worker bb.0: 35*9880d681SAndroid Build Coastguard Worker liveins: %w0, %w1 36*9880d681SAndroid Build Coastguard Worker %w20 = COPY %w1 37*9880d681SAndroid Build Coastguard Worker BL @foo, csr_aarch64_aapcs, implicit %w0, implicit-def %w0 38*9880d681SAndroid Build Coastguard Worker %w0 = COPY %w20 39*9880d681SAndroid Build Coastguard Worker RET_ReallyLR implicit %w0 40*9880d681SAndroid Build Coastguard Worker... 41*9880d681SAndroid Build Coastguard Worker--- 42*9880d681SAndroid Build Coastguard Worker# Both the first and second copy are dead copies which are not used. 43*9880d681SAndroid Build Coastguard Worker# CHECK-LABEL: name: copyprop3 44*9880d681SAndroid Build Coastguard Worker# CHECK: bb.0: 45*9880d681SAndroid Build Coastguard Worker# CHECK-NOT: COPY 46*9880d681SAndroid Build Coastguard Workername: copyprop3 47*9880d681SAndroid Build Coastguard WorkerallVRegsAllocated: true 48*9880d681SAndroid Build Coastguard Workerbody: | 49*9880d681SAndroid Build Coastguard Worker bb.0: 50*9880d681SAndroid Build Coastguard Worker liveins: %w0, %w1 51*9880d681SAndroid Build Coastguard Worker %w20 = COPY %w1 52*9880d681SAndroid Build Coastguard Worker BL @foo, csr_aarch64_aapcs, implicit %w0, implicit-def %w0 53*9880d681SAndroid Build Coastguard Worker %w20 = COPY %w0 54*9880d681SAndroid Build Coastguard Worker RET_ReallyLR implicit %w0 55*9880d681SAndroid Build Coastguard Worker... 56*9880d681SAndroid Build Coastguard Worker# The second copy is removed as a NOP copy, after then the first copy become 57*9880d681SAndroid Build Coastguard Worker# dead which should be removed as well. 58*9880d681SAndroid Build Coastguard Worker# CHECK-LABEL: name: copyprop4 59*9880d681SAndroid Build Coastguard Worker# CHECK: bb.0: 60*9880d681SAndroid Build Coastguard Worker# CHECK-NOT: COPY 61*9880d681SAndroid Build Coastguard Workername: copyprop4 62*9880d681SAndroid Build Coastguard WorkerallVRegsAllocated: true 63*9880d681SAndroid Build Coastguard Workerbody: | 64*9880d681SAndroid Build Coastguard Worker bb.0: 65*9880d681SAndroid Build Coastguard Worker liveins: %w0, %w1 66*9880d681SAndroid Build Coastguard Worker %w20 = COPY %w0 67*9880d681SAndroid Build Coastguard Worker %w0 = COPY %w20 68*9880d681SAndroid Build Coastguard Worker BL @foo, csr_aarch64_aapcs, implicit %w0, implicit-def %w0 69*9880d681SAndroid Build Coastguard Worker RET_ReallyLR implicit %w0 70*9880d681SAndroid Build Coastguard Worker... 71*9880d681SAndroid Build Coastguard Worker 72