aboutsummaryrefslogtreecommitdiffstats
path: root/lib/Analysis
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2008-02-18 03:52:21 +0000
committerOwen Anderson <resistor@mac.com>2008-02-18 03:52:21 +0000
commitf8e7e84cffc74db1df896f637ac2594cfd70718d (patch)
treef457f5a1a7feb2dfabc18a34d10777301e06a306 /lib/Analysis
parent34f007eb319169f3f744f444b9c75b09da763fad (diff)
downloadexternal_llvm-f8e7e84cffc74db1df896f637ac2594cfd70718d.zip
external_llvm-f8e7e84cffc74db1df896f637ac2594cfd70718d.tar.gz
external_llvm-f8e7e84cffc74db1df896f637ac2594cfd70718d.tar.bz2
Fix a comment, and a bug where we weren't applying the tail call logic in cases that failed the first test.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis')
-rw-r--r--lib/Analysis/BasicAliasAnalysis.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/Analysis/BasicAliasAnalysis.cpp b/lib/Analysis/BasicAliasAnalysis.cpp
index b19ce2b..c4153b9 100644
--- a/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/lib/Analysis/BasicAliasAnalysis.cpp
@@ -252,19 +252,21 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) {
if (Object &&
(isa<AllocationInst>(Object) || isa<Argument>(Object))) {
// Okay, the pointer is to a stack allocated (or effectively so, for
- // for noalias parameters) object. If we can prove that
- // the pointer never "escapes", then we know the call cannot clobber it,
- // because it simply can't get its address.
+ // for noalias parameters) object. If the address of this object doesn't
+ // escape from this function body to a callee, then we know that no
+ // callees can mod/ref it unless they are actually passed it.
if (isa<AllocationInst>(Object) ||
cast<Argument>(Object)->hasByValAttr() ||
cast<Argument>(Object)->hasNoAliasAttr())
if (!AddressMightEscape(Object)) {
+ bool passedAsArg = false;
for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end();
CI != CE; ++CI)
if (getUnderlyingObject(CI->get()) == P)
- return AliasAnalysis::getModRefInfo(CS, P, Size);
-
- return NoModRef;
+ passedAsArg = true;
+
+ if (!passedAsArg)
+ return NoModRef;
}
// If this is a tail call and P points to a stack location, we know that