bytecodealliance / bytecodealliance/wasmtime
Merge blocks in `cranelift-frontend` and/or the mid-end
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
When a block has only a single, unconditional predecessor, we should merge it into its predecessor. We see this relatively frequently due to the way that `cranelift-wasm` creates blocks (which can certainly be improved, but I think can't fully solve this issue).
One option is to do this during CLIF construction in `cranelift-frontend` when we call `seal_block`, as that is when we are declaring that all predecessors for a block have been linked up.
Another option is to do this somewhere in the mid-end, either when building the e-graph or when elaborating out of it.
We might want to do both, since legalization can also introduce new blocks.
Contributor guide
Assessment
This issue has not been assessed yet.