summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorRichard Osborne <richard@xmos.com>2012-11-05 10:48:24 +0000
committerRichard Osborne <richard@xmos.com>2012-11-05 10:48:24 +0000
commita1fffcf73ab2575bc7089a5cecbb3c522d92027e (patch)
treec954a1a0dc2a19ae3eb8ca3e51a3547141ec0090 /llvm/lib/Analysis/BasicAliasAnalysis.cpp
parent89ad975c6837f56810a3de23d7a902e347e6abb2 (diff)
downloadbcm5719-llvm-a1fffcf73ab2575bc7089a5cecbb3c522d92027e.tar.gz
bcm5719-llvm-a1fffcf73ab2575bc7089a5cecbb3c522d92027e.zip
Don't infer whether a value is captured in the current function from the
'nocapture' attribute. The nocapture attribute only specifies that no copies are made that outlive the function. This isn't the same as there being no copies at all. This fixes PR14045. llvm-svn: 167381
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 131b9d65e6e..4bb93ee88a4 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -58,12 +58,12 @@ static bool isNonEscapingLocalObject(const Value *V) {
// then it has not escaped before entering the function. Check if it escapes
// inside the function.
if (const Argument *A = dyn_cast<Argument>(V))
- if (A->hasByValAttr() || A->hasNoAliasAttr()) {
- // Don't bother analyzing arguments already known not to escape.
- if (A->hasNoCaptureAttr())
- return true;
+ if (A->hasByValAttr() || A->hasNoAliasAttr())
+ // Note even if the argument is marked nocapture we still need to check
+ // for copies made inside the function. The nocapture attribute only
+ // specifies that there are no copies made that outlive the function.
return !PointerMayBeCaptured(V, false, /*StoreCaptures=*/true);
- }
+
return false;
}
OpenPOWER on IntegriCloud