[Custom Descriptors] Optimize RefCast to RefCastDesc in GlobalStructInference
That is something the pass verifies,
https://github.com/WebAssembly/binaryen/blob/46b37d348c4025c7e618dd4507d96b569df5f5ea/src/passes/GlobalStructInference.cpp#L113-L115
Unless I misunderstood you?
Great, I had forgotten we already did that.
There are some TODOs here, but the larger question is whether this seems worthwhile. I see a 1% code size regression on j2cl for example - do we expect the benefit to be larger than that? @tlively @jakobkummerow
This is primarily a performance improvement. ref.cast_desc is faster than other casts.
Makes sense, but do we think it is fast enough to justify a 1% size regression? Given that iiuc we think the VM can do much of this too.
This should only be run at the very end, manually - running it in every -O3 causes code size increases for various reasons (1% increase affects inlining, and also we end up with more exact types, which inhibit merging of locals etc.), that accumulates, and it does not enable other toolchain opts anyhow.