[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:15:31 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:
This isn't explaining why to do this, but this is also an API flaw that's always been there. We need an isOperandLegal that doesn't account for the context of the other operands
https://github.com/llvm/llvm-project/pull/121326
More information about the llvm-commits
mailing list