[llvm-commits] [llvm] r47253 - /llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp
Owen Anderson
resistor at mac.com
Sun Feb 17 19:52:21 PST 2008
Author: resistor
Date: Sun Feb 17 21:52:21 2008
New Revision: 47253
URL: http://llvm.org/viewvc/llvm-project?rev=47253&view=rev
Log:
Fix a comment, and a bug where we weren't applying the tail call logic in cases that failed the first test.
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=47253&r1=47252&r2=47253&view=diff
==============================================================================
--- llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp (original)
+++ llvm/trunk/lib/Analysis/BasicAliasAnalysis.cpp Sun Feb 17 21:52:21 2008
@@ -252,19 +252,21 @@
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
More information about the llvm-commits
mailing list