[llvm] [RISCV] Adjust LMUL if not used to avoid VL toggle (PR #69259)
Philip Reames via llvm-commits
llvm-commits at lists.llvm.org
Fri Oct 20 11:27:12 PDT 2023
================
@@ -1463,6 +1463,57 @@ static bool canMutatePriorConfig(const MachineInstr &PrevMI,
return areCompatibleVTYPEs(PriorVType, VType, Used);
}
+// If LMUL or the SEW/LMUL ratio aren't demanded and MI and NextMI have the same
+// AVL, then we can try and change MI's LMUL so that we can avoid setting VL in
+// NextMI, e.g:
+//
+// vsetivli zero, 4, e32, m1, ta, ma
+// vsetivli zero, 4, e16, mf4, ta, ma
+//
+// vsetivli zero, 4, e32, mf2, ta, ma
+// vsetvli zero, zero, e16, mf4, ta, ma
+//
+// If possible, returns the new VTYPE that should be used for MI.
+static std::optional<unsigned>
+canAdjustSEWLMULRatio(const MachineInstr &MI, const MachineInstr &NextMI,
----------------
preames wrote:
Function turns the VTYPE, not a boolean. So a better name might be: getAdjustedVTYPE
https://github.com/llvm/llvm-project/pull/69259
More information about the llvm-commits
mailing list