[all-commits] [llvm/llvm-project] bfe349: [AMDGPU] Optimize S_SETREG_IMM32_B32 piggybacking ...

Shilei Tian via All-commits all-commits at lists.llvm.org
Wed Mar 4 16:19:46 PST 2026


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: bfe349ccf4b4c8694824dafedb8c9ef78bf80725
      https://github.com/llvm/llvm-project/commit/bfe349ccf4b4c8694824dafedb8c9ef78bf80725
  Author: Shilei Tian <i at tianshilei.me>
  Date:   2026-03-04 (Wed, 04 Mar 2026)

  Changed paths:
    M llvm/lib/Target/AMDGPU/AMDGPULowerVGPREncoding.cpp
    M llvm/test/CodeGen/AMDGPU/vgpr-setreg-mode-swar.mir

  Log Message:
  -----------
  [AMDGPU] Optimize S_SETREG_IMM32_B32 piggybacking by treating it as a mode scope boundary (#184703)

When `handleSetregMode` encounters an `S_SETREG_IMM32_B32` with `Size <=
12`, the instruction's `imm32[12:19]` bits are "free" for VGPR MSB
piggybacking. Previously, the old mode was eagerly written into these
bits, but the `Rewritten` guard in `setMode` would then block subsequent
piggybacking when the next VGPR instruction needed a different mode,
causing an unnecessary `S_SET_VGPR_MSB` to be emitted.

Model the `S_SETREG_IMM32_B32` as the boundary of the old mode's control
range: reset `CurrentMode` and clear `bits[12:19]` to zero. This lets
the next `setMode` call freely piggyback the required mode without
triggering `Rewritten`.



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