[all-commits] [llvm/llvm-project] bfb868: [AMDGPU] Fix predicates on FLAT scratch ST/SVS mod...

Jay Foad via All-commits all-commits at lists.llvm.org
Sun Mar 17 02:43:06 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bfb868201f821047015465fb3f0afa6daa321b5f
      https://github.com/llvm/llvm-project/commit/bfb868201f821047015465fb3f0afa6daa321b5f
  Author: Jay Foad <jay.foad at amd.com>
  Date:   2024-03-17 (Sun, 17 Mar 2024)

  Changed paths:
    M llvm/lib/Target/AMDGPU/FLATInstructions.td

  Log Message:
  -----------
  [AMDGPU] Fix predicates on FLAT scratch ST/SVS mode Pseudos (#85442)

Definitions like this did not work as intended:

  let is_flat_scratch = 1 in {
    let SubtargetPredicate = HasFlatScratchSVSMode in
def _SVS : FLAT_Scratch_Load_Pseudo<opName, regClass, HasTiedOutput, 1,
1>,
               FlatScratchInst<opName, "SVS">;

    let SubtargetPredicate = HasFlatScratchSTMode in
def _ST : FLAT_Scratch_Load_Pseudo<opName, regClass, HasTiedOutput, 0,
0, 0>,
               FlatScratchInst<opName, "ST">;
  }

They tried to override SubtargetPredicate, but then it was overridden
again (back to its default value) by setting is_flat_scratch, which
caused SubtargetPredicate to be recalculated in the base class. (This
patch also removes some overrides of SubtargetPredicate that are
redundant due to being recalculated in the base class.)

Fix this by pushing overrides of is_flat_scratch and is_flat_global "in"
as far as possible. This has the added benefit that there is no need to
override them around groups of Pseudo definitions like this:

let is_flat_global = 1 in {
defm GLOBAL_ATOMIC_CMPSWAP : FLAT_Global_Atomic_Pseudo
<"global_atomic_cmpswap",
                               VGPR_32, i32, v2i32, VReg_64>;
...
}

which are plainly Global instructions anyway.

Verified by inspecting the output of TableGen. It seems to be NFC in
practice.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list