[llvm] [RISCV][MachineCombiner] Add reassociation optimizations for RVV instructions (PR #88307)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 24 01:26:53 PDT 2024
================
@@ -1647,6 +1870,9 @@ bool RISCVInstrInfo::hasReassociableSibling(const MachineInstr &Inst,
bool RISCVInstrInfo::isAssociativeAndCommutative(const MachineInstr &Inst,
bool Invert) const {
+ if (isVectorAssociativeAndCommutative(Inst, Invert))
+ return true;
+
----------------
lukel97 wrote:
Nit, you could also use `RISCV::getRVVMCOpcode` and then just add `RISCV::VADD_VV` etc. to the existing switch below, something like
```suggestion
unsigned Opc = Inst.getOpcode();
if (unsigned RVVOpc = RISCV::getRVVMCOpcode(Opc))
Opc = RVVOpc;
```
Then I don't think we would need the separate vector function
https://github.com/llvm/llvm-project/pull/88307
More information about the llvm-commits
mailing list