Skip to content

Commit

Permalink
[AMDGPU] Fix lack of LDS DMA check in the AA handling (llvm#75249)
Browse files Browse the repository at this point in the history
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
llvm#75247, therefore I'd submit this check before llvm#75247.
  • Loading branch information
rampitec authored Dec 18, 2023
1 parent 4f54d71 commit 94230ce
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions llvm/lib/Target/AMDGPU/SIInstrInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 different one,
Expand Down

0 comments on commit 94230ce

Please sign in to comment.