[llvm] 94230ce - [AMDGPU] Fix lack of LDS DMA check in the AA handling (#75249)

via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 18 10:58:54 PST 2023


Author: Stanislav Mekhanoshin
Date: 2023-12-18T10:58:50-08:00
New Revision: 94230ce548c2f69db4cf9ef92ccb51d59030e7e3

URL: https://github.com/llvm/llvm-project/commit/94230ce548c2f69db4cf9ef92ccb51d59030e7e3
DIFF: https://github.com/llvm/llvm-project/commit/94230ce548c2f69db4cf9ef92ccb51d59030e7e3.diff

LOG: [AMDGPU] Fix lack of LDS DMA check in the AA handling (#75249)

SIInstrInfo::areMemAccessesTriviallyDisjoint does a DS offset checks,
but does not account for LDS DMA instructions. Added these checks.
Without it code falls through and returns true which is wrong. As a
result mayAlias would always return false for LDS DMA and a regular LDS
instruction or 2 LDS DMA instructions.

At the moment this is NFCI because we do not use this AA in a context
which may touch LDS DMA instructions. This is also unreacheable now
because of the ordered memory ref checks just above in the function and
LDS DMA is marked as volatile. This volatile marking is removed in PR
#75247, therefore I'd submit this check before #75247.

Added: 
    

Modified: 
    llvm/lib/Target/AMDGPU/SIInstrInfo.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
index 70ef1fff274a40..5d6462f355fab9 100644
--- a/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
+++ b/llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
@@ -3654,6 +3654,9 @@ bool SIInstrInfo::areMemAccessesTriviallyDisjoint(const MachineInstr &MIa,
   if (MIa.hasOrderedMemoryRef() || MIb.hasOrderedMemoryRef())
     return false;
 
+  if (isLDSDMA(MIa) || isLDSDMA(MIb))
+    return false;
+
   // TODO: Should we check the address space from the MachineMemOperand? That
   // would allow us to distinguish objects we know don't alias based on the
   // underlying address space, even if it was lowered to a 
diff erent one,


        


More information about the llvm-commits mailing list