mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-12-19 01:27:40 +00:00
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
This commit is contained in:
parent
f24d0a24c7
commit
00bddec249
@ -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) ||
|
||||
|
Loading…
Reference in New Issue
Block a user