[PATCH] D152743: [AliasAnalysis] Return NoModRef for loads from constant memory

Arthur Eubanks via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 12 12:59:25 PDT 2023


aeubanks added a comment.

In D152743#4415131 <https://reviews.llvm.org/D152743#4415131>, @nikic wrote:

> I'm concerned that this will cause us problems in the future, e.g. if we want to do MemorySSA-based GVN, because we will no longer have MemoryUses for these loads at all, even though we may want to do load CSE on them.

why is having a MemoryUse necessary for load CSE? can't you CSE loads of the same pointer that don't have a MemoryUse?



================
Comment at: llvm/lib/Analysis/AliasAnalysis.cpp:482
+  // If the load is from constant memory, it doesn't mod/ref anything.
+  if (!isRefSet(getModRefInfoMask(MemoryLocation::get(L))))
+    return ModRefInfo::NoModRef;
----------------
nikic wrote:
> nikic wrote:
> > Should probably use `Loc` rather than `MemoryLocation::get(L)` here, just like all the other methods?
> Or I guess not, if the intention is to pick up TBAA metadata from the load itself?
yeah exactly


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D152743



More information about the llvm-commits mailing list