[llvm] 69ae441 - ARM: don't try to load function pointer before long call.

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 27 06:00:43 PDT 2022


Author: Tim Northover
Date: 2022-06-27T13:59:35+01:00
New Revision: 69ae441e4ce7422d9514dc5778d2caeeab64b1b0

URL: https://github.com/llvm/llvm-project/commit/69ae441e4ce7422d9514dc5778d2caeeab64b1b0
DIFF: https://github.com/llvm/llvm-project/commit/69ae441e4ce7422d9514dc5778d2caeeab64b1b0.diff

LOG: ARM: don't try to load function pointer before long call.

Deciding to load an arbitrary global based on whether the entire module is
being built for long calls is pretty clearly spurious, and in fact the existing
indirect logic is sufficient.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/ARM/ARMFastISel.cpp b/llvm/lib/Target/ARM/ARMFastISel.cpp
index f42b2a911cbf4..a167225e27430 100644
--- a/llvm/lib/Target/ARM/ARMFastISel.cpp
+++ b/llvm/lib/Target/ARM/ARMFastISel.cpp
@@ -601,8 +601,7 @@ unsigned ARMFastISel::ARMMaterializeGV(const GlobalValue *GV, MVT VT) {
   }
 
   if ((Subtarget->isTargetELF() && Subtarget->isGVInGOT(GV)) ||
-      (Subtarget->isTargetMachO() && IsIndirect) ||
-      Subtarget->genLongCalls()) {
+      (Subtarget->isTargetMachO() && IsIndirect)) {
     MachineInstrBuilder MIB;
     Register NewDestReg = createResultReg(TLI.getRegClassFor(VT));
     if (isThumb2)

diff  --git a/llvm/test/CodeGen/ARM/fast-isel-call.ll b/llvm/test/CodeGen/ARM/fast-isel-call.ll
index d1e5ebc30c254..1c4ef0d7b1c4f 100644
--- a/llvm/test/CodeGen/ARM/fast-isel-call.ll
+++ b/llvm/test/CodeGen/ARM/fast-isel-call.ll
@@ -2,6 +2,7 @@
 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi | FileCheck %s --check-prefix=ARM
 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios | FileCheck %s --check-prefix=THUMB
 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios -mattr=+long-calls | FileCheck %s --check-prefix=ARM-LONG --check-prefix=ARM-LONG-MACHO
+; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=static -mtriple=armv7-apple-ios -mattr=+long-calls | FileCheck %s --check-prefix=ARM-LONG --check-prefix=ARM-LONG-MACHO-STATIC
 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-linux-gnueabi -mattr=+long-calls | FileCheck %s --check-prefix=ARM-LONG --check-prefix=ARM-LONG-ELF
 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=thumbv7-apple-ios -mattr=+long-calls | FileCheck %s --check-prefix=THUMB-LONG
 ; RUN: llc < %s -O0 -verify-machineinstrs -fast-isel-abort=1 -relocation-model=dynamic-no-pic -mtriple=armv7-apple-ios -mattr=-fpregs | FileCheck %s --check-prefix=ARM-NOVFP
@@ -109,9 +110,13 @@ entry:
 ; ARM-LONG-MACHO: {{(movt [[R1]], :upper16:L_bar\$non_lazy_ptr)?}}
 ; ARM-LONG-MACHO: ldr [[R:r[0-9]+]], [[[R1]]]
 
-; ARM-LONG-ELF: movw [[R1:r[0-9]*]], :lower16:bar
-; ARM-LONG-ELF: movt [[R1]], :upper16:bar
-; ARM-LONG-ELF: ldr [[R:r[0-9]+]], [[[R1]]]
+; ARM-LONG-MACHO-STATIC: movw [[R:.*]], :lower16:_bar
+; ARM-LONG-MACHO-STATIC: movt [[R]], :upper16:_bar
+; ARM-LONG-MACHO-STATIC-NOT: ldr{{.*}}[[R]]
+
+; ARM-LONG-ELF: movw [[R:r[0-9]*]], :lower16:bar
+; ARM-LONG-ELF: movt [[R]], :upper16:bar
+; ARM-LONG-ELF-NOT: ldr{{.*}}[[R]]
 
 ; ARM-LONG: blx [[R]]
 ; THUMB-LABEL: @t10


        


More information about the llvm-commits mailing list