From: Johannes Doerfert Date: Sun, 10 May 2020 21:53:07 +0000 (-0500) Subject: [Attributor] Ignore illegal accesses to `null` X-Git-Tag: llvmorg-12-init~6450 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=513ac6e9b045dd2d5e0d1a5e221380cfb999676a;p=platform%2Fupstream%2Fllvm.git [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. --- diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp index b3f656d..26196f0 100644 --- a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp +++ b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp @@ -6229,9 +6229,13 @@ void AAMemoryLocationImpl::categorizePtrValue( MLK = NO_GLOBAL_INTERNAL_MEM; else MLK = NO_GLOBAL_EXTERNAL_MEM; - } else if (isa(V)) + } else if (isa(V) && + !NullPointerIsDefined(getAssociatedFunction(), + V.getType()->getPointerAddressSpace())) { + return true; + } else if (isa(V)) { MLK = NO_LOCAL_MEM; - else if (const auto *CB = dyn_cast(&V)) { + } else if (const auto *CB = dyn_cast(&V)) { const auto &NoAliasAA = A.getAAFor(*this, IRPosition::callsite_returned(*CB)); if (NoAliasAA.isAssumedNoAlias())