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

Jay Foad via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 7 08:46:50 PST 2023


foad added inline comments.


================
Comment at: llvm/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp:1541
+          KnownBits AddrKnown = CurDAG->computeKnownBits(N0);
+          if (AddrKnown.isNonNegative()) {
+            Addr = N0;
----------------
I think the isNonNegative check should not be inside the isLegalFLATOffset case, because we could also run into the same problem in the other case ("If the offset doesn't fit, put the low bits into the offset field and add the rest").

In other words I think it should be more like:
```
  if (isBaseWithConstantOffset(N0, N1) && N0 is non-negative) {
    if (isLegalFLATOffset) {
      ...
    } else {
      ...
    }
  }
```


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

https://reviews.llvm.org/D144956



More information about the llvm-commits mailing list