UseAddressTopByteIgnored("aarch64-use-tbi", cl::desc("Assume that top byte of "
"an address is ignored"), cl::init(false), cl::Hidden);
+static cl::opt<bool>
+ UseNonLazyBind("aarch64-enable-nonlazybind",
+ cl::desc("Call nonlazybind functions via direct GOT load"),
+ cl::init(false), cl::Hidden);
+
AArch64Subtarget &
AArch64Subtarget::initializeSubtargetDependencies(StringRef FS,
StringRef CPUString) {
// NonLazyBind goes via GOT unless we know it's available locally.
auto *F = dyn_cast<Function>(GV);
- if (F && F->hasFnAttribute(Attribute::NonLazyBind) &&
+ if (UseNonLazyBind && F && F->hasFnAttribute(Attribute::NonLazyBind) &&
!TM.shouldAssumeDSOLocal(*GV->getParent(), GV))
return AArch64II::MO_GOT;
-; RUN: llc -mtriple=aarch64-apple-ios %s -o - | FileCheck %s
+; RUN: llc -mtriple=aarch64-apple-ios %s -o - -aarch64-enable-nonlazybind | FileCheck %s
+; RUN: llc -mtriple=aarch64-apple-ios %s -o - | FileCheck %s --check-prefix=CHECK-NORMAL
define void @local() nonlazybind {
ret void
; CHECK: ldr [[FUNC:x[0-9]+]], [x[[TMP]], _nonlocal@GOTPAGEOFF]
; CHECK: blr [[FUNC]]
+; CHECK-NORMAL-LABEL: test_laziness:
+; CHECK-NORMAL: bl _local
+; CHEKC-NORMAL: bl _nonlocal
+
call void @local()
call void @nonlocal()
ret void
; CHECK: ldr [[FUNC:x[0-9]+]], [x[[TMP]], _nonlocal@GOTPAGEOFF]
; CHECK: br [[FUNC]]
+; CHECK-NORMAL-LABEL: test_laziness_tail:
+; CHECK-NORMAL: b _nonlocal
+
tail call void @nonlocal()
ret void
}