[llvm] [MC][X86] Avoid copying MCInst in emitInstrEnd (PR #94947)

Fangrui Song via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 23:31:59 PDT 2024


MaskRay wrote:

Avoiding `PrevInst` copy has a noticeable compile time improvement, more pronounced with -O0 when assembler time dominates.

```
% hyperfine --warmup 1 --min-runs 10 '/tmp/out/custom2/bin/clang -c sqlite3.i -w' # no 94947
Benchmark 1: /tmp/out/custom2/bin/clang -c sqlite3.i -w
  Time (mean ± σ):     514.6 ms ±   2.5 ms    [User: 497.8 ms, System: 16.7 ms]
  Range (min … max):   510.5 ms … 517.5 ms    10 runs

% hyperfine --warmup 1 --min-runs 10 '/tmp/out/custom2/bin/clang -c sqlite3.i -w' # 94947
Benchmark 1: /tmp/out/custom2/bin/clang -c sqlite3.i -w
  Time (mean ± σ):     507.5 ms ±   1.9 ms    [User: 485.6 ms, System: 21.8 ms]
  Range (min … max):   504.1 ms … 509.9 ms    10 runs
```


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


More information about the llvm-commits mailing list