[PATCH] D98940: [AMDGPU] Allow index optimisation in SIPreEmitPeephole for bundles

Carl Ritson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 19 05:15:20 PDT 2021


critson added a comment.

In D98940#2637112 <https://reviews.llvm.org/D98940#2637112>, @foad wrote:

>> Add code so duplication mode register changes
>
> "duplicated"?
>
> Needs a test. Also can you explain what bundles these are and why it's OK to modify them? In general I think we should err on the side of not modifying bundles, otherwise what's the point of bundling them?

GPR index register settings are bundled with their associated instructions:
e.g.

  BUNDLE ... {
      S_SET_GPR_IDX_ON $sgpr2, 1, implicit-def $m0, implicit-def undef $mode, implicit $m0, implicit $mode
      $vgpr0 = V_MOV_B32_e32 undef $vgpr2, ...
      S_SET_GPR_IDX_OFF implicit-def $mode, implicit internal $mode
    }

Currently these are unbundled in SIMemoryLegalizer.
Code in SIPreEmitPeephole looks for patterns of duplication changes, e.g.:

  set value
  op1
  set off
  set value
  op2
  set off

reduces these to:

  set value
  op1
  op2
  set off

If we plan to stop unbundling everything in SIMemoryLegalizer then this change is required for the optimisation to work.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D98940



More information about the llvm-commits mailing list