[llvm] [RISCV] Implement RISCVInstrInfo::isAddImmediate (PR #72356)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 15 22:38:13 PST 2023
================
@@ -2438,6 +2438,23 @@ MachineBasicBlock::iterator RISCVInstrInfo::insertOutlinedCall(
return It;
}
+std::optional<RegImmPair> RISCVInstrInfo::isAddImmediate(const MachineInstr &MI,
+ Register Reg) const {
+ // TODO: Handle cases where Reg is a super- or sub-register of the
+ // destination register.
+ const MachineOperand &Op0 = MI.getOperand(0);
+ if (!Op0.isReg() || Reg != Op0.getReg())
+ return std::nullopt;
+
+ // Don't consider ADDIW as a candidate because the caller may not be aware
+ // of its sign extension behaviour.
+ if (MI.getOpcode() == RISCV::ADDI && MI.getOperand(1).isReg() &&
----------------
topperc wrote:
Ok thanks. I'm not debuginfo expert either. So this patch LGTM
https://github.com/llvm/llvm-project/pull/72356
More information about the llvm-commits
mailing list