[llvm] [AMDGPU] Account for existing SDWA selections (PR #123221)

Jeffrey Byrnes via llvm-commits llvm-commits at lists.llvm.org
Wed Feb 5 12:59:29 PST 2025


================
@@ -1172,6 +1209,21 @@ bool SIPeepholeSDWA::convertToSDWA(MachineInstr &MI,
     SDWAInst->tieOperands(PreserveDstIdx, SDWAInst->getNumOperands() - 1);
   }
 
+  return SDWAInst.getInstr();
+}
+
+bool SIPeepholeSDWA::convertToSDWA(MachineInstr &MI,
+                                   const SDWAOperandsVector &SDWAOperands) {
+  LLVM_DEBUG(dbgs() << "Convert instruction:" << MI);
+
+  MachineInstr *SDWAInst;
+  if (TII->isSDWA(MI.getOpcode())) {
+    SDWAInst = MI.getParent()->getParent()->CloneMachineInstr(&MI);
----------------
jrbyrnes wrote:

Do we really need the clone? Maybe we can handle code removal just for the case with no pre-existing sdwa

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


More information about the llvm-commits mailing list