Cranelift: Consider taking trapnz
and trapz
all the way to the backends rather than legalizing them
#6055
Labels
cranelift:mid-end
clif-to-clif related passes, legalizations, etc...
isle
Related to the ISLE domain-specific language
Right now we legalize them into a conditional jump to a cold block with a trap intruction early on in the pipeline.
But every backend already has some variant of
MInst.TrapIf
, which is the same astrapnz
, so it would be easy to support in lowering if we wanted to move it there.Benefits:
Not introducing a bunch of extra blocks makes compilation faster for everyone.
It is also the only legalization that currently introduces new blocks, which is something ISLE can't do right now, and therefore is preventing us from porting legalization to ISLE.
Finally it makes it so we could mark
trapnz
as having idempotent side effects which would allow us to GVN them. This would further improve bounds checks on multiple loads of the same dynamic index with differing static offsets for the non-Spectre case (e.g. what is talked about as next steps in cranelift-wasm: Add a bounds-checking optimization for dynamic memories and guard pages #6031)The text was updated successfully, but these errors were encountered: