[llvm] r271437 - Avoid a load for local functions.

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 1 14:57:11 PDT 2016


Author: rafael
Date: Wed Jun  1 16:57:11 2016
New Revision: 271437

URL: http://llvm.org/viewvc/llvm-project?rev=271437&view=rev
Log:
Avoid a load for local functions.

Added:
    llvm/trunk/test/CodeGen/ARM/thumb-stub.ll
Modified:
    llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp

Modified: llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp?rev=271437&r1=271436&r2=271437&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/ARM/ARMISelLowering.cpp Wed Jun  1 16:57:11 2016
@@ -1844,8 +1844,13 @@ ARMTargetLowering::LowerCall(TargetLower
     const GlobalValue *GV = G->getGlobal();
     isDirect = true;
     bool isDef = GV->isStrongDefinitionForLinker();
-    bool isStub = (!isDef && Subtarget->isTargetMachO()) &&
-                   getTargetMachine().getRelocationModel() != Reloc::Static;
+    const TargetMachine &TM = getTargetMachine();
+    Reloc::Model RM = TM.getRelocationModel();
+    const Triple &TargetTriple = TM.getTargetTriple();
+    bool isStub =
+        !shouldAssumeDSOLocal(RM, TargetTriple, *GV->getParent(), GV) &&
+        Subtarget->isTargetMachO();
+
     isARMFunc = !Subtarget->isThumb() || (isStub && !Subtarget->isMClass());
     // ARM call to a local ARM function is predicable.
     isLocalARMFunc = !Subtarget->isThumb() && (isDef || !ARMInterworking);

Added: llvm/trunk/test/CodeGen/ARM/thumb-stub.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/ARM/thumb-stub.ll?rev=271437&view=auto
==============================================================================
--- llvm/trunk/test/CodeGen/ARM/thumb-stub.ll (added)
+++ llvm/trunk/test/CodeGen/ARM/thumb-stub.ll Wed Jun  1 16:57:11 2016
@@ -0,0 +1,10 @@
+; RUN: llc  -relocation-model=pic -mtriple=thumb-apple-darwin < %s | FileCheck %s
+
+declare hidden void @f()
+
+; CHECK: bl _f
+
+define void @g() {
+  call void @f()
+  ret void
+}




More information about the llvm-commits mailing list