[llvm] r273169 - Use shouldAssumeDSOLocal.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 20 10:45:33 PDT 2016


Author: rafael
Date: Mon Jun 20 12:45:33 2016
New Revision: 273169

URL: http://llvm.org/viewvc/llvm-project?rev=273169&view=rev
Log:
Use shouldAssumeDSOLocal.

With this ARM fast isel knows that PIE variable are not preemptable.

Added:
    llvm/trunk/test/CodeGen/ARM/fast-isel-pie.ll
Modified:
    llvm/trunk/lib/Target/ARM/ARMFastISel.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMFastISel.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMFastISel.cpp?rev=273169&r1=273168&r2=273169&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMFastISel.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMFastISel.cpp Mon Jun 20 12:45:33 2016
@@ -2967,8 +2967,10 @@ bool ARMFastISel::tryToFoldLoadIntoMI(Ma
 
 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();

Added: llvm/trunk/test/CodeGen/ARM/fast-isel-pie.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/fast-isel-pie.ll?rev=273169&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/fast-isel-pie.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/fast-isel-pie.ll Mon Jun 20 12:45:33 2016
@@ -0,0 +1,19 @@
+; RUN: llc < %s -O0 -fast-isel-abort=1 -relocation-model=pic -mtriple=armv7-pc-linux-gnueabi | FileCheck %s
+
+ at 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}




More information about the llvm-commits mailing list