[llvm] [AMDGPU] Prevent folding of FMAC into FMAAK with two literals (PR #217438)
Igor Wodiany via llvm-commits
llvm-commits at lists.llvm.org
Thu Aug 27 06:11:22 PDT 2026
================
@@ -4001,6 +4001,10 @@ bool SIInstrInfo::foldImmediate(MachineInstr &UseMI, MachineInstr &DefMI,
if (pseudoToMCOpcode(NewOpc) == -1)
return false;
+ if ((Src0->isImm() && !isInlineConstant(*Src0)) ||
----------------
IgWod wrote:
So `isOperandLegal` already checks for this condition but it doesn't help in this case, I think. For this helper to work we need a valid instruction to check against, but we won't have that until we call `legalizeOperands` further down. So to re-use `isOperandLegal` we would have to construct the new instruction, check legality and then roll-back if that fails. Checking `isImm` and `isInlineConstant` at the point we do it is much simpler.
https://github.com/llvm/llvm-project/pull/217438
More information about the llvm-commits
mailing list