1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2025-01-31 20:51:52 +01:00
llvm-mirror/test/CodeGen/ARM/favor-low-reg-for-Osize.ll
Oliver Stannard e6ef9c7af1 [ARM] Thumb2: favor R4-R7 over R12/LR in allocation order when opt for minsize
For Thumb2, we prefer low regs (costPerUse = 0) to allow narrow
encoding. However, current allocation order is like:
  R0-R3, R12, LR, R4-R11

As a result, a lot of instructs that use R12/LR will be wide instrs.

This patch changes the allocation order to:
  R0-R7, R12, LR, R8-R11
for thumb2 and -Osize.

In most cases, there is no extra push/pop instrs as they will be folded
into existing ones. There might be slight performance impact due to more
stack usage, so we only enable it when opt for min size.

https://reviews.llvm.org/D30324

llvm-svn: 365014
2019-07-03 09:58:52 +00:00

30 lines
887 B
LLVM

; REQUIRES: asserts
; RUN: llc -debug-only=regalloc < %s 2>%t | FileCheck %s --check-prefix=CHECK
; RUN: FileCheck %s < %t --check-prefix=DEBUG
target datalayout = "e-m:e-p:32:32-i64:64-v128:64:128-a:0:32-n8:16:32-S64"
target triple = "thumbv7m--linux-gnueabi"
; DEBUG: AllocationOrder(GPR) = [ $r0 $r1 $r2 $r3 $r4 $r5 $r6 $r7 $r12 $lr $r8 $r9 $r10 $r11 ]
define i32 @test_minsize(i32 %x) optsize minsize {
; CHECK-LABEL: test_minsize:
entry:
; CHECK: mov r4, r0
tail call void asm sideeffect "", "~{r0},~{r1},~{r2},~{r3}"()
; CHECK: mov r0, r4
ret i32 %x
}
; DEBUG: AllocationOrder(GPR) = [ $r0 $r1 $r2 $r3 $r12 $lr $r4 $r5 $r6 $r7 $r8 $r9 $r10 $r11 ]
define i32 @test_optsize(i32 %x) optsize {
; CHECK-LABEL: test_optsize:
entry:
; CHECK: mov r12, r0
tail call void asm sideeffect "", "~{r0},~{r1},~{r2},~{r3}"()
; CHECK: mov r0, r12
ret i32 %x
}