[llvm] [AMDGPU] Optimize SGPR splat reg sequences for packed 64-bit instructions (PR #217182)

Changpeng Fang via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 19 16:01:13 PDT 2026


================
@@ -2473,10 +2474,86 @@ bool SIFoldOperandsImpl::tryFoldOMod(MachineInstr &MI) {
   return true;
 }
 
+// Try to optimize SGPR reg sequences that are splat <s, s> or <s, s, s, s>
+// where all uses are PackedSingleSGPR64BitInst, replacing with <s, undef, ...>
+bool SIFoldOperandsImpl::tryFoldSGPRSplatRegSequence(MachineInstr &MI) {
----------------
changpeng wrote:

Added subtarget checks. We may allow additional subtargets as we support new instructions that have similar SGPR read property. 

https://github.com/llvm/llvm-project/pull/217182


More information about the llvm-commits mailing list