wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

Merge blocks in `cranelift-frontend` and/or the mid-end

Open fitzgen opened this issue 1 year ago • 0 comments

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.

fitzgen avatar Jun 12 '24 21:06 fitzgen