[llvm] [NFC][RISCV] Keep AVLReg define instr inside VSETVLInfo (PR #89180)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 24 23:33:03 PDT 2024


================
@@ -964,10 +969,10 @@ 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()) {
-    MachineInstr *DefMI = MRI->getUniqueVRegDef(InstrInfo.getAVLReg());
-    if (isVectorConfigInstr(*DefMI)) {
-      VSETVLIInfo DefInstrInfo = getInfoForVSETVLI(*DefMI);
+  if (InstrInfo.hasAVLDefMI()) {
+    const MachineInstr *DefMI = InstrInfo.getAVLDefMI();
+    if (DefMI && isVectorConfigInstr(*DefMI)) {
----------------
lukel97 wrote:

DefMI should never be null, what do you think about changing `getAVLDefMI()` to return a const reference? Looks like a lot of the uses require dereferencing it anyway. 

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


More information about the llvm-commits mailing list