llvm-project
bfe349cc - [AMDGPU] Optimize S_SETREG_IMM32_B32 piggybacking by treating it as a mode scope boundary (#184703)

Commit
48 days ago
[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`.
Author
Parents
Loading