Stream: git-wasmtime

Topic: wasmtime / PR #13922 Cranelift: skip CFG rebuild in egrap...


view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 15:56):

fitzgen opened PR #13922 from fitzgen:rebuild-cfg-only-when-needed to bytecodealliance:main:

Previously, the egraph pass unconditionally recomputed the CFG, determined reachability via a DFS traversal, and eliminated unreachable code after its optimize loop. It did this to clean up blocks that branch simplification may have made unreachable. But a block's successor set (and hence reachability) can only change when a terminator is rewritten, and that doesn't happen on many functions.

This commit adds tracking of whether any skeleton simplification rewrote a block terminator and skips the CFG rebuild, reachability computation, and dead-code elimination entirely when no block terminator was rewritten.

<!--
Please make sure you include the following information:

Our development process is documented in the Wasmtime book:
https://docs.wasmtime.dev/contributing-development-process.html

Please ensure all communication follows the code of conduct:
https://github.com/bytecodealliance/wasmtime/blob/main/CODE_OF_CONDUCT.md
-->

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 15:56):

fitzgen requested cfallin for a review on PR #13922.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 15:56):

fitzgen requested wasmtime-compiler-reviewers for a review on PR #13922.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 16:23):

:thumbs_up: cfallin submitted PR review.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 16:23):

:speech_balloon: cfallin created PR review comment:

Rather than threading through a flag (and returning a bool, which is always a bit ambiguous), could we have a helper SkeletonInstSimplification::rewrites_terminator() that's a simple exhaustive match-predicate, then cfg_maybe_changed |= cmd.rewrites_terminator(); at the callsite above?

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 17:08):

fitzgen updated PR #13922.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 17:09):

fitzgen has enabled auto merge for PR #13922.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 17:17):

fitzgen added PR #13922 Cranelift: skip CFG rebuild in egraph pass when no terminator changed to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 17:42):

github-merge-queue[bot] removed PR #13922 Cranelift: skip CFG rebuild in egraph pass when no terminator changed from the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 17:51):

fitzgen added PR #13922 Cranelift: skip CFG rebuild in egraph pass when no terminator changed to the merge queue.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 18:16):

:check: fitzgen merged PR #13922.

view this post on Zulip Wasmtime GitHub notifications bot (Jul 21 2026 at 18:16):

fitzgen removed PR #13922 Cranelift: skip CFG rebuild in egraph pass when no terminator changed from the merge queue.


Last updated: Jul 29 2026 at 05:03 UTC