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
27 lines
837 B
LLVM
27 lines
837 B
LLVM
; RUN: llc < %s -march=avr | FileCheck %s
|
|
|
|
define i8 @count_population(i8) unnamed_addr {
|
|
entry-block:
|
|
%1 = tail call i8 @llvm.ctpop.i8(i8 %0)
|
|
ret i8 %1
|
|
}
|
|
|
|
declare i8 @llvm.ctpop.i8(i8)
|
|
|
|
; CHECK-LABEL: count_population:
|
|
; CHECK: mov [[SCRATCH:r[0-9]+]], [[RESULT:r[0-9]+]]
|
|
; CHECK: lsr {{.*}}[[SCRATCH]]
|
|
; CHECK: andi {{.*}}[[SCRATCH]], 85
|
|
; CHECK: sub {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
|
; CHECK: mov {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
|
|
; CHECK: andi {{.*}}[[SCRATCH]], 51
|
|
; CHECK: lsr {{.*}}[[RESULT]]
|
|
; CHECK: lsr {{.*}}[[RESULT]]
|
|
; CHECK: andi {{.*}}[[RESULT]], 51
|
|
; CHECK: add {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
|
; CHECK: mov {{.*}}[[SCRATCH]], {{.*}}[[RESULT]]
|
|
; CHECK: swap {{.*}}[[SCRATCH]]
|
|
; CHECK: add {{.*}}[[RESULT]], {{.*}}[[SCRATCH]]
|
|
; CHECK: andi {{.*}}[[RESULT]], 15
|
|
; CHECK: ret
|