[llvm] AMDGPU: Only allow 31bit positive offset for scratch (PR #71895)

via llvm-commits llvm-commits at lists.llvm.org
Sun Nov 12 17:21:03 PST 2023


================
@@ -1859,7 +1859,7 @@ bool AMDGPUDAGToDAGISel::SelectScratchSVAddr(SDNode *N, SDValue Addr,
       std::tie(SplitImmOffset, RemainderOffset)
         = TII->splitFlatOffset(COffsetVal, AMDGPUAS::PRIVATE_ADDRESS, true);
 
-      if (isUInt<32>(RemainderOffset)) {
+      if (RemainderOffset > 0 && isInt<32>(RemainderOffset)) {
----------------
ruiling wrote:

The GlobalISel does not have such logic, so no changes needed there. I am not quite sure do we really need a test for this. I guess this can only be tested with out-of-bounds access, as we cannot allocate too much scratch, right? I felt the change is not quite useful in practice. what do you think?

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


More information about the llvm-commits mailing list