[llvm] [RISCV] Add XSfmm pseudo instruction and vset* insertion support (PR #143068)
Brandon Wu via llvm-commits
llvm-commits at lists.llvm.org
Tue Sep 23 07:51:17 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.
+ SmallVector<MachineInstr *> DeadMIs;
+ LIS->shrinkToUses(&LI, &DeadMIs);
+ // TODO: Enable this once needVSETVLIPHI is supported.
+ // SmallVector<LiveInterval *> SplitLIs;
+ // LIS->splitSeparateComponents(LI, SplitLIs);
+
+ for (MachineInstr *DeadMI : DeadMIs) {
+ if (!TII->isAddImmediate(*DeadMI, Reg))
+ continue;
+ LIS->RemoveMachineInstrFromMaps(*DeadMI);
+ DeadMI->eraseFromParent();
----------------
4vtomat wrote:
I think DeadMI doesn't include MI right? like https://github.com/llvm/llvm-project/blob/main/llvm/lib/Target/RISCV/RISCVInsertVSETVLI.cpp#L1472
https://github.com/llvm/llvm-project/pull/143068
More information about the llvm-commits
mailing list