1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00
llvm-mirror/test/CodeGen/Thumb/litpoolremat.ll
Sam Parker 7f44c8f183 [ARM] Allow rematerialization of ARM Thumb literal pool loads
Constants are crucial for code size in the ARM Thumb-1 instruction
set. The 16 bit instruction size often does not offer enough space
for immediate arguments. This means that additional instructions are
frequently used to load constants into registers. Since constants are
hoisted, this can lead to significant register spillage if they are
used multiple times in a single function. This can be avoided by
rematerialization, i.e. recomputing a constant instead of reloading
it from the stack. This patch fixes the rematerialization of literal
pool loads in the ARM Thumb instruction set.

Patch by Philip Ginsbach

Differential Revision: https://reviews.llvm.org/D33936

llvm-svn: 308004
2017-07-14 08:23:56 +00:00

29 lines
814 B
LLVM

; RUN: llc < %s -mtriple=thumb-apple-darwin | FileCheck %s
declare void @consume_value(i32) #1
declare i32 @get_value(...) #1
declare void @consume_three_values(i32, i32, i32) #1
; Function Attrs: nounwind uwtable
define void @should_not_spill() #0 {
tail call void @consume_value(i32 1764) #2
%1 = tail call i32 (...) @get_value() #2
%2 = tail call i32 (...) @get_value() #2
%3 = tail call i32 (...) @get_value() #2
tail call void @consume_value(i32 %1) #2
tail call void @consume_value(i32 %2) #2
tail call void @consume_value(i32 %3) #2
tail call void @consume_value(i32 1764) #2
tail call void @consume_three_values(i32 %1, i32 %2, i32 %3) #2
ret void
}
; CHECK: ldr r0, LCPI0_0
; CHECK-NOT: str r0
; CHECK: bl
; CHECK: ldr r0, LCPI0_0
; CHECK-LABEL: LCPI0_0:
; CHECK-NEXT: .long 1764