[llvm] r300474 - AArch64: put nonlazybind special handling behind a flag for now.
Tim Northover via llvm-commits
llvm-commits at lists.llvm.org
Mon Apr 17 11:18:47 PDT 2017
Author: tnorthover
Date: Mon Apr 17 13:18:47 2017
New Revision: 300474
URL: http://llvm.org/viewvc/llvm-project?rev=300474&view=rev
Log:
AArch64: put nonlazybind special handling behind a flag for now.
It's basically a terrible idea anyway but objc_msgSend gets emitted like that.
We can decide on a better way to deal with it in the unlikely event that anyone
actually uses it.
Modified:
llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp
llvm/trunk/test/CodeGen/AArch64/nonlazybind.ll
Modified: llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp?rev=300474&r1=300473&r2=300474&view=diff
==============================================================================
--- llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp (original)
+++ llvm/trunk/lib/Target/AArch64/AArch64Subtarget.cpp Mon Apr 17 13:18:47 2017
@@ -35,6 +35,11 @@ static cl::opt<bool>
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) {
@@ -165,7 +170,7 @@ unsigned char AArch64Subtarget::classify
// 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;
Modified: llvm/trunk/test/CodeGen/AArch64/nonlazybind.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/AArch64/nonlazybind.ll?rev=300474&r1=300473&r2=300474&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/AArch64/nonlazybind.ll (original)
+++ llvm/trunk/test/CodeGen/AArch64/nonlazybind.ll Mon Apr 17 13:18:47 2017
@@ -1,4 +1,5 @@
-; 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
@@ -15,6 +16,10 @@ define void @test_laziness() {
; CHECK: ldr [[FUNC:x[0-9]+]], [x[[TMP]], _nonlocal at 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
@@ -27,6 +32,9 @@ define void @test_laziness_tail() {
; CHECK: ldr [[FUNC:x[0-9]+]], [x[[TMP]], _nonlocal at GOTPAGEOFF]
; CHECK: br [[FUNC]]
+; CHECK-NORMAL-LABEL: test_laziness_tail:
+; CHECK-NORMAL: b _nonlocal
+
tail call void @nonlocal()
ret void
}
More information about the llvm-commits
mailing list