[llvm] [MCA] Enable customization of individual instructions (PR #155420)

Min-Yih Hsu via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 17 10:19:47 PDT 2025


================
@@ -383,6 +383,20 @@ that do not start with `LLVM-MCA-` are ignored by :program:`llvm-mca`.
 An instruction (a MCInst) is added to an InstrumentRegion R only
 if its location is in range [R.RangeStart, R.RangeEnd].
 
+There is one instrument that can be used on all targets to explicitly
+set instruction latencies. It can be used, for example, to model the
+cache misses that impact load latencies. The syntax is like
+
+.. code-block:: none
+
+  # LLVM-MCA-LATENCY 100
+  mov (%edi), %eax
+  # LLVM-MCA-LATENCY
+
+It set the latency of mov instruction to 100. LLVM-MCA-LATENCY without
----------------
mshockwave wrote:

```suggestion
It sets the latency of mov instruction to 100. LLVM-MCA-LATENCY without
```

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


More information about the llvm-commits mailing list