aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Analysis/BasicAliasAnalysis.cpp
diff options
context:
space:
mode:
authorNuno Lopes <nunoplopes@sapo.pt>2017-11-08 10:59:00 +0000
committerNuno Lopes <nunoplopes@sapo.pt>2017-11-08 10:59:00 +0000
commit17921d9e219d04afefccbeedd8a485e3357239d4 (patch)
treecc24b67e2a080f16850baa9d7f892ecffb6a298f /llvm/lib/Analysis/BasicAliasAnalysis.cpp
parentd2aab749d10762fb1193f90cbec3da83760dcd8d (diff)
downloadllvm-17921d9e219d04afefccbeedd8a485e3357239d4.zip
llvm-17921d9e219d04afefccbeedd8a485e3357239d4.tar.gz
llvm-17921d9e219d04afefccbeedd8a485e3357239d4.tar.bz2
BasicAA: fix bug where we would return partialalias instead of noalias
My fix is conservative and will make us return may-alias instead. The test case is: check(gep(x, 0), n, gep(x, n), -1) with n == sizeof(x) Here, the first value accesses the whole object, but the second access doesn't access anything. The semantics of -1 is read until the end of the object, which in this case means read nothing. No test case, since isn't trivial to exploit this one, but I've proved it correct. llvm-svn: 317680
Diffstat (limited to 'llvm/lib/Analysis/BasicAliasAnalysis.cpp')
-rw-r--r--llvm/lib/Analysis/BasicAliasAnalysis.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/llvm/lib/Analysis/BasicAliasAnalysis.cpp b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
index 4a6abae..fb9ece2 100644
--- a/llvm/lib/Analysis/BasicAliasAnalysis.cpp
+++ b/llvm/lib/Analysis/BasicAliasAnalysis.cpp
@@ -1672,9 +1672,9 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, uint64_t V1Size,
// If both pointers are pointing into the same object and one of them
// accesses the entire object, then the accesses must overlap in some way.
if (O1 == O2)
- if ((V1Size != MemoryLocation::UnknownSize &&
- isObjectSize(O1, V1Size, DL, TLI)) ||
- (V2Size != MemoryLocation::UnknownSize &&
+ if (V1Size != MemoryLocation::UnknownSize &&
+ V2Size != MemoryLocation::UnknownSize &&
+ (isObjectSize(O1, V1Size, DL, TLI) ||
isObjectSize(O2, V2Size, DL, TLI)))
return AliasCache[Locs] = PartialAlias;