[llvm] [RISCV] Split out VSETVLIInfo AVL states to be more explicit (PR #89964)

Piyou Chen via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 21:54:29 PDT 2024


================
@@ -935,14 +964,13 @@ static VSETVLIInfo computeInfoForInstr(const MachineInstr &MI, uint64_t TSFlags,
   // AVL operand with the AVL of the defining vsetvli.  We avoid general
   // register AVLs to avoid extending live ranges without being sure we can
   // kill the original source reg entirely.
-  if (InstrInfo.hasAVLReg() && InstrInfo.getAVLReg().isVirtual()) {
-    MachineInstr *DefMI = MRI->getVRegDef(InstrInfo.getAVLReg());
-    if (DefMI && isVectorConfigInstr(*DefMI)) {
+  if (InstrInfo.hasAVLReg()) {
+    MachineInstr *DefMI = MRI->getUniqueVRegDef(InstrInfo.getAVLReg());
+    if (isVectorConfigInstr(*DefMI)) {
----------------
BeMg wrote:

getUniqueVRegDef may return a nullptr if none is found, although a valid program should always have a VRegDef here.

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


More information about the llvm-commits mailing list