[llvm] TargetInstrInfo: make getOperandLatency return optional (NFC) (PR #73769)
Björn Pettersson via llvm-commits
llvm-commits at lists.llvm.org
Sun Dec 3 13:52:07 PST 2023
================
@@ -186,21 +190,13 @@ unsigned TargetSchedModel::computeOperandLatency(
unsigned DefClass = DefMI->getDesc().getSchedClass();
OperLatency = InstrItins.getOperandCycle(DefClass, DefOperIdx);
}
- if (OperLatency >= 0)
- return OperLatency;
-
- // No operand latency was found.
- unsigned InstrLatency = TII->getInstrLatency(&InstrItins, *DefMI);
-
- // Expected latency is the max of the stage latency and itinerary props.
- // Rather than directly querying InstrItins stage latency, we call a TII
- // hook to allow subtargets to specialize latency. This hook is only
- // applicable to the InstrItins model. InstrSchedModel should model all
- // special cases without TII hooks.
- InstrLatency =
- std::max(InstrLatency, TII->defaultDefLatency(SchedModel, *DefMI));
- return InstrLatency;
+
+ // Expected latency is the max of InstrLatency and DefaultDefLatency, if we
+ // didn't find an operand latency.
+ return OperLatency ? *OperLatency
+ : std::max(InstrLatency, DefaultDefLatency);
----------------
bjope wrote:
What happened to the the `InstrLatency = TII->getInstrLatency(&InstrItins, *DefMI);` statement?
Once again, the commit is doing lots of refactoring, but then it seems like you slipped in a potential change in the behavior as well.
https://github.com/llvm/llvm-project/pull/73769
More information about the llvm-commits
mailing list