[llvm] [Mips] Do not emit instruction teq if divisor is non-zero immediate value in FastISel implementation (PR #135768)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 24 03:03:24 PDT 2025
================
@@ -1947,7 +1947,11 @@ bool MipsFastISel::selectDivRem(const Instruction *I, unsigned ISDOpcode) {
return false;
emitInst(DivOpc).addReg(Src0Reg).addReg(Src1Reg);
- emitInst(Mips::TEQ).addReg(Src1Reg).addReg(Mips::ZERO).addImm(7);
+ if (!isa<ConstantInt>(I->getOperand(1)) ||
+ (isa<ConstantInt>(I->getOperand(1)) &&
+ dyn_cast<ConstantInt>(I->getOperand(1))->isZero())) {
----------------
yingopq wrote:
`I` was `const Instruction *`, did not have method `getConstantOperandVal`.
https://github.com/llvm/llvm-project/pull/135768
More information about the llvm-commits
mailing list