diff options
| author | Nick Lewycky <nicholas@mxc.ca> | 2009-02-13 07:06:27 +0000 |
|---|---|---|
| committer | Nick Lewycky <nicholas@mxc.ca> | 2009-02-13 07:06:27 +0000 |
| commit | c60bd012bcc7843d7ad71fae3b040d402dba319f (patch) | |
| tree | 17e7a06263d7b76487a032f3b42da261478689ab /llvm/lib/Analysis | |
| parent | 76187b4d689a6ce601f2055b3dad5be6a4ab1012 (diff) | |
| download | bcm5719-llvm-c60bd012bcc7843d7ad71fae3b040d402dba319f.tar.gz bcm5719-llvm-c60bd012bcc7843d7ad71fae3b040d402dba319f.zip | |
BasicAA was making the assumption that a local allocation which hadn't escaped
couldn't ever be the return of call instruction. However, it's quite possible
that said local allocation is itself the return of a function call. That's
what malloc and calloc are for, actually.
llvm-svn: 64442
Diffstat (limited to 'llvm/lib/Analysis')
| -rw-r--r-- | llvm/lib/Analysis/BasicAliasAnalysis.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp index 1b26dc421ce..ef918507b77 100644 --- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp +++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp @@ -319,7 +319,7 @@ BasicAliasAnalysis::getModRefInfo(CallSite CS, Value *P, unsigned Size) { // If the pointer is to a locally allocated object that does not escape, // then the call can not mod/ref the pointer unless the call takes the // argument without capturing it. - if (isNonEscapingLocalObject(Object)) { + if (isNonEscapingLocalObject(Object) && CS.getInstruction() != Object) { bool passedAsArg = false; // TODO: Eventually only check 'nocapture' arguments. for (CallSite::arg_iterator CI = CS.arg_begin(), CE = CS.arg_end(); @@ -414,10 +414,10 @@ BasicAliasAnalysis::alias(const Value *V1, unsigned V1Size, // non-escaping local object, then we know the object couldn't escape to a // point where the call could return it. if ((isa<CallInst>(O1) || isa<InvokeInst>(O1)) && - isNonEscapingLocalObject(O2)) + isNonEscapingLocalObject(O2) && O1 != O2) return NoAlias; if ((isa<CallInst>(O2) || isa<InvokeInst>(O2)) && - isNonEscapingLocalObject(O1)) + isNonEscapingLocalObject(O1) && O1 != O2) return NoAlias; // If we have two gep instructions with must-alias'ing base pointers, figure |

