Changeset View
Changeset View
Standalone View
Standalone View
llvm/test/CodeGen/Mips/avoid-zero-copy.mir
# Check that we can remove the redundant save of constant registers such as $zero | # Check that we can remove the redundant save of constant registers such as $zero | ||||
# RUN: llc -mtriple=mips64-unknown-freebsd %s -start-before=machine-cp -o - | FileCheck %s --check-prefix ASM | # RUN: llc -mtriple=mips64-unknown-freebsd %s -start-before=machine-cp -o - | FileCheck %s --check-prefix ASM | ||||
# RUN: llc -mtriple=mips64-unknown-freebsd %s -verify-machineinstrs -run-pass=machine-cp -o - | FileCheck %s | # RUN: llc -mtriple=mips64-unknown-freebsd %s -verify-machineinstrs -run-pass=machine-cp -o - | FileCheck %s | ||||
--- | | --- | | ||||
target triple = "mips64-unknown-freebsd" | target triple = "mips64-unknown-freebsd" | ||||
define i32 @a() nounwind { | define i32 @a() nounwind { | ||||
; ASM-LABEL: a: | ; ASM-LABEL: a: | ||||
; ASM: # %bb.0: | ; ASM: # %bb.0: | ||||
; ASM-NEXT: daddiu $sp, $sp, -16 | ; ASM-NEXT: daddiu $sp, $sp, -16 | ||||
; ASM-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill | ; ASM-NEXT: sd $ra, 8($sp) # 8-byte Folded Spill | ||||
; ASM-NEXT: sd $16, 0($sp) # 8-byte Folded Spill | |||||
; ASM-NEXT: move $16, $zero | |||||
; ASM-NEXT: jalr $25 | ; ASM-NEXT: jalr $25 | ||||
; ASM-NEXT: move $4, $zero | ; ASM-NEXT: move $4, $zero | ||||
; ASM-NEXT: move $4, $16 | ; ASM-NEXT: move $4, $zero | ||||
luismarques: Redundant move | |||||
The previous one is in the delay-slot, so it's actually setting the argument register a0. arichardson: The previous one is in the delay-slot, so it's actually setting the argument register a0. | |||||
Not Done ReplyInline ActionsOops, ignore this. luismarques: Oops, ignore this. | |||||
; ASM-NEXT: ld $16, 0($sp) # 8-byte Folded Reload | |||||
; ASM-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload | ; ASM-NEXT: ld $ra, 8($sp) # 8-byte Folded Reload | ||||
; ASM-NEXT: jr $ra | ; ASM-NEXT: jr $ra | ||||
; ASM-NEXT: daddiu $sp, $sp, 16 | ; ASM-NEXT: daddiu $sp, $sp, 16 | ||||
ret i32 0 | ret i32 0 | ||||
} | } | ||||
... | ... | ||||
--- | --- | ||||
name: a | name: a | ||||
body: | | body: | | ||||
bb.0 (%ir-block.0): | bb.0 (%ir-block.0): | ||||
liveins: $a0_64, $t9_64, $ra_64, $fp_64, $gp_64 | liveins: $a0_64, $t9_64, $ra_64, $fp_64, $gp_64 | ||||
; CHECK-LABEL: name: a | ; CHECK-LABEL: name: a | ||||
; CHECK: liveins: $a0_64, $t9_64, $ra_64, $fp_64, $gp_64 | ; CHECK: liveins: $a0_64, $t9_64, $ra_64, $fp_64, $gp_64 | ||||
; CHECK-NEXT: {{ $}} | ; CHECK-NEXT: {{ $}} | ||||
; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp | ; CHECK-NEXT: ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp | ||||
; CHECK-NEXT: renamable $s0_64 = COPY $zero_64 | |||||
; CHECK-NEXT: $a0_64 = COPY $zero_64 | ; CHECK-NEXT: $a0_64 = COPY $zero_64 | ||||
; CHECK-NEXT: JALR64Pseudo $t9_64, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0 | ; CHECK-NEXT: JALR64Pseudo $t9_64, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0 | ||||
; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp | ; CHECK-NEXT: ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp | ||||
; CHECK-NEXT: $a0_64 = COPY killed renamable $s0_64 | ; CHECK-NEXT: $a0_64 = COPY $zero_64 | ||||
; CHECK-NEXT: PseudoReturn64 undef $ra_64, implicit $v0_64, implicit killed $a0_64 | ; CHECK-NEXT: PseudoReturn64 undef $ra_64, implicit $v0_64, implicit killed $a0_64 | ||||
ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp | ADJCALLSTACKDOWN 0, 0, implicit-def dead $sp, implicit $sp | ||||
renamable $s0_64 = COPY $zero_64 | renamable $s0_64 = COPY $zero_64 | ||||
$a0_64 = COPY renamable $s0_64 | $a0_64 = COPY renamable $s0_64 | ||||
JALR64Pseudo $t9_64, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0 | JALR64Pseudo $t9_64, csr_n64, implicit-def dead $ra, implicit $a0_64, implicit $gp_64, implicit-def $sp, implicit-def $v0 | ||||
ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp | ADJCALLSTACKUP 0, 0, implicit-def dead $sp, implicit $sp | ||||
$a0_64 = COPY killed renamable $s0_64 | $a0_64 = COPY killed renamable $s0_64 | ||||
PseudoReturn64 undef $ra_64, implicit $v0_64, implicit killed $a0_64 | PseudoReturn64 undef $ra_64, implicit $v0_64, implicit killed $a0_64 | ||||
... | ... |
Redundant move