1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 11:02:59 +02:00

[Attributor] Ignore illegal accesses to null

When we categorize a pointer value we bailed at `null` before. If we
know `null` is not a valid memory location we can ignore it as there
won't be an access at all.
This commit is contained in:
Johannes Doerfert 2020-05-10 16:53:07 -05:00
parent cd3449844d
commit 340c8cfa95

View File

@ -6229,9 +6229,13 @@ void AAMemoryLocationImpl::categorizePtrValue(
MLK = NO_GLOBAL_INTERNAL_MEM;
else
MLK = NO_GLOBAL_EXTERNAL_MEM;
} else if (isa<AllocaInst>(V))
} else if (isa<ConstantPointerNull>(V) &&
!NullPointerIsDefined(getAssociatedFunction(),
V.getType()->getPointerAddressSpace())) {
return true;
} else if (isa<AllocaInst>(V)) {
MLK = NO_LOCAL_MEM;
else if (const auto *CB = dyn_cast<CallBase>(&V)) {
} else if (const auto *CB = dyn_cast<CallBase>(&V)) {
const auto &NoAliasAA =
A.getAAFor<AANoAlias>(*this, IRPosition::callsite_returned(*CB));
if (NoAliasAA.isAssumedNoAlias())