diff options
author | Reid Kleckner <rnk@google.com> | 2023-12-14 22:48:57 +0000 |
---|---|---|
committer | Reid Kleckner <rnk@google.com> | 2024-01-12 23:13:01 +0000 |
commit | 21a77e8a92a8d97f0dfd5f9f4faa7b6bc82887aa (patch) | |
tree | c4ed7259ab2655d36683480d302e8064de5fa82c /llvm/docs/tutorial | |
parent | dc1e2790e476499f6007efcd73ab9d648bfc48bb (diff) | |
download | llvm-21a77e8a92a8d97f0dfd5f9f4faa7b6bc82887aa.zip llvm-21a77e8a92a8d97f0dfd5f9f4faa7b6bc82887aa.tar.gz llvm-21a77e8a92a8d97f0dfd5f9f4faa7b6bc82887aa.tar.bz2 |
[IR] Reorder Value fields to put the SubclassID first (#53520)
Placing the class id at offset 0 should make `isa` and `dyn_cast` faster
by eliminating the field offset (previously 0x10) from the memory
operand, saving encoding space on x86, and, in theory, an add micro-op.
You can see the load encodes one byte smaller here:
https://godbolt.org/z/Whvz4can9
The compile time tracker shows some modestly positive results in the
on the `cycle` metric and in the final clang binary size metric:
https://llvm-compile-time-tracker.com/compare.php?from=33b54f01fe32030ff60d661a7a951e33360f82ee&to=2530347a57401744293c54f92f9781fbdae3d8c2&stat=cycles
Clicking through to the per-library size breakdown shows that
instcombine size reduces by 0.68%, which is meaningful, and I believe
instcombine is known to be a hotspot.
It is, however, potentially noise. I still think we should do this,
because notionally, the class id really acts as the vptr of the Value,
and conventionally the vptr is always at offset 0.
Diffstat (limited to 'llvm/docs/tutorial')
0 files changed, 0 insertions, 0 deletions