mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-30 02:32:08 +00:00
6ea2b9608a
Also avoid locals evicting locals just because they want a cheaper register. Problem: MI Sched knows exactly how many registers we have and assumes they can be colored. In cases where we have large blocks, usually from unrolled loops, greedy coloring fails. This is a source of "regressions" from the MI Scheduler on x86. I noticed this issue on x86 where we have long chains of two-address defs in the same live range. It's easy to see this in matrix multiplication benchmarks like IRSmk and even the unit test misched-matmul.ll. A fundamental difference between the LLVM register allocator and conventional graph coloring is that in our model a live range can't discover its neighbors, it can only verify its neighbors. That's why we initially went for greedy coloring and added eviction to deal with the hard cases. However, for singly defined and two-address live ranges, we can optimally color without visiting neighbors simply by processing the live ranges in instruction order. Other beneficial side effects: It is much easier to understand and debug regalloc for large blocks when the live ranges are allocated in order. Yes, global allocation is still very confusing, but it's nice to be able to comprehend what happened locally. Heuristics could be added to bias register assignment based on instruction locality (think late register pairing, banks...). Intuituvely this will make some test cases that are on the threshold of register pressure more stable. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187139 91177308-0d34-0410-b5e6-96231b3b80d8
80 lines
1.7 KiB
LLVM
80 lines
1.7 KiB
LLVM
; RUN: llc < %s -march=arm -mcpu=cortex-a8 -mattr=+vfp2 -enable-unsafe-fp-math | FileCheck %s
|
|
; rdar://7461510
|
|
; rdar://10964603
|
|
|
|
; Disable this optimization unless we know one of them is zero.
|
|
define arm_apcscc i32 @t1(float* %a, float* %b) nounwind {
|
|
entry:
|
|
; CHECK-LABEL: t1:
|
|
; CHECK: vldr [[S0:s[0-9]+]],
|
|
; CHECK: vldr [[S1:s[0-9]+]],
|
|
; CHECK: vcmpe.f32 [[S1]], [[S0]]
|
|
; CHECK: vmrs APSR_nzcv, fpscr
|
|
; CHECK: beq
|
|
%0 = load float* %a
|
|
%1 = load float* %b
|
|
%2 = fcmp une float %0, %1
|
|
br i1 %2, label %bb1, label %bb2
|
|
|
|
bb1:
|
|
%3 = call i32 @bar()
|
|
ret i32 %3
|
|
|
|
bb2:
|
|
%4 = call i32 @foo()
|
|
ret i32 %4
|
|
}
|
|
|
|
; If one side is zero, the other size sign bit is masked off to allow
|
|
; +0.0 == -0.0
|
|
define arm_apcscc i32 @t2(double* %a, double* %b) nounwind {
|
|
entry:
|
|
; CHECK-LABEL: t2:
|
|
; CHECK-NOT: vldr
|
|
; CHECK: ldrd [[REG1:(r[0-9]+)]], [[REG2:(r[0-9]+)]], [r0]
|
|
; CHECK-NOT: b LBB
|
|
; CHECK: bfc [[REG2]], #31, #1
|
|
; CHECK: cmp [[REG1]], #0
|
|
; CHECK: cmpeq [[REG2]], #0
|
|
; CHECK-NOT: vcmpe.f32
|
|
; CHECK-NOT: vmrs
|
|
; CHECK: bne
|
|
%0 = load double* %a
|
|
%1 = fcmp oeq double %0, 0.000000e+00
|
|
br i1 %1, label %bb1, label %bb2
|
|
|
|
bb1:
|
|
%2 = call i32 @bar()
|
|
ret i32 %2
|
|
|
|
bb2:
|
|
%3 = call i32 @foo()
|
|
ret i32 %3
|
|
}
|
|
|
|
define arm_apcscc i32 @t3(float* %a, float* %b) nounwind {
|
|
entry:
|
|
; CHECK-LABEL: t3:
|
|
; CHECK-NOT: vldr
|
|
; CHECK: ldr [[REG3:(r[0-9]+)]], [r0]
|
|
; CHECK: mvn [[REG4:(r[0-9]+)]], #-2147483648
|
|
; CHECK: tst [[REG3]], [[REG4]]
|
|
; CHECK-NOT: vcmpe.f32
|
|
; CHECK-NOT: vmrs
|
|
; CHECK: bne
|
|
%0 = load float* %a
|
|
%1 = fcmp oeq float %0, 0.000000e+00
|
|
br i1 %1, label %bb1, label %bb2
|
|
|
|
bb1:
|
|
%2 = call i32 @bar()
|
|
ret i32 %2
|
|
|
|
bb2:
|
|
%3 = call i32 @foo()
|
|
ret i32 %3
|
|
}
|
|
|
|
declare i32 @bar()
|
|
declare i32 @foo()
|