[PATCH] D109647: [AA] Consider globalmemonly in getModRefInfo()
Johannes Doerfert via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sat Sep 11 15:12:28 PDT 2021
jdoerfert added inline comments.
================
Comment at: llvm/lib/Analysis/AliasAnalysis.cpp:283
+ getUnderlyingObject(Loc.Ptr->stripPointerCastsForAliasAnalysis());
+ if (!isa<GlobalValue>(V1)) {
+ return ModRefInfo::NoModRef;
----------------
nikic wrote:
> Just because the underlying object is not a global value, doesn't mean that it can't be based on one -- e.g. imagine a global being passed to a function argument. getUnderlyingObject() will just give you the argument in that case, which may still alias with a global.
>
> At the very least, you need to check for isIdentifiedObject() here. However, even that may be insufficient, as noalias arguments are identified objects, but I don't think you can apply this optimization to them (a noalias argument could point to a global, and a globalmemonly function could access the global through a passed-on noalias argument).
The last part is were it becomes interesting. If we say accesses to a global via an argument are globalmemonly or argmemonly. I think, given argmemonly, we could/should not say a function accessing globals only but via argument pointers can be globalmemonly. That resolves the problem here, I think. Identified objects are necessary for sure though.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D109647/new/
https://reviews.llvm.org/D109647
More information about the llvm-commits
mailing list