[llvm] [RISCV] Eliminate dead li after emitting VSETVLIs (PR #65934)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 24 11:47:37 PDT 2023
================
@@ -1255,6 +1258,12 @@ void RISCVInsertVSETVLI::emitVSETVLIs(MachineBasicBlock &MBB) {
MachineOperand &VLOp = MI.getOperand(getVLOpNum(MI));
if (VLOp.isReg()) {
// Erase the AVL operand from the instruction.
+ if (MachineInstr *MI = MRI->getVRegDef(VLOp.getReg());
+ MI && MI->getOpcode() == RISCV::ADDI &&
----------------
topperc wrote:
We should probably extract the code from `hasNonZeroAVL` so we can share it.
https://github.com/llvm/llvm-project/pull/65934
More information about the llvm-commits
mailing list