Skip to content

Commit 4514930

Browse files
committed
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@317680 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent 4d211ca commit 4514930

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Analysis/BasicAliasAnalysis.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1672,9 +1672,9 @@ AliasResult BasicAAResult::aliasCheck(const Value *V1, uint64_t V1Size,
16721672
// If both pointers are pointing into the same object and one of them
16731673
// accesses the entire object, then the accesses must overlap in some way.
16741674
if (O1 == O2)
1675-
if ((V1Size != MemoryLocation::UnknownSize &&
1676-
isObjectSize(O1, V1Size, DL, TLI)) ||
1677-
(V2Size != MemoryLocation::UnknownSize &&
1675+
if (V1Size != MemoryLocation::UnknownSize &&
1676+
V2Size != MemoryLocation::UnknownSize &&
1677+
(isObjectSize(O1, V1Size, DL, TLI) ||
16781678
isObjectSize(O2, V2Size, DL, TLI)))
16791679
return AliasCache[Locs] = PartialAlias;
16801680

0 commit comments

Comments
 (0)