[llvm] unpack packed instructions overlapped by MFMAs post-RA scheduling (PR #157968)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 18 07:25:06 PDT 2025


================
@@ -39,6 +47,37 @@ class SIPreEmitPeephole {
                              const MachineBasicBlock &From,
                              const MachineBasicBlock &To) const;
   bool removeExeczBranch(MachineInstr &MI, MachineBasicBlock &SrcMBB);
+  // Check if the machine instruction being processed is a supported packed
+  // instruction.
+  bool isUnpackingSupportedInstr(MachineInstr &MI) const;
+  // Creates a list of packed instructions following an MFMA that are suitable
+  // for unpacking.
+  void collectUnpackingCandidates(MachineInstr &BeginMI,
+                                  SetVector<MachineInstr *> &InstrsToUnpack,
+                                  uint16_t NumMFMACycles);
+  // v_pk_fma_f32 v[0:1], v[0:1], v[2:3], v[2:3] op_sel:[1,1,1]
+  // op_sel_hi:[0,0,0]
+  // ==>
+  // v_fma_f32 v0, v1, v3, v3
+  // v_fma_f32 v1, v0, v2, v2
+  // Here, we have overwritten v0 before we use it. This function checks if
+  // unpacking can lead to such a situation.
+  bool canUnpackingIntroduceDependencies(const MachineInstr &MI);
----------------
jrbyrnes wrote:

Naming -- dependencies is not the right concept -- suggest to use clobbers register instead.

`canUnpackingClobberRegister`

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


More information about the llvm-commits mailing list