[llvm] TargetInstrInfo: make getOperandLatency return optional (NFC) (PR #73769)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 4 03:48:12 PST 2023
================
@@ -168,16 +168,20 @@ static unsigned findUseIdx(const MachineInstr *MI, unsigned UseOperIdx) {
return UseIdx;
}
-// Top-level API for clients that know the operand indices.
+// Top-level API for clients that know the operand indices. This doesn't need to
+// return std::optional<unsigned>, as it always returns a valid latency.
unsigned TargetSchedModel::computeOperandLatency(
const MachineInstr *DefMI, unsigned DefOperIdx,
const MachineInstr *UseMI, unsigned UseOperIdx) const {
+ const unsigned InstrLatency = computeInstrLatency(DefMI);
+ const unsigned DefaultDefLatency = TII->defaultDefLatency(SchedModel, *DefMI);
+
if (!hasInstrSchedModel() && !hasInstrItineraries())
- return TII->defaultDefLatency(SchedModel, *DefMI);
+ return InstrLatency;
----------------
artagnon wrote:
This is handled by `computeInstrLatency`.
https://github.com/llvm/llvm-project/pull/73769
More information about the llvm-commits
mailing list