[llvm] [AMDGPU] Add commute for some VOP3 inst (PR #121326)

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 08:36:45 PST 2025


================
@@ -2798,7 +2798,8 @@ MachineInstr *SIInstrInfo::commuteInstructionImpl(MachineInstr &MI, bool NewMI,
   } else if (!Src0.isReg() && Src1.isReg()) {
     if (isOperandLegal(MI, Src1Idx, &Src0))
       CommutedMI = swapRegAndNonRegOperand(MI, Src1, Src0);
-  } else if (isInlineConstant(Src0) && isInlineConstant(Src1)) {
+  } else if (isInlineConstant(Src1)) {
+    // If Src1 is inline constant and Src0 is not, then isOperandLegal rejects
----------------
arsenm wrote:

Or rather, one that takes the full set of operands that need to be considered for the result instruction 

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


More information about the llvm-commits mailing list