summaryrefslogtreecommitdiffstats
path: root/llvm
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
commitdf128eb477955e2768dc5a5abcf67ee974d45173 (patch)
tree9b113f67ad901cf7f59e0e344969d068a27d5bd0 /llvm
parent5347fb20ad76328feaa13603f0e94867f2bb2f4f (diff)
downloadbcm5719-llvm-df128eb477955e2768dc5a5abcf67ee974d45173.tar.gz
bcm5719-llvm-df128eb477955e2768dc5a5abcf67ee974d45173.zip
Don't analyze arguments already marked 'nocapture'.
llvm-svn: 61532
Diffstat (limited to 'llvm')
-rw-r--r--llvm/include/llvm/Argument.h4
-rw-r--r--llvm/lib/Transforms/IPO/FunctionAttrs.cpp3
-rw-r--r--llvm/lib/VMCore/Function.cpp7
3 files changed, 13 insertions, 1 deletions
diff --git a/llvm/include/llvm/Argument.h b/llvm/include/llvm/Argument.h
index 9faff549f26..9c063677984 100644
--- a/llvm/include/llvm/Argument.h
+++ b/llvm/include/llvm/Argument.h
@@ -56,6 +56,10 @@ public:
/// it in its containing function.
bool hasNoAliasAttr() const;
+ /// hasNoCaptureAttr - Return true if this argument has the nocapture
+ /// attribute on it in its containing function.
+ bool hasNoCaptureAttr() const;
+
/// hasSRetAttr - Return true if this argument has the sret attribute on it in
/// its containing function.
bool hasStructRetAttr() const;
diff --git a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp b/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
index 9ed605cf9f3..1824a710c51 100644
--- a/llvm/lib/Transforms/IPO/FunctionAttrs.cpp
+++ b/llvm/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/llvm/lib/VMCore/Function.cpp b/llvm/lib/VMCore/Function.cpp
index ddc6ace3278..f83fe435cd0 100644
--- a/llvm/lib/VMCore/Function.cpp
+++ b/llvm/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 {
OpenPOWER on IntegriCloud