[llvm] [AMDGPU] Folding imm offset in more cases for scratch access (PR #70634)

via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 30 19:21:18 PDT 2023


================
@@ -1886,7 +1899,8 @@ bool AMDGPUDAGToDAGISel::SelectScratchSVAddr(SDNode *N, SDValue Addr,
     return false;
   }
 
-  if (!isFlatScratchBaseLegal(SAddr) || !isFlatScratchBaseLegal(VAddr))
+  if (!isFlatScratchBaseLegal(Addr, SAddr) ||
----------------
ruiling wrote:

With a second look, I find the code here is wrong now because the newly added check only work when there are **two** offsets. For `SAddr + VAddr + immOffset`, the simple and correct way could be just check that `CurDAG->SignBitIsZero(SAddr) && CurDAG->SignBitIsZero(VAddr)`. I would change like that if no objection.

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


More information about the llvm-commits mailing list