[llvm] [RISCV] Handle recurrences in RISCVVLOptimizer (PR #151285)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 11 11:17:04 PDT 2025


================
@@ -1599,6 +1619,30 @@ bool RISCVVLOptimizer::tryReduceVL(MachineInstr &MI) const {
   return true;
 }
 
+static bool isPhysical(const MachineOperand &MO) {
+  return MO.isReg() && MO.getReg().isPhysical();
+}
+
+static bool isVirtualVec(const MachineOperand &MO) {
+  return MO.isReg() && MO.getReg().isVirtual() &&
+         RISCVRegisterInfo::isRVVRegClass(
+             MO.getParent()->getMF()->getRegInfo().getRegClass(MO.getReg()));
----------------
topperc wrote:

This feels like a lot of pointer chasing to do on every operand.

Can we make this a lambda in the one function that calls it and capture MRI from the RISCVVLOptimizer class?

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


More information about the llvm-commits mailing list