summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp9
-rw-r--r--llvm/test/CodeGen/ARM/thumb-stub.ll10
2 files changed, 17 insertions, 2 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index ef7304dafd3..c88cd50f3a1 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -1844,8 +1844,13 @@ ARMTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
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);
diff --git a/llvm/test/CodeGen/ARM/thumb-stub.ll b/llvm/test/CodeGen/ARM/thumb-stub.ll
new file mode 100644
index 00000000000..68001b6c0ee
--- /dev/null
+++ b/llvm/test/CodeGen/ARM/thumb-stub.ll
@@ -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
+}
OpenPOWER on IntegriCloud