[PATCH] D58295: AMDGPU: Fix memory dependence analysis by considering the offset.

Changpeng Fang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 15 13:57:58 PST 2019

cfang marked an inline comment as done.
cfang added inline comments.

Comment at: lib/Target/AMDGPU/SIInstrInfo.cpp:2218-2232
   if (AA && MIa.hasOneMemOperand() && MIb.hasOneMemOperand()) {
     const MachineMemOperand *MMOa = *MIa.memoperands_begin();
     const MachineMemOperand *MMOb = *MIb.memoperands_begin();
     if (MMOa->getValue() && MMOb->getValue()) {
-      MemoryLocation LocA(MMOa->getValue(), MMOa->getSize(), MMOa->getAAInfo());
-      MemoryLocation LocB(MMOb->getValue(), MMOb->getSize(), MMOb->getAAInfo());
+      int64_t MinOffset = std::min(MMOa->getOffset(), MMOb->getOffset());
+      int64_t Overlapa = MMOa->getSize() + MMOa->getOffset() - MinOffset;
arsenm wrote:
> Why can't you use MI.mayAlias and delete this?
This intends to fix a bug in an application. We can use  MI.mayAlias and delete areMemAccessesTriviallyDisjoint.
However, we need to make sure areMemAccessesTriviallyDisjoint is indeed useless because things developed there
are not for on reason. We need extensive tests.
So I propose to add this patch first to fix the bug. Then we can spend time to investigate the way to safely remove the stuff in 
areMemAccessesTriviallyDisjoint and replace it with MI.mayAlias.  



More information about the llvm-commits mailing list