[PATCH] D144956: Fix VGPR + offset Scratch offset folding

Petar Avramovic via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 08:37:13 PST 2023


Petar.Avramovic added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp:1536-1537
       if (TII->isLegalFLATOffset(COffsetVal, AS, FlatVariant)) {
-        Addr = N0;
-        OffsetVal = COffsetVal;
+        // When value in 32-bit VGPR base can be negative calculate scratch
+        // offset using 32-bit add instruction,
+        // otherwise use vgpr base(unsigned) + offset.
----------------
arsenm wrote:
> But the offsets are negative for scratch and global, isLegalFLATOffset should have accounted for this
isLegalFLATOffset checks for constant offset (the `+ offset`), this check is for value in register (the `base(unsigned)`) 


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D144956/new/

https://reviews.llvm.org/D144956



More information about the llvm-commits mailing list