mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-01 07:30:31 +00:00
CodeGen: enable mov.w/mov.t pairs with minsize for WoA
Windows on ARM uses COFF/PE which is intrinsically position independent. For the case of 32-bit immediates, use a pair-wise relocation as otherwise we may exceed the range of operators. This fixes a code generation crash when using -Oz when targeting Windows on ARM. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@210814 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
a15b05e1aa
commit
3455c40f91
@ -379,7 +379,12 @@ public:
|
||||
|
||||
bool isR9Reserved() const { return IsR9Reserved; }
|
||||
|
||||
bool useMovt() const { return UseMovt && !isMinSize(); }
|
||||
bool useMovt() const {
|
||||
// NOTE Windows on ARM needs to use mov.w/mov.t pairs to materialise 32-bit
|
||||
// immediates as it is inherently position independent, and may be out of
|
||||
// range otherwise.
|
||||
return UseMovt && (isTargetWindows() || !isMinSize());
|
||||
}
|
||||
bool supportsTailCall() const { return SupportsTailCall; }
|
||||
|
||||
bool allowsUnalignedMem() const { return AllowsUnalignedMem; }
|
||||
|
16
test/CodeGen/ARM/Windows/global-minsize.ll
Normal file
16
test/CodeGen/ARM/Windows/global-minsize.ll
Normal file
@ -0,0 +1,16 @@
|
||||
; RUN: llc -mtriple=thumbv7-windows -filetype asm -o - %s | FileCheck %s
|
||||
|
||||
@i = internal global i32 0, align 4
|
||||
|
||||
; Function Attrs: minsize
|
||||
define arm_aapcs_vfpcc i32* @function() #0 {
|
||||
entry:
|
||||
ret i32* @i
|
||||
}
|
||||
|
||||
attributes #0 = { minsize }
|
||||
|
||||
; CHECK: function:
|
||||
; CHECK: movw r0, :lower16:i
|
||||
; CHECK: movt r0, :upper16:i
|
||||
; CHECK: bx lr
|
Loading…
Reference in New Issue
Block a user