mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-23 03:02:36 +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:
parent
942359c2a6
commit
2287fcb34b
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user