[all-commits] [llvm/llvm-project] aa7941: AMDGPU: Fold copy of scalar add of frame index (#1...

Matt Arsenault via All-commits all-commits at lists.llvm.org
Wed Nov 6 09:11:19 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: aa7941289ee5b7d9bdf47e1b0ebf2130a86d9522
      https://github.com/llvm/llvm-project/commit/aa7941289ee5b7d9bdf47e1b0ebf2130a86d9522
  Author: Matt Arsenault <Matthew.Arsenault at amd.com>
  Date:   2024-11-06 (Wed, 06 Nov 2024)

  Changed paths:
    M llvm/lib/Target/AMDGPU/SIFoldOperands.cpp
    A llvm/test/CodeGen/AMDGPU/fold-operands-s-add-copy-to-vgpr.mir

  Log Message:
  -----------
  AMDGPU: Fold copy of scalar add of frame index (#115058)

This is a pre-optimization to avoid a regression in a future
commit. Currently we almost always emit frame index with
a v_mov_b32 and use vector adds for the pointer operations. We
need to consider the users of the frame index (or rather, the
transitive users of derived pointer operations) to know whether
the value will be used in a vector or scalar context. This saves
an sgpr->vgpr copy.

This optimization could be more general for any opcode that's
trivially convertible from a scalar to vector form (although this
is a workaround for a proper regbankselect).



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