[llvm] [AMDGPU] Fix negative immediate offset for unbuffered smem loads (PR #89165)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 18 02:23:29 PDT 2024


================
@@ -4221,7 +4232,13 @@ bool AMDGPUInstructionSelector::selectSmrdOffset(MachineOperand &Root,
   if (Offset && GEPI.SgprParts.size() == 1 && EncodedImm) {
     Base = GEPI.SgprParts[0];
     *Offset = *EncodedImm;
-    return true;
+    if (*Offset >= 0 || !STI.hasSignedSMRDImmOffset())
----------------
arsenm wrote:

Same as the in the DAG version, it would be better if the code was shared in the low level offset-is-valid function 

https://github.com/llvm/llvm-project/pull/89165


More information about the llvm-commits mailing list