llvm-project
76787ddc - [AMDGPU] Sink loop-invariant scalar splats in isProfitableToSinkOperands (#244647)

Commit
7 hours ago
[AMDGPU] Sink loop-invariant scalar splats in isProfitableToSinkOperands (#244647) The "zero-cost multiple use InsertElement" check matched any vector instruction with more than one operand, including shufflevector. For a splat shuffle fed by a single-use insertelement it hit the early `continue`, so the isZeroEltSplat() handling below was never reached and loop-invariant splats stayed hoisted out of the loop. Restrict the check to InsertElementInst. When sinking a zero-element splat shuffle, also sink a feeding insertelement at index 0, so that isel sees the scalar. This lets uniform splats used in a loop become SGPR operands of packed instructions with op_sel_hi instead of being materialized in the preheader with s_pack_ll_b32_b16 or extra SGPR copies. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Parents
Loading