[PATCH] D91719: [RISCV] Add support for using -msave-restore with tailcalls
Edward Jones via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon May 17 15:24:08 PDT 2021
edward-jones added a comment.
On the RISC-V sync-up call I said I would try and provide some code size numbers for these changes. First I mentioned that I saw a code size regression when compiled Embench, here's per-benchmark numbers:
`-Oz -msave-restore` (no tailcall version)
Benchmark size
--------- ----
aha-mont64 1,964
crc32 1,140
cubic 55,942
edn 2,364
huffbench 2,456
matmult-int 1,420
minver 11,160
nbody 10,748
nettle-aes 3,852
nettle-sha256 8,552
nsichneu 14,268
picojpeg 9,476
qrduino 7,256
sglib-combined 3,528
slre 3,652
st 11,056
statemate 4,908
ud 1,620
wikisort 15,060
--------- -----
Geometric mean 5,347
Geometric SD 2.65
Geometric range 12,143.345300622888
`-Oz -msave-restore` (with tailcall version)
Benchmark size
--------- ----
aha-mont64 1,968
crc32 1,340
cubic 55,942
edn 2,372
huffbench 2,656
matmult-int 1,476
minver 11,164
nbody 10,752
nettle-aes 3,896
nettle-sha256 8,588
nsichneu 14,272
picojpeg 9,476
qrduino 7,428
sglib-combined 6,512
slre 3,656
st 11,116
statemate 4,912
ud 1,620
wikisort 15,060
--------- -----
Geometric mean 5,620
Geometric SD 2.59
Geometric range 12,365.236826034434
The Embench benchmarks are very small, so the constant cost of the additional `__riscv_restore_tailcall` entry points exceeds the benefit of the optimization.
To try something larger I also grabbed sqlite 3.35.5 and tried building that (again `-Oz -msave-restore`). Below are results for that experiment.
text data bss dec hex filename
652816 5604 903 659323 a0f7b sqlite3-save-restore.o
645328 5604 903 651835 9f23b sqlite3-save-restore-tailcall.o
So for this larger codebase where the constant cost of the additional functions is minor, we see approximately a 1% reduction in code size (note that this only compiling to an object file, so it doesn't include the the cost of the save-restore compiler-rt functions)
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D91719/new/
https://reviews.llvm.org/D91719
More information about the llvm-commits
mailing list