[PATCH] D123381: [SelectionDAG] Remove duplicate "is scaled" information from gather/scatter SDNodes.

Paul Walker via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 8 05:09:09 PDT 2022


paulwalker-arm created this revision.
Herald added subscribers: frasercrmck, ecnelises, luismarques, apazos, sameer.abuasal, s.egerton, Jim, jocewei, PkmX, the_o, brucehoult, MartinMosbeck, rogfer01, edward-jones, zzheng, jrtc27, niosHD, sabuasal, simoncook, johnrusso, rbar, asb, hiraditya, arichardson.
Herald added a project: All.
paulwalker-arm requested review of this revision.
Herald added subscribers: llvm-commits, pcwang-thead, MaskRay.
Herald added a project: LLVM.

During early early gather/scatter enablement two different
approaches were taken to represent scaled indices:

- A Scale operand whereby byte_offsets = Index * Scale
- An IndexType whereby byte_offsets = Index * sizeof(MemVT.ElementType)

Having multiple representations is bad as shown by this patch which
fixes instances where the two are out of sync. The dedicated scale
operand is more flexible and pervasive so this patch removes the
UNSCALED values from IndexType. This means all indices are scaled
but the scale can be one, hence unscaled. SDNodes now use the scale
operand to answer the "isScaledIndex" question.

I toyed with the idea of keeping the UNSCALED enums and helper
functions but because they will have no uses and force SDNodes to
validate the set of supported values I figured it's best to remove
them. We can re-add them if there's a real need. For similar
reasons I've kept the IndexType enum when a bool could be used as I
think being explicitly looks better.

Depends On D123347 <https://reviews.llvm.org/D123347>


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D123381

Files:
  llvm/include/llvm/CodeGen/ISDOpcodes.h
  llvm/include/llvm/CodeGen/SelectionDAGNodes.h
  llvm/include/llvm/CodeGen/TargetLowering.h
  llvm/lib/CodeGen/SelectionDAG/SelectionDAG.cpp
  llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp
  llvm/lib/CodeGen/SelectionDAG/TargetLowering.cpp
  llvm/lib/Target/RISCV/RISCVISelLowering.cpp
  llvm/test/CodeGen/AArch64/sve-masked-scatter.ll

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D123381.421492.patch
Type: text/x-patch
Size: 11190 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220408/dcd16364/attachment.bin>


More information about the llvm-commits mailing list