This patch contains following enhancements to SrcRegMap and DstRegMap:
1 In findOnlyInterestingUse not only check if the Reg is two address usage,
but also check after commutation can it be two address usage.
2 If a physical register is clobbered, remove SrcRegMap entries that are
mapped to it.
3 In processTiedPairs, when create a new COPY instruction, add a SrcRegMap
entry only when the COPY instruction is coalescable. (The COPY src is
killed)
With these enhancements isProfitableToCommute can do better commute decision,
and finally more register copies are removed.
Differential Revision: https://reviews.llvm.org/D108731
60 lines
1.8 KiB
LLVM
60 lines
1.8 KiB
LLVM
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=skx | FileCheck %s --check-prefixes=CHECK,FAST-INCDEC
|
|
; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mcpu=goldmont | FileCheck %s --check-prefixes=CHECK,SLOW-INCDEC
|
|
|
|
define i64 @imm1_Oz(i32 %x, i32 %y) minsize nounwind {
|
|
; CHECK-LABEL: imm1_Oz:
|
|
; CHECK: # %bb.0:
|
|
; CHECK: incl %edi
|
|
; CHECK-NEXT: leal 1(%rsi), %eax
|
|
; CHECK-NEXT: addq %rdi, %rax
|
|
; CHECK-NEXT: retq
|
|
%x1 = add i32 %x, 1
|
|
%y1 = add i32 %y, 1
|
|
%x1z = zext i32 %x1 to i64
|
|
%y1z = zext i32 %y1 to i64
|
|
%r = add i64 %x1z, %y1z
|
|
ret i64 %r
|
|
}
|
|
|
|
define i64 @imm1_Os(i32 %x, i32 %y) optsize nounwind {
|
|
; CHECK-LABEL: imm1_Os:
|
|
; CHECK: # %bb.0:
|
|
; CHECK: incl %edi
|
|
; CHECK-NEXT: leal 1(%rsi), %eax
|
|
; CHECK-NEXT: addq %rdi, %rax
|
|
; CHECK-NEXT: retq
|
|
%x1 = add i32 %x, 1
|
|
%y1 = add i32 %y, 1
|
|
%x1z = zext i32 %x1 to i64
|
|
%y1z = zext i32 %y1 to i64
|
|
%r = add i64 %x1z, %y1z
|
|
ret i64 %r
|
|
}
|
|
|
|
define i64 @imm1_O2(i32 %x, i32 %y) nounwind {
|
|
; FAST-INCDEC-LABEL: imm1_O2:
|
|
; FAST-INCDEC: # %bb.0:
|
|
; FAST-INCDEC-NEXT: # kill: def $esi killed $esi def $rsi
|
|
; FAST-INCDEC-NEXT: # kill: def $edi killed $edi def $rdi
|
|
; FAST-INCDEC-NEXT: incl %edi
|
|
; FAST-INCDEC-NEXT: leal 1(%rsi), %eax
|
|
; FAST-INCDEC-NEXT: addq %rdi, %rax
|
|
; FAST-INCDEC-NEXT: retq
|
|
;
|
|
; SLOW-INCDEC-LABEL: imm1_O2:
|
|
; SLOW-INCDEC: # %bb.0:
|
|
; SLOW-INCDEC-NEXT: # kill: def $edi killed $edi def $rdi
|
|
; SLOW-INCDEC-NEXT: # kill: def $esi killed $esi def $rsi
|
|
; SLOW-INCDEC-NEXT: addl $1, %edi
|
|
; SLOW-INCDEC-NEXT: leal 1(%rsi), %eax
|
|
; SLOW-INCDEC-NEXT: addq %rdi, %rax
|
|
; SLOW-INCDEC-NEXT: retq
|
|
%x1 = add i32 %x, 1
|
|
%y1 = add i32 %y, 1
|
|
%x1z = zext i32 %x1 to i64
|
|
%y1z = zext i32 %y1 to i64
|
|
%r = add i64 %x1z, %y1z
|
|
ret i64 %r
|
|
}
|