Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Optimize representation of sequences in Useless pass
The `Useless` optimization pass may determine that the contents of a sequence (array or vector) is useless; similarly, it may determine that the length of a sequence is useless; finally, it may determine that the identity of an array is useless. However, the transformation performed by the `Useless` optimization pass would, at most, change a `t array` or `t vector` to `unit array` or `unit vector`. This commit allows the `Useless` optimization pass to change sequences with useless contents to simpler types. In particular: * a `t array` with useless contents, useless length, and useless identity becomes a `unit` * a `t array` with useless contents, useless length, and useful identity becomes a `unit ref` * a `t array` with useless contents, useful length, and useless identity becomes a `word64` (or a `word32` on 32-bit platforms) * a `t array` with useless contents, useful length, and useful identity becomes a `word64 ref` (or a `word32 ref` on 32-bit platforms) * a `t vector` with useless contents and useless length becomes a `unit` * a `t vector` with useless contents and useful length becomes a `word64` (or a `word32` on 32-bit platforms) Such optimizations do not happen frequently, but there are a few instances in a self-compile.
- Loading branch information