I find it a little challenging to decide whether I should use subsume or not,
and I think it would be a good idea to clarify more on using subsumes.
It only says to use subsume when the rule discards values on LHS, and not to use it when it only discards constants. However, there are rules contradictory to the principle:
these rules only discard constants but use subsume:
https://github.com/bytecodealliance/wasmtime/blob/68a6afd4f925724fd359c13a27fac5a6163d12f4/cranelift/codegen/src/opts/arithmetic.isle#L7-L16
these rules use subsume does not discard any value on LHS:
https://github.com/bytecodealliance/wasmtime/blob/68a6afd4f925724fd359c13a27fac5a6163d12f4/cranelift/codegen/src/opts/arithmetic.isle#L34-L39
Thanks for reading!
We have the "available locations" analysis now that makes rule 2 unnecessary there -- I should update that README, sorry!
In general, subsume is quite important for compilation performance (I have some data showing this I'll present at some point) but use of it is not necessary semantically. You can think of it as "I am so sure that this rewrite makes things better that you should always take it and discard the original"
so for example, with constant propagation we use it because it's always better to replace a dynamic ALU operation with a literal constant
thanks!
Last updated: Dec 06 2025 at 07:03 UTC