summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2016-06-20 17:45:33 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2016-06-20 17:45:33 +0000
commit959e9c8d01dafcf45a7020fb97bbed61a149f084 (patch)
tree900f276d64cd77627afac9aea3d31289b6076017
parent535089426555f15d891a1898dcfecc1c83e54084 (diff)
downloadbcm5719-llvm-959e9c8d01dafcf45a7020fb97bbed61a149f084.tar.gz
bcm5719-llvm-959e9c8d01dafcf45a7020fb97bbed61a149f084.zip
Use shouldAssumeDSOLocal.
With this ARM fast isel knows that PIE variable are not preemptable. llvm-svn: 273169
-rw-r--r--llvm/lib/Target/ARM/ARMFastISel.cpp4
-rw-r--r--llvm/test/CodeGen/ARM/fast-isel-pie.ll19
2 files changed, 22 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp
index 01a59971117..cbd96a72e07 100644
--- a/llvm/lib/Target/ARM/ARMFastISel.cpp
+++ b/llvm/lib/Target/ARM/ARMFastISel.cpp
@@ -2967,8 +2967,10 @@ bool ARMFastISel::tryToFoldLoadIntoMI(MachineInstr *MI, unsigned OpNo,
unsigned ARMFastISel::ARMLowerPICELF(const GlobalValue *GV,
unsigned Align, MVT VT) {
+ Reloc::Model RM = TM.getRelocationModel();
+ const Triple &TargetTriple = TM.getTargetTriple();
bool UseGOT_PREL =
- !(GV->hasHiddenVisibility() || GV->hasLocalLinkage());
+ !shouldAssumeDSOLocal(RM, TargetTriple, *GV->getParent(), GV);
LLVMContext *Context = &MF->getFunction()->getContext();
unsigned ARMPCLabelIndex = AFI->createPICLabelUId();
diff --git a/llvm/test/CodeGen/ARM/fast-isel-pie.ll b/llvm/test/CodeGen/ARM/fast-isel-pie.ll
new file mode 100644
index 00000000000..23a88bdaa22
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/fast-isel-pie.ll
@@ -0,0 +1,19 @@
+; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=pic -mtriple=armv7-pc-linux-gnueabi | FileCheck %s
+
+@var = global i32 42
+
+define i32* @foo() {
+; CHECK: foo:
+; CHECK: ldr r0, .L[[POOL:.*]]
+; CHECK-NEXT: .L[[ADDR:.*]]:
+; CHECK-NEXT: add r0, pc, r0
+; CHECK-NEXT: bx lr
+
+; CHECK: .L[[POOL]]:
+; CHECK-NEXT: .long var-(.L[[ADDR]]+8)
+
+ ret i32* @var
+}
+
+!llvm.module.flags = !{!0}
+!0 = !{i32 1, !"PIE Level", i32 2}
OpenPOWER on IntegriCloud