alexcrichton transferred Issue #767:
I think cranelift-preopt was separated from cranelift-codegen because we assume that, in general, the input IR has been generated by an optimizing compiler (namely, one that ran constant folding). This being said, in our use case, when translating wasm to clif, we're likely to introduce redundancies and constant-foldable instructions that aren't obvious to catch (because we're operating on one wasm binary opcode at a time). There was also another instance of constant-foldable operations being emitted by legalization recently.
In principle, every pass that takes IR and augments it (by adding more IR nodes) is likely to introduce redundancies / constant-foldable instructions. I'd like someone to get more data on this, but how would people feel about putting the cranelift-preopt constant folding facilities into codegen instead?
Last updated: Nov 22 2024 at 17:03 UTC