[llvm] [RISCV] Eliminate dead li after emitting VSETVLIs (PR #65934)
Yeting Kuo via llvm-commits
llvm-commits at lists.llvm.org
Thu Nov 16 00:53:07 PST 2023
================
@@ -487,10 +487,7 @@ class VSETVLIInfo {
if (getAVLReg() == RISCV::X0)
return true;
if (MachineInstr *MI = MRI.getVRegDef(getAVLReg());
- MI && MI->getOpcode() == RISCV::ADDI &&
- MI->getOperand(1).isReg() && MI->getOperand(2).isImm() &&
- MI->getOperand(1).getReg() == RISCV::X0 &&
- MI->getOperand(2).getImm() != 0)
+ MI && RISCV::isLoadSImm12(*MI, /*NonZero*/ true))
----------------
yetingk wrote:
Is it a good idea to use `RISCVInstrInfo::isAddImmediate` after #72356 landed?
https://github.com/llvm/llvm-project/pull/65934
More information about the llvm-commits
mailing list