[llvm-commits] [llvm] r52302 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Chris Lattner
sabre at nondot.org
Sun Jun 15 23:28:02 PDT 2008
Author: lattner
Date: Mon Jun 16 01:28:01 2008
New Revision: 52302
URL: http://llvm.org/viewvc/llvm-project?rev=52302&view=rev
Log:
Other parts of this code treat noalias arguments as objects for
the purposes of escape analysis.
Modified:
llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Modified: llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp?rev=52302&r1=52301&r2=52302&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Mon Jun 16 01:28:01 2008
@@ -320,11 +320,15 @@
/// 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;
}
More information about the llvm-commits
mailing list