[PATCH] Re-enable movw/movt on iOS static platforms
Tim Northover
t.p.northover at gmail.com
Fri Nov 22 05:44:12 PST 2013
Hi all (well, mostly Apple people),
There's a bit of code to generate movw/movt for static Darwin targets
that's been dead in ARMISelLowering since 2011, and I think it's time
we did something about it.
Apparently some tools didn't like the static movw/movt relocations,
but I believe those issues are now no longer relevant
(rdar://problem/9514789). For uniformity I'd quite like to re-enable
it, though removing it completely is another option.
The patch re-enables it.
OK to commit?
Cheers.
Tim.
-------------- next part --------------
diff --git a/lib/Target/ARM/ARMFastISel.cpp b/lib/Target/ARM/ARMFastISel.cpp
index a4004f3..271b9d4 100644
--- a/lib/Target/ARM/ARMFastISel.cpp
+++ b/lib/Target/ARM/ARMFastISel.cpp
@@ -683,7 +683,7 @@ unsigned ARMFastISel::ARMMaterializeGV(const GlobalValue *GV, MVT VT) {
// ARMTargetLowering::LowerGlobalAddressDarwin. Other targets only support
// static movt relocations.
if (Subtarget->useMovt() &&
- Subtarget->isTargetDarwin() == (RelocM != Reloc::Static)) {
+ (Subtarget->isTargetDarwin() || RelocM == Reloc::Static)) {
unsigned Opc;
switch (RelocM) {
case Reloc::PIC_:
diff --git a/lib/Target/ARM/ARMISelLowering.cpp b/lib/Target/ARM/ARMISelLowering.cpp
index 76a0a83..689187e 100644
--- a/lib/Target/ARM/ARMISelLowering.cpp
+++ b/lib/Target/ARM/ARMISelLowering.cpp
@@ -2540,7 +2540,7 @@ SDValue ARMTargetLowering::LowerGlobalAddressDarwin(SDValue Op,
// FIXME: Enable this for static codegen when tool issues are fixed. Also
// update ARMFastISel::ARMMaterializeGV.
- if (Subtarget->useMovt() && RelocM != Reloc::Static) {
+ if (Subtarget->useMovt()) {
++NumMovwMovt;
// FIXME: Once remat is capable of dealing with instructions with register
// operands, expand this into two nodes.
diff --git a/test/CodeGen/ARM/movt-movw-global.ll b/test/CodeGen/ARM/movt-movw-global.ll
index bbedea1..1e10af1 100644
--- a/test/CodeGen/ARM/movt-movw-global.ll
+++ b/test/CodeGen/ARM/movt-movw-global.ll
@@ -16,8 +16,8 @@ entry:
; IOS-PIC: movw r0, :lower16:(L_foo$non_lazy_ptr-(LPC0_0+8))
; IOS-PIC-NEXT: movt r0, :upper16:(L_foo$non_lazy_ptr-(LPC0_0+8))
-; IOS-STATIC-NOT: movw r0, :lower16:_foo
-; IOS-STATIC-NOT: movt r0, :upper16:_foo
+; IOS-STATIC: movw r0, :lower16:_foo
+; IOS-STATIC-NEXT: movt r0, :upper16:_foo
ret i32* @foo
}
@@ -32,8 +32,8 @@ entry:
; IOS-PIC: movw r1, :lower16:(L_foo$non_lazy_ptr-(LPC1_0+8))
; IOS-PIC-NEXT: movt r1, :upper16:(L_foo$non_lazy_ptr-(LPC1_0+8))
-; IOS-STATIC-NOT: movw r1, :lower16:_foo
-; IOS-STATIC-NOT: movt r1, :upper16:_foo
+; IOS-STATIC: movw r1, :lower16:_foo
+; IOS-STATIC-NEXT: movt r1, :upper16:_foo
store i32 %baz, i32* @foo, align 4
ret void
}
More information about the llvm-commits
mailing list