43 lines · plain
1# Check that we can remove the redundant save of constant registers such as $wzr2# RUN: llc -mtriple=aarch64-unknown-linux %s -verify-machineinstrs -start-before=machine-cp -o - | FileCheck %s --check-prefix ASM3# RUN: llc -mtriple=aarch64-unknown-linux %s -verify-machineinstrs -run-pass=machine-cp -o - | FileCheck %s4 5# RUN: llc -mtriple=aarch64-unknown-linux %s -passes=machine-cp -o - | FileCheck %s6--- |7 target triple = "aarch64-unknown-linux"8 declare i32 @bar(i32) nounwind9 define i32 @foo() nounwind {10 ; ASM-LABEL: foo:11 ; ASM: // %bb.0:12 ; ASM-NEXT: str x30, [sp, #-16]! // 8-byte Folded Spill13 ; ASM-NEXT: mov w0, wzr14 ; ASM-NEXT: bl bar15 ; ASM-NEXT: mov w0, wzr16 ; ASM-NEXT: ldr x30, [sp], #16 // 8-byte Folded Reload17 ; ASM-NEXT: ret18 call i32 @bar(i32 0)19 ret i32 020 }21...22---23name: foo24frameInfo:25 adjustsStack: true26body: |27 bb.0 (%ir-block.0):28 ; CHECK-LABEL: name: foo29 ; CHECK: ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp30 ; CHECK-NEXT: $w0 = COPY $wzr31 ; CHECK-NEXT: BL @bar, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $w0, implicit-def $sp, implicit-def $w032 ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp33 ; CHECK-NEXT: $w0 = COPY $wzr34 ; CHECK-NEXT: RET_ReallyLR implicit $w035 ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp36 renamable $w19 = COPY $wzr37 $w0 = COPY renamable $w1938 BL @bar, csr_aarch64_aapcs, implicit-def dead $lr, implicit $sp, implicit $w0, implicit-def $sp, implicit-def $w039 ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp40 $w0 = COPY killed renamable $w1941 RET_ReallyLR implicit $w042...43