[PATCH] D103862: [Attributor] Simplify loads
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jun 27 12:17:35 PDT 2021
jdoerfert added inline comments.
================
Comment at: llvm/lib/Transforms/IPO/AttributorAttributes.cpp:4504
+ // A null pointer access can be undefined but any offset from null may
+ // be OK. We do not try to optimize the latter.
+ bool UsedAssumedInformation;
----------------
kuter wrote:
> I don't understand why this case needs to be handled. I don't see how we would get something different from the `getAssumedSimplified`. `getAssumedUnderlyingObjects` just does `genericValueTraversal` and strips away casts.
>
The problem is that the object might be null but the pointer is not.
`p = nullptr; p[(intptr_t)q] = 1;`
Uses a nullptr object and `q` as offset. The simplified pointer is not `null` but a gep (or q).
In this case we cannot ignore the object. We can only ignore `p = nullptr; q = p[10]; q[-10] = 1;` because the object and the simplified pointer (which is where the access happens) are both null.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D103862/new/
https://reviews.llvm.org/D103862
More information about the llvm-commits
mailing list