Take this as an example : D128393 [RISCV] Add macrofusion infrastructure and one example usage. (llvm.org)
LUI and ADDI can fusion only when
Register FirstDest = FirstMI->getOperand(0).getReg();
SecondMI.getOperand(1).getReg() == FirstDest
SecondMI.getOperand(0).getReg() == FirstDest
Are there any good ways, maybe something working in the register allocation phase, to help facilitate this condition?