[llvm] MTM: improve operand latency when missing sched info (PR #101389)
Ramkumar Ramachandra via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 23 06:37:25 PDT 2024
================
@@ -761,6 +762,60 @@ static void updatePhysDepsDownwards(const MachineInstr *UseMI,
}
}
+/// Estimates the number of cycles elapsed between DefMI and UseMI, DefMI
+/// inclusive and UseMI exclusive, if they're non-null and in the same
+/// BasicBlock. Returns std::nullopt when UseMI is in a different MBB than
+/// DefMI.
+static std::optional<unsigned>
+estimateDefUseCycles(const TargetSchedModel &Sched, const MachineInstr *DefMI,
+ const MachineInstr *UseMI) {
+ if (!DefMI || !UseMI || DefMI == UseMI)
+ return 0;
----------------
artagnon wrote:
The UseMI is missing in many call sites, and I've only included `DefMI == UseMI` for completeness, to independently reason about the function.
https://github.com/llvm/llvm-project/pull/101389
More information about the llvm-commits
mailing list