aboutsummaryrefslogtreecommitdiff
path: root/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-06-16 06:28:01 +0000
committerChris Lattner <sabre@nondot.org>2008-06-16 06:28:01 +0000
commite7275794d399615e8bde0dfb69b02934549e4fb6 (patch)
tree18fb6a0b43be73d4e617198bdd272c4e3957bdcd /lib/Analysis/BasicAliasAnalysis.cpp
parent845f0d2f0fd4a268ca1b3df9afb3de523f6dfa9d (diff)
Other parts of this code treat noalias arguments as objects for
the purposes of escape analysis. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@52302 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index 6ab7d941ee..8f7fcbf67a 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -320,11 +320,15 @@ static bool isKnownNonNull(const Value *V) {
/// isNonEscapingLocalObject - Return true if the pointer is to a function-local
/// object that never escapes from the function.
static bool isNonEscapingLocalObject(const Value *V) {
- // If this is a local allocation or byval argument, check to see if it
- // escapes.
- if (isa<AllocationInst>(V) ||
- (isa<Argument>(V) && cast<Argument>(V)->hasByValAttr()))
+ // If this is a local allocation, check to see if it escapes.
+ if (isa<AllocationInst>(V))
return !AddressMightEscape(V);
+
+ // If this is an argument that corresponds to a byval or noalias argument,
+ // it can't escape either.
+ if (const Argument *A = dyn_cast<Argument>(V))
+ if (A->hasByValAttr() || A->hasNoAliasAttr())
+ return !AddressMightEscape(V);
return false;
}