diff options
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index d5f3eccf48..4ac172d1cb 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -1696,9 +1696,13 @@ static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, // If the target runtime doesn't naturally support ARC, emit weak // references to the runtime support library. We don't really // permit this to fail, but we need a particular relocation style. - if (!CGM.getLangOpts().ObjCRuntime.hasARC()) - if (llvm::Function *f = dyn_cast<llvm::Function>(fn)) + if (llvm::Function *f = dyn_cast<llvm::Function>(fn)) { + if (!CGM.getLangOpts().ObjCRuntime.hasARC()) f->setLinkage(llvm::Function::ExternalWeakLinkage); + // set nonlazybind attribute for these APIs for performance. + if (fnName == "objc_retain" || fnName == "objc_release") + f->addFnAttr(llvm::Attribute::NonLazyBind); + } return fn; } |