diff options
author | Bob Wilson <bob.wilson@apple.com> | 2012-09-04 03:30:13 +0000 |
---|---|---|
committer | Bob Wilson <bob.wilson@apple.com> | 2012-09-04 03:30:13 +0000 |
commit | 01cfbfe9d00ceed2074fb5e3c296d506afe63a36 (patch) | |
tree | 8570c6a83e558af372babbbda34c7d2e372081cf /llvm/lib/Analysis | |
parent | 93380f63c9f8ae43e4949330e06c5b692cf22c05 (diff) | |
download | bcm5719-llvm-01cfbfe9d00ceed2074fb5e3c296d506afe63a36.tar.gz bcm5719-llvm-01cfbfe9d00ceed2074fb5e3c296d506afe63a36.zip |
Be conservative about allocations that may alias the accessed pointer.
If an allocation has a must-alias relation to the access pointer, we treat it
as a Def. Otherwise, without this check, the code here was just skipping over
the allocation call and ignoring it. I noticed this by inspection and don't
have a specific testcase that it breaks, but it seems like we need to treat
a may-alias allocation as a Clobber.
llvm-svn: 163127
Diffstat (limited to 'llvm/lib/Analysis')
-rw-r--r-- | llvm/lib/Analysis/MemoryDependenceAnalysis.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp index 804217a83d1..5736c3569dc 100644 --- a/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp +++ b/llvm/lib/Analysis/MemoryDependenceAnalysis.cpp @@ -485,6 +485,9 @@ getPointerDependencyFrom(const AliasAnalysis::Location &MemLoc, bool isLoad, if (AccessPtr == Inst || AA->isMustAlias(Inst, AccessPtr)) return MemDepResult::getDef(Inst); + // Be conservative if the accessed pointer may alias the allocation. + if (AA->alias(Inst, AccessPtr) != AliasAnalysis::NoAlias) + return MemDepResult::getClobber(Inst); // If the allocation is not aliased and does not read memory (like // strdup), it is safe to ignore. if (isa<AllocaInst>(Inst) || |