[PATCH] D136659: [AliasAnalysis] Introduce getModRefMask() as a generalization of pointsToConstantMemory().

Patrick Walton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 17:08:05 PDT 2022


pcwalton added inline comments.


================
Comment at: llvm/lib/Analysis/BasicAliasAnalysis.cpp:824
+ModRefInfo BasicAAResult::getModRefInfoMask(const MemoryLocation &Loc,
+                                            AAQueryInfo &AAQI) {
+  if (Loc.Ptr) {
----------------
nikic wrote:
> Rather than making this a separate method, this should replace pointsToConstantMemory() instead, at least as far as AA providers are concerned. (At the top-level interface, we can keep pointsToConstantMemory() as a thin wrapper like getModRefInfoMask() == NoModRef.)
> 
> The problem with your current implementation is that it does not handle cases where there are multiple underlying objects (or a single one that requires looking through phis) which all ultimately end in noalias readonly memory.
Sure, in fact that was what I originally tried to do, but I got stuck on what to do with the `OrLocal` parameter. How should `getModRefInfoMask()` deal with the case in which `OrLocal` is true and the memory location resolves to a local? Should it return `NoModRef`? Should it return `Ref`? Or should I split out the logic of `getModRefInfoMask()` and `pointsToConstantMemory()` into a shared helper function that both of them call into?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D136659



More information about the llvm-commits mailing list