mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 18:54:02 +01:00
702277f07f
Replace spills to memory with spills to registers, if possible. This applies mostly to predicate registers (both scalar and vector), since they are very limited in number. A spill of a predicate register may happen even if there is a general-purpose register available. In cases like this the stack spill/reload may be eliminated completely. This optimization will consider all stack objects, regardless of where they came from and try to match the live range of the stack slot with a dead range of a register from an appropriate register class. llvm-svn: 260758
43 lines
1.2 KiB
LLVM
43 lines
1.2 KiB
LLVM
; RUN: llc -march=hexagon -O2 < %s | FileCheck %s
|
|
;
|
|
; This checks that predicate registers are moved to GPRs instead of spilling
|
|
; where possible.
|
|
|
|
; CHECK: p0 =
|
|
; CHECK-NOT: memw(r29
|
|
|
|
define i32 @f(i32 %a, i32 %b, i32 %c, i32 %d, i32 %e) {
|
|
entry:
|
|
%cmp = icmp eq i32 %a, 1
|
|
%cmp1 = icmp eq i32 %b, 2
|
|
%or.cond = and i1 %cmp, %cmp1
|
|
%cmp3 = icmp eq i32 %c, 3
|
|
%or.cond30 = and i1 %or.cond, %cmp3
|
|
%cmp5 = icmp eq i32 %d, 4
|
|
%or.cond31 = and i1 %or.cond30, %cmp5
|
|
%cmp7 = icmp eq i32 %e, 5
|
|
%or.cond32 = and i1 %or.cond31, %cmp7
|
|
%ret.0 = zext i1 %or.cond32 to i32
|
|
%cmp8 = icmp eq i32 %a, 3
|
|
%cmp10 = icmp eq i32 %b, 4
|
|
%or.cond33 = and i1 %cmp8, %cmp10
|
|
%cmp12 = icmp eq i32 %c, 5
|
|
%or.cond34 = and i1 %or.cond33, %cmp12
|
|
%cmp14 = icmp eq i32 %d, 6
|
|
%or.cond35 = and i1 %or.cond34, %cmp14
|
|
%cmp16 = icmp eq i32 %e, 7
|
|
%or.cond36 = and i1 %or.cond35, %cmp16
|
|
%ret.1 = select i1 %or.cond36, i32 2, i32 %ret.0
|
|
%cmp21 = icmp eq i32 %b, 8
|
|
%or.cond37 = and i1 %cmp, %cmp21
|
|
%cmp23 = icmp eq i32 %c, 2
|
|
%or.cond38 = and i1 %or.cond37, %cmp23
|
|
%cmp25 = icmp eq i32 %d, 1
|
|
%or.cond39 = and i1 %or.cond38, %cmp25
|
|
%cmp27 = icmp eq i32 %e, 3
|
|
%or.cond40 = and i1 %or.cond39, %cmp27
|
|
%ret.2 = select i1 %or.cond40, i32 3, i32 %ret.1
|
|
ret i32 %ret.2
|
|
}
|
|
|