[llvm] [RISCV] Add XSfmm pseudo instruction and vset* insertion support (PR #143068)

Luke Lau via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 30 02:01:43 PDT 2025


================
@@ -1784,6 +1899,83 @@ void RISCVInsertVSETVLI::insertReadVL(MachineBasicBlock &MBB) {
   }
 }
 
+static void shrinkIntervalAndRemoveDeadMI(MachineOperand &MO,
+                                          LiveIntervals *LIS,
+                                          const TargetInstrInfo *TII) {
+  Register Reg = MO.getReg();
+  MO.setReg(RISCV::NoRegister);
+  MO.setIsKill(false);
+
+  if (!LIS)
+    return;
+
+  LiveInterval &LI = LIS->getInterval(Reg);
+
+  // Erase the AVL operand from the instruction.
----------------
lukel97 wrote:

I think it's because some instructions like vmv.s.x won't end up using the AVL in a vsetvli instruction so their AVL will end up dead (due to transferBefore etc), see https://github.com/llvm/llvm-project/pull/65934/files

But it doesn't look we do anything similar for VSETTK/VSETTM so we can probably just remove this bit of code

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


More information about the llvm-commits mailing list