[llvm] [llvm-mca] Add command line option -call-latency (PR #92958)

Chinmay Deshpande via llvm-commits llvm-commits at lists.llvm.org
Tue May 21 16:13:11 PDT 2024


================
@@ -220,17 +221,18 @@ static void initializeUsedResources(InstrDesc &ID,
 
 static void computeMaxLatency(InstrDesc &ID, const MCInstrDesc &MCDesc,
                               const MCSchedClassDesc &SCDesc,
-                              const MCSubtargetInfo &STI) {
+                              const MCSubtargetInfo &STI,
+                              unsigned CallLatency) {
   if (MCDesc.isCall()) {
     // We cannot estimate how long this call will take.
-    // Artificially set an arbitrarily high latency (100cy).
-    ID.MaxLatency = 100U;
+    // Artificially set an arbitrarily high latency (default: 100cy).
+    ID.MaxLatency = CallLatency;
     return;
   }
 
   int Latency = MCSchedModel::computeInstrLatency(STI, SCDesc);
-  // If latency is unknown, then conservatively assume a MaxLatency of 100cy.
-  ID.MaxLatency = Latency < 0 ? 100U : static_cast<unsigned>(Latency);
+  // If latency is unknown, then conservatively assume a MaxLatency set for calls (default: 100cy).
----------------
chinmaydd wrote:

Thanks for that. I should have checked the formatting guidelines before pushing.

https://github.com/llvm/llvm-project/pull/92958


More information about the llvm-commits mailing list