aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorDuncan Sands <baldrick@free.fr>2008-12-31 18:08:59 +0000
committerDuncan Sands <baldrick@free.fr>2008-12-31 18:08:59 +0000
commit9f81f8f01c23674fbae1f8c0a9557dcb6aced4fe (patch)
tree0e33d3417585a9e2401d155da5f75a4aba0693b4 /lib
parent987453389c8dc10aad5a8744b8a8740d6babf141 (diff)
downloadexternal_llvm-9f81f8f01c23674fbae1f8c0a9557dcb6aced4fe.zip
external_llvm-9f81f8f01c23674fbae1f8c0a9557dcb6aced4fe.tar.gz
external_llvm-9f81f8f01c23674fbae1f8c0a9557dcb6aced4fe.tar.bz2
Don't analyze arguments already marked 'nocapture'.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@61532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/Transforms/IPO/FunctionAttrs.cpp3
-rw-r--r--lib/VMCore/Function.cpp7
2 files changed, 9 insertions, 1 deletions
diff --git a/lib/Transforms/IPO/FunctionAttrs.cpp b/lib/Transforms/IPO/FunctionAttrs.cpp
index 9ed605c..1824a71 100644
--- a/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/lib/Transforms/IPO/FunctionAttrs.cpp
@@ -263,7 +263,8 @@ bool FunctionAttrs::AddNoCaptureAttrs(const std::vector<CallGraphNode *> &SCC) {
continue;
for (Function::arg_iterator A = F->arg_begin(), E = F->arg_end(); A!=E; ++A)
- if (isa<PointerType>(A->getType()) && !isCaptured(*F, A)) {
+ if (isa<PointerType>(A->getType()) && !A->hasNoCaptureAttr() &&
+ !isCaptured(*F, A)) {
A->addAttr(Attribute::NoCapture);
NumNoCapture++;
Changed = true;
diff --git a/lib/VMCore/Function.cpp b/lib/VMCore/Function.cpp
index ddc6ace..f83fe43 100644
--- a/lib/VMCore/Function.cpp
+++ b/lib/VMCore/Function.cpp
@@ -102,6 +102,13 @@ bool Argument::hasNoAliasAttr() const {
return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoAlias);
}
+/// hasNoCaptureAttr - Return true if this argument has the nocapture attribute
+/// on it in its containing function.
+bool Argument::hasNoCaptureAttr() const {
+ if (!isa<PointerType>(getType())) return false;
+ return getParent()->paramHasAttr(getArgNo()+1, Attribute::NoCapture);
+}
+
/// hasSRetAttr - Return true if this argument has the sret attribute on
/// it in its containing function.
bool Argument::hasStructRetAttr() const {