bytecodealliance / bytecodealliance/wasmtime
Remove `>` and `>=` comparisons from IR
- Dominant language
- Rust
- Stars
- 18.6k
- Forks
- 1.8k
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 126
Description
#### Feature
The condition codes for performing the `>` and `>=` comparisons on integers should be removed from the Cranelift IR
#### Benefit
Makes the IR more strongly normalizing. At the moment, there are two equivalent ways of specifying the same computation: `x > y` and `y < x` are semantically equivalent but have different representations in the IR.
Having only one possible representation would mean fewer cases to consider when writing lowering/optimization code, and fewer tests have to be performed at runtime when legalizing/optimizing programs.
#### Implementation
Continue to accept the `sgt`, `sge`, `ugt` and `uge` condition codes when consuming textual IR, but convert them to their swapped forms and swap the arguments to `icmp` during parsing. Update legalization/optimization code to fix any codegen regressions.
#### Alternatives
Do nothing
Contributor guide
Assessment
This issue has not been assessed yet.