summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-08-07 21:30:31 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-08-07 21:30:31 +0000
commitaf264ce12a04baff28e594bcec7b700161262f92 (patch)
tree1dc2d8ce89d55785d2aeb15caa6b8a1149210688 /clang/lib/CodeGen/CGObjC.cpp
parent25db8721e9706ea3171d782cc8bbb092ab9732b5 (diff)
downloadbcm5719-llvm-af264ce12a04baff28e594bcec7b700161262f92.tar.gz
bcm5719-llvm-af264ce12a04baff28e594bcec7b700161262f92.zip
objc-arc: set nonlazybind attribute on objc_retain/
objc_release for performance for these most often called APIs. // rdar://12040837 llvm-svn: 161448
Diffstat (limited to 'clang/lib/CodeGen/CGObjC.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjC.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp
index d5f3eccf48f..4ac172d1cbb 100644
--- a/clang/lib/CodeGen/CGObjC.cpp
+++ b/clang/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;
}
OpenPOWER on IntegriCloud