by rwmj · 3y ago · 0 comments
lea is a pretty common instruction even in non-OCaml code so this is annoying. I wonder if this has changed since 2014?
$ objdump -d /usr/bin/ls | grep '\blea\b' | wc -l
908
$ objdump -d /usr/bin/ls | wc -l
21398
4.2% of all instructions, and that's an underestimate because the raw objdump -d output contains blank lines, nops, etc.For an OCaml 4.14 program (/usr/bin/virt-v2v), I got 38886 / 432937 which is 9.0%.
For OCaml 5 using the flambda optimizer, 36531 / 480357 = 7.6%
Good question. Probably not. LLVM reduced the number of LEAs in 2017. https://reviews.llvm.org/D32277
Also, Golang is gradually reducing the number of slow LEAs. https://github.com/golang/go/issues/21735
> grep '\blea\b' | wc -l
This maybe isn't sophisticated enough? The other links seem to explain two operand LEA isn't so problematic.
https://github.com/ocaml/ocaml/pull/8531 https://github.com/ocaml/ocaml/issues/9850