[llvm] [RISCV] Unify vsetvli compatibility logic in forward and backwards passes (PR #71657)
Luke Lau via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 8 07:15:28 PST 2023
================
@@ -1495,14 +1472,31 @@ void RISCVInsertVSETVLI::doLocalPostpass(MachineBasicBlock &MBB) {
ToDelete.push_back(&MI);
// Leave NextMI unchanged
continue;
- } else if (canMutatePriorConfig(MI, *NextMI, Used)) {
+ } else if (NextInfo.isCompatible(Used, getInfoForVSETVLI(MI), *MRI,
+ true)) {
if (!isVLPreservingConfig(*NextMI)) {
MI.getOperand(0).setReg(NextMI->getOperand(0).getReg());
MI.getOperand(0).setIsDead(false);
+
+ MachineOperand &AVL = MI.getOperand(1);
+ // If the old AVL was only used by MI, it's dead.
+ if (AVL.isReg() && AVL.getReg().isVirtual() &&
+ MRI->hasOneNonDBGUse(AVL.getReg()))
+ MRI->getVRegDef(AVL.getReg())->eraseFromParent();
----------------
lukel97 wrote:
This looks like it could have been pulled out into a separate patch but it has no effect on main, because we currently don't consider these cases as compatible
https://github.com/llvm/llvm-project/pull/71657
More information about the llvm-commits
mailing list