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

Matt Arsenault via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 2 05:29:54 PST 2025


================
@@ -2785,6 +2799,9 @@ 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)) {
+    if (isOperandLegal(MI, Src1Idx, &Src0))
----------------
arsenm wrote:

At least one of these isInlineConstant checks is redundant with the isOperandLegal check 

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


More information about the llvm-commits mailing list