[PATCH] D127095: [llvm][CodeGen] Add a default implementation to check whether two memory accesses are trivially disjoint

Xiaoqiang Xu via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 14 23:52:03 PDT 2022


csstormq added inline comments.


================
Comment at: llvm/lib/CodeGen/MachineInstr.cpp:2414
+  for (auto MMOa : MMOpsA) {
+    for (auto MMOb : MMOpsB) {
+      if (!areMemOperandsTriviallyDisjoint(MMOa, MMOb)) {
----------------
efriedma wrote:
> Instead of repeating the loop from MachineInstr::mayAlias, can we make MemOperandsHaveAlias call areMemOperandsTriviallyDisjoint?
Yes, I will do that as your advice in the next patch.


================
Comment at: llvm/lib/CodeGen/MachineInstr.cpp:1358
 
   return !AA->isNoAlias(
       MemoryLocation(ValA, OverlapA, UseTBAA ? MMOa->getAAInfo() : AAMDNodes()),
----------------
efriedma wrote:
> csstormq wrote:
> > efriedma wrote:
> > > Do we reach this call isNoAlias() for two different intoptr constants?  Does it not handle the case you're trying to deal with?
> > > 
> > I migrate our backend to the latest main branch. And I tried again. I truly reach this call isNoAlias() for two different intoptr constants using gdb step by step, but it still returns false wrongly.
> Maybe worth looking into modifying BasicAAResult::aliasCheck to make this work?  That would also benefit IR-level optimizations.
I'm afraid not. In my view, when we reach BasicAAResult::aliasCheck, we can't determine the starting address for memory access because the offset from the base address has lost.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D127095



More information about the llvm-commits mailing list