1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 18:54:02 +01:00

[MDA] Don't be quite as conservative for noalias functions

If we encounter a noalias call that alias analysis can't analyse, we can fall down into the generic call handling rather than giving up entirely. I noticed this while reading through the code for another purpose.

I can't seem to write a test case which changes; that sorta makes sense given any test case would have to be an inconsistency in AA. Suggestions welcome.

Differential Revision: http://reviews.llvm.org/D15825

llvm-svn: 256802
This commit is contained in:
Philip Reames 2016-01-05 00:49:14 +00:00
parent 942359c2a6
commit 2287fcb34b

View File

@ -685,13 +685,13 @@ MemDepResult MemoryDependenceAnalysis::getSimplePointerDependencyFrom(
return MemDepResult::getDef(Inst);
if (isInvariantLoad)
continue;
// Be conservative if the accessed pointer may alias the allocation.
if (AA->alias(Inst, AccessPtr) != 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) ||
isMallocLikeFn(Inst, TLI) || isCallocLikeFn(Inst, TLI))
// Be conservative if the accessed pointer may alias the allocation -
// fallback to the generic handling below.
if ((AA->alias(Inst, AccessPtr) == NoAlias) &&
// If the allocation is not aliased and does not read memory (like
// strdup), it is safe to ignore.
(isa<AllocaInst>(Inst) || isMallocLikeFn(Inst, TLI) ||
isCallocLikeFn(Inst, TLI)))
continue;
}