[PATCH] D73428: [Attributor] Improve `noalias` deduction based on memory information

Stefanos Baziotis via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 17 03:32:21 PST 2020


baziotis added inline comments.


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2772-2774
+    // If the definition is not `noalias` we need to check globals in addition
+    // to arguments. If the definition is `noalias` we cannot alias globals to
+    // begin with.
----------------
jdoerfert wrote:
> baziotis wrote:
> > Why do we know that?
> If we have already `noalias` (or an alloca) we know we do not alias any access in the scope not derived from this pointer. Since globals cannot be derived from a `noalias` pointer (in a way that would be problematic here) or in any way from an alloca, we know the global does not alias the pointer.
Thanks for the explanation! The parts "a scope is derived from a pointer" (e.g. in the scope not derived from this pointer) are still unclear to me. What do I miss? Is there a specific part of code / doc I can read?


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2792
+  bool
+  isKnownNoAliasAtCalleeDueToAccesses(Attributor &A,
+                                      const AAMemoryBehavior &MemBehaviorAA,
----------------
jdoerfert wrote:
> baziotis wrote:
> > Maybe doc here (?) It looks similar to the above but some things I think would be good to be mentioned like why do we test for globals here.
> Will write a doc :)
Thanks!


================
Comment at: llvm/lib/Transforms/IPO/Attributor.cpp:2805
+      LLVM_DEBUG(
+          dbgs() << "[AANoAlias] Check access by " << I << " to " << Ptr << " ["
+                 << AAMemoryLocation::getMemoryLocationsAsStr(MLK) << "]\n");
----------------
jdoerfert wrote:
> baziotis wrote:
> > Maybe you want `*Ptr` here. Also maybe conditioned on `Ptr` (like above).
> Will do that.
Ty!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D73428/new/

https://reviews.llvm.org/D73428





More information about the llvm-commits mailing list