So I just installed the emsdk "top of tree" that comes with LLVM 14. Turns out that gives me some ~5% performance improvement in some workloads (HEVC decoding with FFmpeg, which was already hand-optimised to use WebAssembly SIMD intrinsics). Which is great - if only I knew where that's coming from...
Specifically, what is not clear to me is the following:
(1) Is the new load hoisting optimization automatically performed as part of LLVM/s LICM pass? That's probably more a question to the LLVM peeps and I assume that that's a "yes".
(2) Does the "licm" pass in Binaryen's wasm-opt use LLVM's "licm" pass?
(3) Does emcc -O3 already include wasm-opt's "licm" pass? I added -s BINARYEN_EXTRA_PASSES=licm, but that didn't seem to have an effect.
I tried directly invoking LLVM's LICM optimisation by passing -mllvm -licm to emcc, but that makes emcc error out. Interestingly, -mllvm -enable-loop-versioning-licm does work, but seems to be an entirely different optimization altogether.
Sadly, the interplay of emcc, clang, wasm-opt, and LLVM's opt utility isn't all too clear when it comes to non-standard clang/LLVM features...
Soeren