[llvm] c499e7a - [NFC][MC] `MCInst`: `Operands` small size optimization: store 10, not 8, inline `MCOperand`
Roman Lebedev via llvm-commits
llvm-commits at lists.llvm.org
Tue Dec 13 10:21:54 PST 2022
Author: Roman Lebedev
Date: 2022-12-13T21:21:07+03:00
New Revision: c499e7a8a74e85d35b135d1b4c249503603827aa
URL: https://github.com/llvm/llvm-project/commit/c499e7a8a74e85d35b135d1b4c249503603827aa
DIFF: https://github.com/llvm/llvm-project/commit/c499e7a8a74e85d35b135d1b4c249503603827aa.diff
LOG: [NFC][MC] `MCInst`: `Operands` small size optimization: store 10, not 8, inline `MCOperand`
This improves the torture test of
```
./bin/llvm-exegesis -mcpu=znver3 -mode=inverse_throughput --opcode-index=-1 --benchmarks-file=/dev/null --dump-object-to-disk=0 --measurements-print-progress --skip-measurements
```
from ~2m16s to ~2min07s, and has the following effect on memory:
```
heaptrack stats:
allocations: 100828624 -> 77362343 (-23.2%)
leaked allocations: 1128
temporary allocations: 24911300 -> 1576308 (-93.7%) !!!
peak heap memory consumption:
78.2MB after 02.121s -> 76.4MB after 01.985s (-2.3%)
peak RSS (including heaptrack overhead):
193.4MB -> 192.6MB (-0.4%)
```
The reasoning is that having more Operands than the SSO is costly,
because we go to global allocator, but having larger SSO is fine,
even if it's not always needed, because MCInst is hopefully pool-allocated.
I'm not sure who is the code owner of this component.
Reviewed By: craig.topper
Differential Revision: https://reviews.llvm.org/D139882
Added:
Modified:
llvm/include/llvm/MC/MCInst.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/MC/MCInst.h b/llvm/include/llvm/MC/MCInst.h
index cb2616533bf5b..2bc310852fe50 100644
--- a/llvm/include/llvm/MC/MCInst.h
+++ b/llvm/include/llvm/MC/MCInst.h
@@ -189,7 +189,7 @@ class MCInst {
unsigned Flags = 0;
SMLoc Loc;
- SmallVector<MCOperand, 8> Operands;
+ SmallVector<MCOperand, 10> Operands;
public:
MCInst() = default;
More information about the llvm-commits
mailing list