[llvm] 513ac6e - [Attributor] Ignore illegal accesses to `null`
Johannes Doerfert via llvm-commits
llvm-commits at lists.llvm.org
Sun May 10 17:08:12 PDT 2020
Author: Johannes Doerfert
Date: 2020-05-10T19:06:10-05:00
New Revision: 513ac6e9b045dd2d5e0d1a5e221380cfb999676a
URL: https://github.com/llvm/llvm-project/commit/513ac6e9b045dd2d5e0d1a5e221380cfb999676a
DIFF: https://github.com/llvm/llvm-project/commit/513ac6e9b045dd2d5e0d1a5e221380cfb999676a.diff
LOG: [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.
Added:
Modified:
llvm/lib/Transforms/IPO/AttributorAttributes.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Transforms/IPO/AttributorAttributes.cpp b/llvm/lib/Transforms/IPO/AttributorAttributes.cpp
index b3f656da5e33..26196f0a2416 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<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())
More information about the llvm-commits
mailing list