[llvm] [AMDGPU] Fix negative immediate offset for unbuffered smem loads (PR #89165)
Jay Foad via llvm-commits
llvm-commits at lists.llvm.org
Wed May 8 07:59:24 PDT 2024
================
@@ -2016,7 +2018,14 @@ bool AMDGPUDAGToDAGISel::SelectSMRDOffset(SDValue ByteOffsetNode,
AMDGPU::getSMRDEncodedOffset(*Subtarget, ByteOffset, IsBuffer);
if (EncodedOffset && Offset && !Imm32Only) {
*Offset = CurDAG->getTargetConstant(*EncodedOffset, SL, MVT::i32);
- return true;
+ if (EncodedOffset >= 0 || IsBuffer || HasSOffset ||
+ !Subtarget->hasSignedSMRDImmOffset())
+ return true;
+ // For unbuffered smem loads, it is illegal for the Immediate Offset to be
+ // negative if the resulting (Offset + (M0 or SOffset or zero) is negative.
----------------
jayfoad wrote:
Unbalanced parentheses
https://github.com/llvm/llvm-project/pull/89165
More information about the llvm-commits
mailing list