llvm-project
66cb135f - AMDGPU: Fold inline immediates in peephole-opt (#242952)

Commit
2 days ago
AMDGPU: Fold inline immediates in peephole-opt (#242952) Currently the AMDGPU implementation of foldImmediate handles a small set of special cases that require rewriting the instruction opcode (COPY -> mov, and fma-like to fmac-like). Most general immediate folding is handled in SIFoldOperands. Teach PeepholeOpt to fold all inline immediates into target instructions which should always be an improvement. This is to help alleviate some phase ordering problems in future changes. I've also never liked how SIFoldOperands is written and it could use a rewrite, and this will alleviate some of its responsibilties. It will always be necessary since some operand folds require additional context that foldImmediate won't have (namely, we have to make contextually aware tradeoffs for which operands are worth folding to respect constant bus restrictions, considering other users of the values). Co-authored-by: Claude (Opus 4.8) <noreply@anthropic.com>
Author
Parents
Loading